From 19f76f3dcd0dfb19826c6f5ea55a0d6c37e2bcd8 Mon Sep 17 00:00:00 2001 From: Zephyr Lykos Date: Wed, 14 Aug 2024 04:39:55 +0000 Subject: text_input: Implement input-method popups (#315) --- include/sway/input/text_input.h | 25 +++++++++++++++++++++++++ include/sway/output.h | 4 ++++ 2 files changed, 29 insertions(+) (limited to 'include') diff --git a/include/sway/input/text_input.h b/include/sway/input/text_input.h index 214e61d1..f583af7a 100644 --- a/include/sway/input/text_input.h +++ b/include/sway/input/text_input.h @@ -4,6 +4,7 @@ #include #include #include +#include /** * The relay structure manages the relationship between text-input and @@ -21,18 +22,37 @@ struct sway_input_method_relay { struct sway_seat *seat; struct wl_list text_inputs; // sway_text_input::link + struct wl_list input_popups; // sway_input_popup::link struct wlr_input_method_v2 *input_method; // doesn't have to be present struct wl_listener text_input_new; struct wl_listener input_method_new; struct wl_listener input_method_commit; + struct wl_listener input_method_new_popup_surface; struct wl_listener input_method_grab_keyboard; struct wl_listener input_method_destroy; struct wl_listener input_method_keyboard_grab_destroy; }; +struct sway_input_popup { + struct sway_input_method_relay *relay; + struct wlr_input_popup_surface_v2 *popup_surface; + + int x, y; + bool visible; + + struct wl_list link; + + struct wl_listener popup_map; + struct wl_listener popup_unmap; + struct wl_listener popup_destroy; + struct wl_listener popup_surface_commit; + + struct wl_listener focused_surface_unmap; +}; + struct sway_text_input { struct sway_input_method_relay *relay; @@ -65,4 +85,9 @@ struct sway_text_input *sway_text_input_create( struct sway_input_method_relay *relay, struct wlr_text_input_v3 *text_input); +bool sway_input_popup_get_position( + struct sway_input_popup *popup, int *lx, int *ly); + +void sway_input_popup_damage(struct sway_input_popup *popup); + #endif diff --git a/include/sway/output.h b/include/sway/output.h index a60ddec8..0e9e27c9 100644 --- a/include/sway/output.h +++ b/include/sway/output.h @@ -178,6 +178,10 @@ void output_unmanaged_for_each_surface(struct sway_output *output, void *user_data); #endif +void output_input_popups_for_each_surface(struct sway_output *output, + struct wl_list *input_popups, sway_surface_iterator_func_t iterator, + void *user_data); + void output_drag_icons_for_each_surface(struct sway_output *output, struct wl_list *drag_icons, sway_surface_iterator_func_t iterator, void *user_data); -- cgit v1.2.3