From d11732c0fd2b3175a4cbf623e047223beff92286 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sergio=20G=C3=B3mez?= Date: Wed, 29 Mar 2023 10:30:23 -0500 Subject: [PATCH] libweston/input: Move activation signal logic out of keyboard focus function MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Currently, and for legacy reasons, weston_seat_set_keyboard_focus() contains logic related to surface activation. Since this function is always called from weston_view_activate_input(), move that code there where it seems more appropriate. This will help us in subsequent commits by avoiding to have to change the signature of weston_seat_set_keyboard_focus(), which would make that function even more awkward than it currently is. Signed-off-by: Sergio Gómez --- libweston/input.c | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/libweston/input.c b/libweston/input.c index 4e442005..0b0c2bf7 100644 --- a/libweston/input.c +++ b/libweston/input.c @@ -2342,6 +2342,7 @@ weston_view_activate_input(struct weston_view *view, uint32_t flags) { struct weston_compositor *compositor = seat->compositor; + struct weston_surface_activation_data activation_data; if (flags & WESTON_ACTIVATE_FLAG_CLICKED) { view->click_to_activate_serial = @@ -2349,6 +2350,14 @@ weston_view_activate_input(struct weston_view *view, } weston_seat_set_keyboard_focus(seat, view->surface); + + inc_activate_serial(compositor); + + activation_data = (struct weston_surface_activation_data) { + .surface = view->surface, + .seat = seat, + }; + wl_signal_emit(&compositor->activate_signal, &activation_data); } WL_EXPORT void @@ -4609,22 +4618,12 @@ WL_EXPORT void weston_seat_set_keyboard_focus(struct weston_seat *seat, struct weston_surface *surface) { - struct weston_compositor *compositor = seat->compositor; struct weston_keyboard *keyboard = weston_seat_get_keyboard(seat); - struct weston_surface_activation_data activation_data; if (keyboard && keyboard->focus != surface) { weston_keyboard_set_focus(keyboard, surface); wl_data_device_set_keyboard_focus(seat); } - - inc_activate_serial(compositor); - - activation_data = (struct weston_surface_activation_data) { - .surface = surface, - .seat = seat, - }; - wl_signal_emit(&compositor->activate_signal, &activation_data); } static void