[mutter/wip/carlosg/launch-on-workspace] wayland: Honor startup sequence workspace on .request_focus



commit a3ac8ced5e85fac35301eabfb3669a59c4e172ec
Author: Carlos Garnacho <carlosg gnome org>
Date:   Thu Apr 18 12:28:24 2019 +0200

    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

 src/wayland/meta-wayland-gtk-shell.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
---
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);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]