Implement input_method_v2 popups

This commit is contained in:
Tadeo Kondrak 2020-12-15 21:23:56 -07:00 committed by Simon Ser
parent e0daa65aa6
commit 30d3c76817
3 changed files with 172 additions and 8 deletions

View file

@ -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);

View file

@ -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.