From 1a25cd98ead9e6d169e6d43df9a90206777741a6 Mon Sep 17 00:00:00 2001 From: Colin Walters Date: Thu, 25 Feb 2010 16:11:14 -0500 Subject: [PATCH] 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 file changed, 5 insertions(+), 22 deletions(-) diff --git a/src/shell-window-tracker.c b/src/shell-window-tracker.c index 2dd36b9c3..1c9ee6c89 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: