diff options
Diffstat (limited to 'sway/input/text_input.c')
-rw-r--r-- | sway/input/text_input.c | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/sway/input/text_input.c b/sway/input/text_input.c index 2a8f6222..b8c19c17 100644 --- a/sway/input/text_input.c +++ b/sway/input/text_input.c | |||
@@ -55,6 +55,37 @@ static void handle_im_commit(struct wl_listener *listener, void *data) { | |||
55 | wlr_text_input_v3_send_done(text_input->input); | 55 | wlr_text_input_v3_send_done(text_input->input); |
56 | } | 56 | } |
57 | 57 | ||
58 | static void handle_im_keyboard_grab_destroy(struct wl_listener *listener, void *data) { | ||
59 | struct sway_input_method_relay *relay = wl_container_of(listener, relay, | ||
60 | input_method_keyboard_grab_destroy); | ||
61 | struct wlr_input_method_keyboard_grab_v2 *keyboard_grab = data; | ||
62 | wl_list_remove(&relay->input_method_keyboard_grab_destroy.link); | ||
63 | |||
64 | if (keyboard_grab->keyboard) { | ||
65 | // send modifier state to original client | ||
66 | wlr_seat_keyboard_notify_modifiers(keyboard_grab->input_method->seat, | ||
67 | &keyboard_grab->keyboard->modifiers); | ||
68 | } | ||
69 | } | ||
70 | |||
71 | static void handle_im_grab_keyboard(struct wl_listener *listener, void *data) { | ||
72 | struct sway_input_method_relay *relay = wl_container_of(listener, relay, | ||
73 | input_method_grab_keyboard); | ||
74 | struct wlr_input_method_keyboard_grab_v2 *keyboard_grab = data; | ||
75 | |||
76 | // send modifier state to grab | ||
77 | struct wlr_keyboard *active_keyboard = wlr_seat_get_keyboard(relay->seat->wlr_seat); | ||
78 | wlr_input_method_keyboard_grab_v2_set_keyboard(keyboard_grab, | ||
79 | active_keyboard); | ||
80 | wlr_input_method_keyboard_grab_v2_send_modifiers(keyboard_grab, | ||
81 | &active_keyboard->modifiers); | ||
82 | |||
83 | wl_signal_add(&keyboard_grab->events.destroy, | ||
84 | &relay->input_method_keyboard_grab_destroy); | ||
85 | relay->input_method_keyboard_grab_destroy.notify = | ||
86 | handle_im_keyboard_grab_destroy; | ||
87 | } | ||
88 | |||
58 | static void text_input_set_pending_focused_surface( | 89 | static void text_input_set_pending_focused_surface( |
59 | struct sway_text_input *text_input, struct wlr_surface *surface) { | 90 | struct sway_text_input *text_input, struct wlr_surface *surface) { |
60 | wl_list_remove(&text_input->pending_focused_surface_destroy.link); | 91 | wl_list_remove(&text_input->pending_focused_surface_destroy.link); |
@@ -245,6 +276,9 @@ static void relay_handle_input_method(struct wl_listener *listener, | |||
245 | wl_signal_add(&relay->input_method->events.commit, | 276 | wl_signal_add(&relay->input_method->events.commit, |
246 | &relay->input_method_commit); | 277 | &relay->input_method_commit); |
247 | relay->input_method_commit.notify = handle_im_commit; | 278 | relay->input_method_commit.notify = handle_im_commit; |
279 | wl_signal_add(&relay->input_method->events.grab_keyboard, | ||
280 | &relay->input_method_grab_keyboard); | ||
281 | relay->input_method_grab_keyboard.notify = handle_im_grab_keyboard; | ||
248 | wl_signal_add(&relay->input_method->events.destroy, | 282 | wl_signal_add(&relay->input_method->events.destroy, |
249 | &relay->input_method_destroy); | 283 | &relay->input_method_destroy); |
250 | relay->input_method_destroy.notify = handle_im_destroy; | 284 | relay->input_method_destroy.notify = handle_im_destroy; |