From 6fb1807db71a8c4868441ee9ed9445fc4445f3f8 Mon Sep 17 00:00:00 2001 From: DreamMaoMao <2523610504@qq.com> Date: Wed, 9 Jul 2025 12:21:46 +0800 Subject: [PATCH 1/4] opt: optimzie text-input --- meson.build | 2 +- src/ext-protocol/text-input.h | 9 ++++----- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/meson.build b/meson.build index 53bce672..c6bda126 100644 --- a/meson.build +++ b/meson.build @@ -33,7 +33,7 @@ libm = cc.find_library('m') xcb = dependency('xcb', required : get_option('xwayland')) xlibs = dependency('xcb-icccm', required : get_option('xwayland')) wayland_server_dep = dependency('wayland-server') -wlroots_dep = dependency('wlroots-0.19',version: '>=0.19.0') +wlroots_dep = dependency('wlroots-0.20',version: '>=0.19.0') xkbcommon_dep = dependency('xkbcommon') libinput_dep = dependency('libinput') libwayland_client_dep = dependency('wayland-client') diff --git a/src/ext-protocol/text-input.h b/src/ext-protocol/text-input.h index c82ffac0..6202a7e0 100644 --- a/src/ext-protocol/text-input.h +++ b/src/ext-protocol/text-input.h @@ -301,9 +301,8 @@ static void handle_input_method_commit(struct wl_listener *listener, void *data) { struct dwl_input_method_relay *relay = wl_container_of(listener, relay, input_method_commit); - struct wlr_input_method_v2 *input_method = data; struct text_input *text_input; - assert(relay->input_method == input_method); + struct wlr_input_method_v2 *input_method = relay->input_method; text_input = relay->active_text_input; if (!text_input) { @@ -333,7 +332,8 @@ static void handle_keyboard_grab_destroy(struct wl_listener *listener, void *data) { struct dwl_input_method_relay *relay = wl_container_of(listener, relay, keyboard_grab_destroy); - struct wlr_input_method_keyboard_grab_v2 *keyboard_grab = data; + struct wlr_input_method_keyboard_grab_v2 *keyboard_grab = + relay->input_method->keyboard_grab; wl_list_remove(&relay->keyboard_grab_destroy.link); if (keyboard_grab->keyboard) { @@ -365,7 +365,6 @@ static void handle_input_method_destroy(struct wl_listener *listener, void *data) { struct dwl_input_method_relay *relay = wl_container_of(listener, relay, input_method_destroy); - assert(relay->input_method == data); wl_list_remove(&relay->input_method_commit.link); wl_list_remove(&relay->input_method_grab_keyboard.link); wl_list_remove(&relay->input_method_new_popup_surface.link); @@ -570,7 +569,7 @@ struct dwl_input_method_relay *dwl_im_relay_create() { relay->popup_tree = wlr_scene_tree_create(&scene->tree); relay->new_text_input.notify = handle_new_text_input; - wl_signal_add(&text_input_manager->events.text_input, + wl_signal_add(&text_input_manager->events.new_text_input, &relay->new_text_input); relay->new_input_method.notify = handle_new_input_method; From 1639d14903f48f40ceb7974efaef72f708fb3a21 Mon Sep 17 00:00:00 2001 From: DreamMaoMao <2523610504@qq.com> Date: Tue, 9 Sep 2025 09:06:21 +0800 Subject: [PATCH 2/4] fix: chase wlroots input method api --- src/ext-protocol/text-input.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ext-protocol/text-input.h b/src/ext-protocol/text-input.h index 6202a7e0..89444f32 100644 --- a/src/ext-protocol/text-input.h +++ b/src/ext-protocol/text-input.h @@ -573,7 +573,7 @@ struct dwl_input_method_relay *dwl_im_relay_create() { &relay->new_text_input); relay->new_input_method.notify = handle_new_input_method; - wl_signal_add(&input_method_manager->events.input_method, + wl_signal_add(&input_method_manager->events.new_input_method, &relay->new_input_method); relay->focused_surface_destroy.notify = handle_focused_surface_destroy; From ee8ce08bc90970359360993f507b5aae1c84b29d Mon Sep 17 00:00:00 2001 From: DreamMaoMao <2523610504@qq.com> Date: Tue, 9 Sep 2025 09:28:19 +0800 Subject: [PATCH 3/4] fix: chase text input to wlroots 0.20 --- src/ext-protocol/text-input.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/ext-protocol/text-input.h b/src/ext-protocol/text-input.h index 89444f32..4858130c 100644 --- a/src/ext-protocol/text-input.h +++ b/src/ext-protocol/text-input.h @@ -332,8 +332,7 @@ static void handle_keyboard_grab_destroy(struct wl_listener *listener, void *data) { struct dwl_input_method_relay *relay = wl_container_of(listener, relay, keyboard_grab_destroy); - struct wlr_input_method_keyboard_grab_v2 *keyboard_grab = - relay->input_method->keyboard_grab; + struct wlr_input_method_keyboard_grab_v2 *keyboard_grab = data; wl_list_remove(&relay->keyboard_grab_destroy.link); if (keyboard_grab->keyboard) { From bc8d53367fc2ea5e811a02cf5d7941c2d5130f3a Mon Sep 17 00:00:00 2001 From: DreamMaoMao <2523610504@qq.com> Date: Fri, 17 Oct 2025 12:41:34 +0800 Subject: [PATCH 4/4] chase: chase ime break change for wlroots 0.20 refer: https://gitlab.freedesktop.org/wlroots/wlroots/-/merge_requests/5170#note_3149600 --- src/ext-protocol/text-input.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/ext-protocol/text-input.h b/src/ext-protocol/text-input.h index 4858130c..89444f32 100644 --- a/src/ext-protocol/text-input.h +++ b/src/ext-protocol/text-input.h @@ -332,7 +332,8 @@ static void handle_keyboard_grab_destroy(struct wl_listener *listener, void *data) { struct dwl_input_method_relay *relay = wl_container_of(listener, relay, keyboard_grab_destroy); - struct wlr_input_method_keyboard_grab_v2 *keyboard_grab = data; + struct wlr_input_method_keyboard_grab_v2 *keyboard_grab = + relay->input_method->keyboard_grab; wl_list_remove(&relay->keyboard_grab_destroy.link); if (keyboard_grab->keyboard) {