diff options
author | Joan Bruguera <joanbrugueram@gmail.com> | 2022-12-04 22:54:51 +0000 |
---|---|---|
committer | Joan Bruguera <joanbrugueram@gmail.com> | 2022-12-04 23:33:34 +0000 |
commit | 43c1a433aa0839826451f71029965d8e359a9178 (patch) | |
tree | b2c9e5138ce432be59357bae9857e43fc0157bae /gdk/wayland | |
parent | a9c9678e1f617755368f16424a03ae1f2d2ced4e (diff) | |
download | gtk+-43c1a433aa0839826451f71029965d8e359a9178.tar.gz |
gdk/wayland: set requesting surface to xdg-activation
The argument to xdg_activation_token_v1_set_surface is documented to be the
surface requesting the activation, not the surface to be activated, which is
given later when calling xdg_activation_v1_activate.
(c.f. https://gitlab.freedesktop.org/wayland/wayland-protocols/-/commit/36cee4bdbcaf3a75f567315809953b5e21d703da)
Use the same logic as in gdk_wayland_app_launch_context_get_startup_notify_id,
i.e. if we have a surface with focus, set that, otherwise set NULL.
This fixes requesting urgent/focus on wlroots (compositors like Sway, etc.),
which was blocked as the surface requesting the activation didn't have focus.
Signed-off-by: Joan Bruguera <joanbrugueram@gmail.com>
Diffstat (limited to 'gdk/wayland')
-rw-r--r-- | gdk/wayland/gdksurface-wayland.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/gdk/wayland/gdksurface-wayland.c b/gdk/wayland/gdksurface-wayland.c index 0e0a651ead..ec1c001cdc 100644 --- a/gdk/wayland/gdksurface-wayland.c +++ b/gdk/wayland/gdksurface-wayland.c @@ -3583,6 +3583,8 @@ gdk_wayland_toplevel_focus (GdkToplevel *toplevel, { struct xdg_activation_token_v1 *token; struct wl_event_queue *event_queue; + struct wl_surface *wl_surface = NULL; + GdkSurface *focus_surface; event_queue = wl_display_create_queue (display_wayland->wl_display); @@ -3595,8 +3597,13 @@ gdk_wayland_toplevel_focus (GdkToplevel *toplevel, xdg_activation_token_v1_set_serial (token, _gdk_wayland_seat_get_last_implicit_grab_serial (seat, NULL), gdk_wayland_seat_get_wl_seat (GDK_SEAT (seat))); - xdg_activation_token_v1_set_surface (token, - gdk_wayland_surface_get_wl_surface (surface)); + + focus_surface = gdk_wayland_device_get_focus (gdk_seat_get_keyboard (GDK_SEAT (seat))); + if (focus_surface) + wl_surface = gdk_wayland_surface_get_wl_surface (focus_surface); + if (wl_surface) + xdg_activation_token_v1_set_surface (token, wl_surface); + xdg_activation_token_v1_commit (token); while (startup_id == NULL) |