From 722b2ebefcda8b1112762dbce604cf9b0169ea7e Mon Sep 17 00:00:00 2001 From: DreamMaoMao <2523610504@qq.com> Date: Mon, 29 Sep 2025 15:06:47 +0800 Subject: [PATCH] opt: wrong position of fcitx5 popup in wayland mode electron app when first input --- src/ext-protocol/text-input.h | 1 + src/mango.c | 7 +++++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/ext-protocol/text-input.h b/src/ext-protocol/text-input.h index c82ffac..2604949 100644 --- a/src/ext-protocol/text-input.h +++ b/src/ext-protocol/text-input.h @@ -490,6 +490,7 @@ static void handle_text_input_enable(struct wl_listener *listener, void *data) { update_popups_position(relay); send_state_to_input_method(relay); } + wlr_text_input_v3_send_done(text_input->input); } static void handle_text_input_disable(struct wl_listener *listener, diff --git a/src/mango.c b/src/mango.c index 12d665b..ddfc994 100644 --- a/src/mango.c +++ b/src/mango.c @@ -3125,11 +3125,14 @@ void focusclient(Client *c, int lift) { /* Change cursor surface */ motionnotify(0, NULL, 0, 0, 0, 0); + // set text input focus + // must before client_notify_enter, + // otherwise the position of text_input will be wrong. + dwl_im_relay_set_focus(dwl_input_method_relay, client_surface(c)); + /* Have a client, so focus its top-level wlr_surface */ client_notify_enter(client_surface(c), wlr_seat_get_keyboard(seat)); - // set text input focus - dwl_im_relay_set_focus(dwl_input_method_relay, client_surface(c)); /* Activate the new client */ client_activate_surface(client_surface(c), 1); }