[gtk+] Update last_window only when needed



commit f0f39c34f807dcd4775415f1b7604b9debc16c60
Author: Xan Lopez <xan gnome org>
Date:   Tue Sep 29 23:45:03 2009 -0400

    Update last_window only when needed
    
    _gtk_tooltip_handle_event, which is called for many events in the GTK+
    main loop, calls gtk_tooltip_set_last_window, which keeps a weak
    reference to the last window we passed through. If the window being
    set is the same than the last one there's really no need to update our
    weak reference, so add a check for that and exit early.

 gtk/gtktooltip.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)
---
diff --git a/gtk/gtktooltip.c b/gtk/gtktooltip.c
index c816d0e..66b29f1 100644
--- a/gtk/gtktooltip.c
+++ b/gtk/gtktooltip.c
@@ -768,6 +768,9 @@ static void
 gtk_tooltip_set_last_window (GtkTooltip *tooltip,
 			     GdkWindow  *window)
 {
+  if (tooltip->last_window == window)
+    return;
+
   if (tooltip->last_window)
     g_object_remove_weak_pointer (G_OBJECT (tooltip->last_window),
 				  (gpointer *) &tooltip->last_window);



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