diff options
author | Tadeo Kondrak <me@tadeo.ca> | 2020-12-15 21:23:56 -0700 |
---|---|---|
committer | Simon Ser <contact@emersion.fr> | 2021-09-22 09:42:14 +0200 |
commit | 30d3c768174c40fc914d1057403c50072cbef3e4 (patch) | |
tree | 065e34655c038e79aaaa067b198f0bd9b8d9529a /include/wlr | |
parent | e0daa65aa6824607cad717d8d04b4508faaf6397 (diff) |
Implement input_method_v2 popups
Diffstat (limited to 'include/wlr')
-rw-r--r-- | include/wlr/types/wlr_input_method_v2.h | 28 | ||||
-rw-r--r-- | include/wlr/types/wlr_text_input_v3.h | 8 |
2 files changed, 30 insertions, 6 deletions
diff --git a/include/wlr/types/wlr_input_method_v2.h b/include/wlr/types/wlr_input_method_v2.h index 99361d0c..e4401d29 100644 --- a/include/wlr/types/wlr_input_method_v2.h +++ b/include/wlr/types/wlr_input_method_v2.h @@ -12,6 +12,7 @@ #include <stdlib.h> #include <wayland-server-core.h> #include <wlr/types/wlr_seat.h> +#include <wlr/util/box.h> struct wlr_input_method_v2_preedit_string { char *text; @@ -42,6 +43,7 @@ struct wlr_input_method_v2 { bool client_active; // state known to the client uint32_t current_serial; // received in last commit call + struct wl_list popup_surfaces; struct wlr_input_method_keyboard_grab_v2 *keyboard_grab; struct wl_list link; @@ -50,11 +52,31 @@ struct wlr_input_method_v2 { struct { struct wl_signal commit; // (struct wlr_input_method_v2*) + struct wl_signal new_popup_surface; // (struct wlr_input_popup_surface_v2*) struct wl_signal grab_keyboard; // (struct wlr_input_method_keyboard_grab_v2*) struct wl_signal destroy; // (struct wlr_input_method_v2*) } events; }; +struct wlr_input_popup_surface_v2 { + struct wl_resource *resource; + struct wlr_input_method_v2 *input_method; + struct wl_list link; + bool mapped; + + struct wlr_surface *surface; + + struct wl_listener surface_destroy; + + struct { + struct wl_signal map; + struct wl_signal unmap; + struct wl_signal destroy; + } events; + + void *data; +}; + struct wlr_input_method_keyboard_grab_v2 { struct wl_resource *resource; struct wlr_input_method_v2 *input_method; @@ -100,6 +122,12 @@ void wlr_input_method_v2_send_done(struct wlr_input_method_v2 *input_method); void wlr_input_method_v2_send_unavailable( struct wlr_input_method_v2 *input_method); +bool wlr_surface_is_input_popup_surface_v2(struct wlr_surface *surface); +struct wlr_input_popup_surface_v2 *wlr_input_popup_surface_v2_from_wlr_surface( + struct wlr_surface *surface); +void wlr_input_popup_surface_v2_send_text_input_rectangle( + struct wlr_input_popup_surface_v2 *popup_surface, struct wlr_box *sbox); + void wlr_input_method_keyboard_grab_v2_send_key( struct wlr_input_method_keyboard_grab_v2 *keyboard_grab, uint32_t time, uint32_t key, uint32_t state); diff --git a/include/wlr/types/wlr_text_input_v3.h b/include/wlr/types/wlr_text_input_v3.h index 47d0fc39..53c52a37 100644 --- a/include/wlr/types/wlr_text_input_v3.h +++ b/include/wlr/types/wlr_text_input_v3.h @@ -12,6 +12,7 @@ #include <wayland-server-core.h> #include <wlr/types/wlr_seat.h> #include <wlr/types/wlr_surface.h> +#include <wlr/util/box.h> enum wlr_text_input_v3_features { WLR_TEXT_INPUT_V3_FEATURE_SURROUNDING_TEXT = 1 << 0, @@ -33,12 +34,7 @@ struct wlr_text_input_v3_state { uint32_t purpose; } content_type; - struct { - int32_t x; - int32_t y; - int32_t width; - int32_t height; - } cursor_rectangle; + struct wlr_box cursor_rectangle; // Tracks which features were used in the current commit. // Useful in the enabling commit, where usage means support. |