[gnome-shell] Move focus change handling out of a meta_later



commit 1a25cd98ead9e6d169e6d43df9a90206777741a6
Author: Colin Walters <walters verbum org>
Date:   Thu Feb 25 16:11:14 2010 -0500

    Move focus change handling out of a meta_later
    
    Ok, there admittedly wasn't a strong rationale for having it in a
    later, and by performing this immediately we reduce race conditions
    for our focus_app versus startup_notification handling.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=612833

 src/shell-window-tracker.c |   27 +++++----------------------
 1 files changed, 5 insertions(+), 22 deletions(-)
---
diff --git a/src/shell-window-tracker.c b/src/shell-window-tracker.c
index 2dd36b9..1c9ee6c 100644
--- a/src/shell-window-tracker.c
+++ b/src/shell-window-tracker.c
@@ -724,25 +724,22 @@ shell_window_tracker_get_running_apps (ShellWindowTracker *monitor,
   return ret;
 }
 
-static gboolean
-idle_handle_focus_change (gpointer data)
+static void
+on_focus_window_changed (MetaDisplay        *display,
+                         GParamSpec         *spec,
+                         ShellWindowTracker *tracker)
 {
   MetaScreen *screen;
-  MetaDisplay *display;
-  ShellWindowTracker *tracker = data;
   MetaWindow *new_focus_win;
   ShellApp *new_focus_app;
 
-  tracker->idle_focus_change_id = 0;
-
   screen = shell_global_get_screen (shell_global_get ());
-  display = meta_screen_get_display (screen);
 
   new_focus_win = meta_display_get_focus_window (display);
   new_focus_app = new_focus_win ? g_hash_table_lookup (tracker->window_to_app, new_focus_win) : NULL;
 
   if (new_focus_app == tracker->focus_app)
-    return FALSE;
+    return;
 
   if (tracker->focus_app != NULL)
     g_object_unref (tracker->focus_app);
@@ -754,22 +751,8 @@ idle_handle_focus_change (gpointer data)
     tracker->focus_app = g_object_ref (new_focus_app);
 
   g_object_notify (G_OBJECT (tracker), "focus-app");
-
-  return FALSE;
 }
 
-static void
-on_focus_window_changed (MetaDisplay     *display,
-                         GParamSpec      *spec,
-                         ShellWindowTracker *self)
-{
-  if (self->idle_focus_change_id != 0)
-    return;
-
-  self->idle_focus_change_id = meta_later_add (META_LATER_BEFORE_REDRAW, idle_handle_focus_change, self, NULL);
-}
-
-
 /**
  * shell_window_tracker_get_startup_sequences:
  * @self:



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