[mutter/wayland] display: include wayland clients in the tab list



commit 514fec7275fe7e6d9d35eeb6d076ff15ceea5d0e
Author: Giovanni Campagna <gcampagn redhat com>
Date:   Mon Sep 16 11:24:01 2013 +0200

    display: include wayland clients in the tab list
    
    Make sure that meta_display_list_windows() returns wayland windows
    too, by keeping a separate hash for wayland clients.
    This fixes a crash in the alt-tab code of gnome-shell.
    
    Reviewed by drago01 in IRC.

 src/core/display-private.h |    6 ++++++
 src/core/display.c         |   28 ++++++++++++++++++++++++++++
 src/core/window.c          |    4 ++++
 3 files changed, 38 insertions(+), 0 deletions(-)
---
diff --git a/src/core/display-private.h b/src/core/display-private.h
index e9d590d..53f8a6f 100644
--- a/src/core/display-private.h
+++ b/src/core/display-private.h
@@ -154,6 +154,7 @@ struct _MetaDisplay
   GSList *screens;
   MetaScreen *active_screen;
   GHashTable *xids;
+  GHashTable *wayland_windows;
   int error_traps;
   int (* error_trap_handler) (Display     *display,
                               XErrorEvent *error);  
@@ -380,6 +381,11 @@ void        meta_display_register_x_window   (MetaDisplay *display,
 void        meta_display_unregister_x_window (MetaDisplay *display,
                                               Window       xwindow);
 
+void        meta_display_register_wayland_window   (MetaDisplay *display,
+                                                    MetaWindow  *window);
+void        meta_display_unregister_wayland_window (MetaDisplay *display,
+                                                    MetaWindow  *window);
+
 #ifdef HAVE_XSYNC
 MetaWindow* meta_display_lookup_sync_alarm     (MetaDisplay *display,
                                                 XSyncAlarm   alarm);
diff --git a/src/core/display.c b/src/core/display.c
index 4a91522..6f47023 100644
--- a/src/core/display.c
+++ b/src/core/display.c
@@ -607,6 +607,7 @@ meta_display_open (void)
   
   the_display->xids = g_hash_table_new (meta_unsigned_long_hash,
                                         meta_unsigned_long_equal);
+  the_display->wayland_windows = g_hash_table_new (NULL, NULL);
 
   i = 0;
   while (i < N_IGNORED_CROSSING_SERIALS)
@@ -1048,6 +1049,19 @@ meta_display_list_windows (MetaDisplay          *display,
         winlist = g_slist_prepend (winlist, window);
     }
 
+  g_hash_table_iter_init (&iter, display->wayland_windows);
+  while (g_hash_table_iter_next (&iter, &key, &value))
+    {
+      MetaWindow *window = value;
+
+      if (!META_IS_WINDOW (window))
+        continue;
+
+      if (!window->override_redirect ||
+          (flags & META_LIST_INCLUDE_OVERRIDE_REDIRECT) != 0)
+        winlist = g_slist_prepend (winlist, window);
+    }
+
   /* Uniquify the list, since both frame windows and plain
    * windows are in the hash
    */
@@ -3864,6 +3878,20 @@ meta_display_unregister_x_window (MetaDisplay *display,
   remove_pending_pings_for_window (display, xwindow);
 }
 
+void
+meta_display_register_wayland_window (MetaDisplay *display,
+                                      MetaWindow  *window)
+{
+  g_hash_table_add (display->wayland_windows, window);
+}
+
+void
+meta_display_unregister_wayland_window (MetaDisplay *display,
+                                        MetaWindow  *window)
+{
+  g_hash_table_remove (display->wayland_windows, window);
+}
+
 #ifdef HAVE_XSYNC
 /* We store sync alarms in the window ID hash table, because they are
  * just more types of XIDs in the same global space, but we have
diff --git a/src/core/window.c b/src/core/window.c
index 818d683..fd76925 100644
--- a/src/core/window.c
+++ b/src/core/window.c
@@ -1060,6 +1060,8 @@ meta_window_new_shared (MetaDisplay         *display,
       meta_window_update_shape_region_x11 (window);
       meta_window_update_input_region_x11 (window);
     }
+  else
+    meta_display_register_wayland_window (display, window);
 
   /* assign the window to its group, or create a new group if needed
    */
@@ -2050,6 +2052,8 @@ meta_window_unmanage (MetaWindow  *window,
 
       meta_error_trap_pop (window->display);
     }
+  else
+    meta_display_unregister_wayland_window (window->display, window);
 
   if (window->surface)
     meta_wayland_surface_free (window->surface);


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