[gtk+] gtkoverlay: Optimize size allocations



commit 93171cf4f346c0a5e71f274d012c3cacfe3880ba
Author: Jasper St. Pierre <jstpierre mecheye net>
Date:   Fri Jul 31 20:21:20 2015 -0700

    gtkoverlay: Optimize size allocations
    
    Doing raises / lowers here will invalidate the entire child widget
    almost every time, since raising each widget causes it to invalidate
    that area.

 gtk/gtkoverlay.c |   15 +++++++++++----
 1 files changed, 11 insertions(+), 4 deletions(-)
---
diff --git a/gtk/gtkoverlay.c b/gtk/gtkoverlay.c
index 0c4a6dc..48278e5 100644
--- a/gtk/gtkoverlay.c
+++ b/gtk/gtkoverlay.c
@@ -302,11 +302,8 @@ gtk_overlay_child_allocate (GtkOverlay      *overlay,
 
   if (gtk_widget_get_mapped (GTK_WIDGET (overlay)))
     {
-      /* Note: This calls show every size allocation, which makes
-       * us keep the z-order of the chilren, as gdk_window_show()
-       * does an implicit raise. */
       if (gtk_widget_get_visible (child->widget))
-        gdk_window_show (child->window);
+        gdk_window_show_unraised (child->window);
       else if (gdk_window_is_visible (child->window))
         gdk_window_hide (child->window);
     }
@@ -590,6 +587,16 @@ gtk_overlay_reorder_overlay (GtkOverlay *overlay,
   if (index == old_index)
     return;
 
+  if (new_link)
+    {
+      GtkOverlayChild *new_child_info = new_link->data;
+      gdk_window_restack (child_info->window, new_child_info->window, TRUE);
+    }
+  else
+    {
+      gdk_window_raise (child_info->window);
+    }
+
   priv->children = g_slist_delete_link (priv->children, old_link);
   priv->children = g_slist_insert_before (priv->children, new_link, child_info);
 



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