]> Pileus Git - ~andy/gtk/commitdiff
Update last_window only when needed
authorXan Lopez <xan@gnome.org>
Wed, 30 Sep 2009 03:45:03 +0000 (23:45 -0400)
committerMatthias Clasen <mclasen@redhat.com>
Wed, 30 Sep 2009 03:45:03 +0000 (23:45 -0400)
_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

index c816d0e7f9259a2c729f305fbb89793ab49f4f48..66b29f1b7761080e44fd0f71a2980f9baad34bda 100644 (file)
@@ -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);