text_input: Implement input-method popups

This commit is contained in:
Tadeo Kondrak 2020-12-15 21:24:57 -07:00
parent cf413b9c0b
commit 100ac12ac4
8 changed files with 442 additions and 8 deletions

View file

@ -22,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;
@ -66,4 +85,7 @@ 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);
#endif

View file

@ -137,6 +137,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);