From 84a8f1b42dbd1882bef295cff66cd0c24afeb978 Mon Sep 17 00:00:00 2001 From: Tony Crisci Date: Sat, 23 Sep 2017 14:40:56 -0400 Subject: [PATCH] add keys array param to seat keyboard enter --- examples/compositor.c | 5 ++++- include/wlr/types/wlr_seat.h | 4 ++-- types/wlr_seat.c | 9 ++++----- 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/examples/compositor.c b/examples/compositor.c index e09fdc14..8154c2e3 100644 --- a/examples/compositor.c +++ b/examples/compositor.c @@ -129,7 +129,10 @@ static void example_set_focused_surface(struct sample_state *sample, } if (surface) { - wlr_seat_keyboard_enter(sample->wl_seat, surface->surface); + // TODO: send array of currently pressed keys + struct wl_array keys; + wl_array_init(&keys); + wlr_seat_keyboard_enter(sample->wl_seat, surface->surface, keys); } else { wlr_seat_keyboard_clear_focus(sample->wl_seat); } diff --git a/include/wlr/types/wlr_seat.h b/include/wlr/types/wlr_seat.h index c6bab180..a8df7131 100644 --- a/include/wlr/types/wlr_seat.h +++ b/include/wlr/types/wlr_seat.h @@ -128,10 +128,10 @@ void wlr_seat_pointer_send_axis(struct wlr_seat *wlr_seat, uint32_t time, /** * Send a keyboard enter event to the given surface and consider it to be the * focused surface for the keyboard. This will send a leave event to the last - * surface that was entered. + * surface that was entered. Pass an array of currently pressed keys. */ void wlr_seat_keyboard_enter(struct wlr_seat *wlr_seat, - struct wlr_surface *surface); + struct wlr_surface *surface, struct wl_array keys); /** * Clear the focused surface for the keyboard and leave all entered surfaces. diff --git a/types/wlr_seat.c b/types/wlr_seat.c index fc3b1c76..1d544902 100644 --- a/types/wlr_seat.c +++ b/types/wlr_seat.c @@ -414,7 +414,7 @@ static void handle_keyboard_focus_resource_destroyed( } void wlr_seat_keyboard_enter(struct wlr_seat *wlr_seat, - struct wlr_surface *surface) { + struct wlr_surface *surface, struct wl_array keys) { if (wlr_seat->keyboard_state.focused_surface == surface) { // this surface already got an enter notify return; @@ -442,9 +442,6 @@ void wlr_seat_keyboard_enter(struct wlr_seat *wlr_seat, // enter the current surface if (handle && handle->keyboard) { uint32_t serial = wl_display_next_serial(wlr_seat->display); - // TODO: send currently pressed keys - struct wl_array keys; - wl_array_init(&keys); wl_keyboard_send_enter(handle->keyboard, serial, surface->resource, &keys); @@ -475,7 +472,9 @@ void wlr_seat_keyboard_enter(struct wlr_seat *wlr_seat, } void wlr_seat_keyboard_clear_focus(struct wlr_seat *wlr_seat) { - wlr_seat_keyboard_enter(wlr_seat, NULL); + struct wl_array keys; + wl_array_init(&keys); + wlr_seat_keyboard_enter(wlr_seat, NULL, keys); } static bool wlr_seat_keyboard_has_focus_resource(struct wlr_seat *wlr_seat) {