[gtk+] window: Don't use set_allocation() to store cached values



commit 97ba4b1b8eb82563f13762a4bd8cfe9beb8a121c
Author: Benjamin Otte <otte redhat com>
Date:   Mon Jan 14 17:59:31 2013 +0100

    window: Don't use set_allocation() to store cached values
    
    The window size can be queried on widget->window directly, no need to
    store it in widget->allocation.
    This change is necessary because gtk_widget_set_allcation() is now
    checking invariants that assume it's called from insize
    gtk_widget_size_allocate() and that wasn;t the case here.

 gtk/gtkwindow.c |    9 +++------
 1 files changed, 3 insertions(+), 6 deletions(-)
---
diff --git a/gtk/gtkwindow.c b/gtk/gtkwindow.c
index db6eb7a..e0c21a9 100644
--- a/gtk/gtkwindow.c
+++ b/gtk/gtkwindow.c
@@ -5666,7 +5666,6 @@ gtk_window_configure_event (GtkWidget         *widget,
 
   /*
    * If we do need to resize, we do that by:
-   *   - filling in widget->allocation with the new size
    *   - setting configure_notify_received to TRUE
    *     for use in gtk_window_move_resize()
    *   - queueing a resize, leading to invocation of
@@ -5676,10 +5675,6 @@ gtk_window_configure_event (GtkWidget         *widget,
   
   priv->configure_notify_received = TRUE;
 
-  allocation.width = event->width;
-  allocation.height = event->height;
-  gtk_widget_set_allocation (widget, &allocation);
-
   gdk_window_invalidate_rect (gtk_widget_get_window (widget), NULL, FALSE); // XXX - What was this for again?
 
   _gtk_container_queue_resize (GTK_CONTAINER (widget));
@@ -7176,7 +7171,9 @@ gtk_window_move_resize (GtkWindow *window)
 				   &new_geometry,
 				   new_flags);
 
-  gtk_widget_get_allocation (widget, &allocation);
+  gdk_window_get_position (gdk_window, &allocation.x, &allocation.y);
+  allocation.width = gdk_window_get_width (gdk_window);
+  allocation.height = gdk_window_get_height (gdk_window);
 
   /* handle resizing/moving and widget tree allocation
    */



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