feat: support input method

The ime.c is basically derived from sway's text_input.c.
This commit is contained in:
chirsz-ever 2025-03-10 04:26:38 +08:00
parent 360e259ca5
commit d2316a3407
No known key found for this signature in database
GPG key ID: FF0569CF49B33CE3
9 changed files with 960 additions and 19 deletions

19
cage.c
View file

@ -52,6 +52,7 @@
#endif
#include "idle_inhibit_v1.h"
#include "ime.h"
#include "output.h"
#include "seat.h"
#include "server.h"
@ -527,6 +528,24 @@ main(int argc, char *argv[])
goto end;
}
server.input_method_manager_v2 = wlr_input_method_manager_v2_create(server.wl_display);
if (!server.input_method_manager_v2) {
wlr_log(WLR_ERROR, "Unable to create the input method manager");
ret = 1;
goto end;
}
server.new_input_method.notify = cg_ime_handle_new_input_method;
wl_signal_add(&server.input_method_manager_v2->events.input_method, &server.new_input_method);
server.text_input_manager_v3 = wlr_text_input_manager_v3_create(server.wl_display);
if (!server.text_input_manager_v3) {
wlr_log(WLR_ERROR, "Unable to create the text input manager");
ret = 1;
goto end;
}
server.new_text_input.notify = cg_ime_handle_new_text_input;
wl_signal_add(&server.text_input_manager_v3->events.text_input, &server.new_text_input);
#if CAGE_HAS_XWAYLAND
struct wlr_xcursor_manager *xcursor_manager = NULL;
struct wlr_xwayland *xwayland = wlr_xwayland_create(server.wl_display, compositor, true);