summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarlos Garnacho <carlosg@gnome.org>2019-04-18 12:28:24 +0200
committerGeorges Basile Stavracas Neto <georges.stavracas@gmail.com>2019-05-29 16:21:15 +0000
commitbbfaf8204bb888f65d991d7364bc312039ec8241 (patch)
tree201c08c98621e25a61e4af795a0a82b7550e324b
parentb3e19ee669d440ef7e2d76c8c44119a81def943e (diff)
downloadmutter-bbfaf8204bb888f65d991d7364bc312039ec8241.tar.gz
wayland: Honor startup sequence workspace on .request_focus
We handle this in backend specific code for x11, so do the wayland bits here. We can only honor this on applications that request focus on a surface after a startup request, as we do need an explicit surface to apply the workspace on (and we don't have additional clues like WMCLASS on X11). Notably, gtk_shell1.notify_startup doesn't suffice. Another gotcha is that the .request_focus happens when the surface is already "mapped". Due to the way x11 and the GDK api currently work (first reply on the startup id, then map a window, then request focus on that window). This means the surface will ignore at this point window->initial_workspace, so it must be actively changed. https://gitlab.gnome.org/GNOME/mutter/merge_requests/544 Closes: https://gitlab.gnome.org/GNOME/gnome-shell/issues/674
-rw-r--r--src/wayland/meta-wayland-gtk-shell.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/wayland/meta-wayland-gtk-shell.c b/src/wayland/meta-wayland-gtk-shell.c
index c629e3a4d..cbbe9d5f9 100644
--- a/src/wayland/meta-wayland-gtk-shell.c
+++ b/src/wayland/meta-wayland-gtk-shell.c
@@ -172,13 +172,16 @@ gtk_surface_request_focus (struct wl_client *client,
if (sequence)
{
- uint32_t timestamp;
+ uint32_t timestamp, workspace_idx;
+ workspace_idx = meta_startup_sequence_get_workspace (sequence);
timestamp = meta_startup_sequence_get_timestamp (sequence);
meta_startup_sequence_complete (sequence);
meta_startup_notification_remove_sequence (display->startup_notification,
sequence);
+ if (workspace_idx >= 0)
+ meta_window_change_workspace_by_index (window, workspace_idx, TRUE);
meta_window_activate_full (window, timestamp,
META_CLIENT_TYPE_APPLICATION, NULL);