]> Pileus Git - ~andy/gtk/commitdiff
Fix performance issue with find_native_sibling_above
authorAlexander Larsson <alexl@redhat.com>
Tue, 20 Jan 2009 22:58:22 +0000 (23:58 +0100)
committerAlexander Larsson <alex@localhost.localdomain>
Thu, 2 Apr 2009 08:15:20 +0000 (10:15 +0200)
It keep recursing a lot, unnecessary

gdk/gdkwindow.c

index 8da989c77de8d67c633930326fec4fa971b1af83..fedf32afc27e8c9fd7db21286a6496facd5b7e9e 100644 (file)
@@ -693,8 +693,8 @@ _gdk_window_update_size (GdkWindow *window)
  * If child is NULL, find lowest native window in parent.
  */
 static GdkWindowObject *
-find_native_sibling_above (GdkWindowObject *parent,
-                          GdkWindowObject *child)
+find_native_sibling_above_helper (GdkWindowObject *parent,
+                                 GdkWindowObject *child)
 {
   GdkWindowObject *w;
   GList *l;
@@ -714,12 +714,27 @@ find_native_sibling_above (GdkWindowObject *parent,
        
       if (gdk_window_has_impl (w))
        return w;
-      
-      w = find_native_sibling_above (w, NULL);
+
+      g_assert (parent != w);
+      w = find_native_sibling_above_helper (w, NULL);
       if (w)
        return w;
     }
 
+  return NULL;
+}
+
+
+static GdkWindowObject *
+find_native_sibling_above (GdkWindowObject *parent,
+                          GdkWindowObject *child)
+{
+  GdkWindowObject *w;
+
+  w = find_native_sibling_above_helper (parent, child);
+  if (w)
+    return w;
+
   if (gdk_window_has_impl (parent))
     return NULL;
   else