[mutter/wip/wayland-clutter-events-2: 33/34] display: Use MetaWindow for auto-raise callbacks



commit 4a858076108e3cc1fadac71e30658269bc52b9c3
Author: Jasper St. Pierre <jstpierre mecheye net>
Date:   Wed Oct 16 00:19:33 2013 -0400

    display: Use MetaWindow for auto-raise callbacks
    
    This allows us to autoraise Wayland windows... well, except for the
    XQueryPointer, but we'll replace that soon.

 src/core/display.c |   34 ++++------------------------------
 src/core/window.c  |    2 ++
 2 files changed, 6 insertions(+), 30 deletions(-)
---
diff --git a/src/core/display.c b/src/core/display.c
index 880c75c..a14eb11 100644
--- a/src/core/display.c
+++ b/src/core/display.c
@@ -117,12 +117,6 @@ typedef struct
   guint        ping_timeout_id;
 } MetaPingData;
 
-typedef struct 
-{
-  MetaDisplay *display;
-  Window xwindow;
-} MetaAutoRaiseData;
-
 typedef struct
 {
   MetaDisplay *display;
@@ -1620,23 +1614,10 @@ reset_ignored_crossing_serials (MetaDisplay *display)
 static gboolean 
 window_raise_with_delay_callback (void *data)
 {
-  MetaWindow *window;
-  MetaAutoRaiseData *auto_raise;
-
-  auto_raise = data;
-
-  meta_topic (META_DEBUG_FOCUS, 
-             "In autoraise callback for window 0x%lx\n", 
-             auto_raise->xwindow);
-
-  auto_raise->display->autoraise_timeout_id = 0;
-  auto_raise->display->autoraise_window = NULL;
+  MetaWindow *window = data;
 
-  window  = meta_display_lookup_x_window (auto_raise->display, 
-                                         auto_raise->xwindow);
-  
-  if (window == NULL) 
-    return FALSE;
+  window->display->autoraise_timeout_id = 0;
+  window->display->autoraise_window = NULL;
 
   /* If we aren't already on top, check whether the pointer is inside
    * the window and raise the window if so.
@@ -1778,17 +1759,11 @@ void
 meta_display_queue_autoraise_callback (MetaDisplay *display,
                                        MetaWindow  *window)
 {
-  MetaAutoRaiseData *auto_raise_data;
-
   meta_topic (META_DEBUG_FOCUS, 
               "Queuing an autoraise timeout for %s with delay %d\n", 
               window->desc, 
               meta_prefs_get_auto_raise_delay ());
   
-  auto_raise_data = g_new (MetaAutoRaiseData, 1);
-  auto_raise_data->display = window->display;
-  auto_raise_data->xwindow = window->xwindow;
-  
   if (display->autoraise_timeout_id != 0)
     g_source_remove (display->autoraise_timeout_id);
 
@@ -1796,8 +1771,7 @@ meta_display_queue_autoraise_callback (MetaDisplay *display,
     g_timeout_add_full (G_PRIORITY_DEFAULT,
                         meta_prefs_get_auto_raise_delay (),
                         window_raise_with_delay_callback,
-                        auto_raise_data,
-                        g_free);
+                        window, NULL);
   display->autoraise_window = window;
 }
 
diff --git a/src/core/window.c b/src/core/window.c
index 512fc74..001cb2e 100644
--- a/src/core/window.c
+++ b/src/core/window.c
@@ -2002,6 +2002,8 @@ meta_window_unmanage (MetaWindow  *window,
   meta_window_ungrab_keys (window);
   meta_display_ungrab_window_buttons (window->display, window->xwindow);
   meta_display_ungrab_focus_window_button (window->display, window);
+  if (window->display->autoraise_window == window)
+    meta_display_remove_autoraise_callback (window->display);
 
   if (window->client_type == META_WINDOW_CLIENT_TYPE_X11)
     {


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