]> Pileus Git - ~andy/gtk/commitdiff
Fix grip window positioning
authorMatthias Clasen <mclasen@redhat.com>
Fri, 8 Oct 2010 18:21:11 +0000 (14:21 -0400)
committerMatthias Clasen <mclasen@redhat.com>
Fri, 8 Oct 2010 18:21:11 +0000 (14:21 -0400)
We need to position the grip window in size_allocate after all,
otherwise the grip ends up in the wrong place when the window
is realized early.

Also, avoid shadowing a variable.

gtk/gtkwindow.c

index 0d363a088a204a43afd0867e3b2a3d71400ea4fe..397e41bfac9abea5b4383e5a80f852e3c0ac7da9 100644 (file)
@@ -4730,7 +4730,11 @@ gtk_window_realize (GtkWidget *widget)
       allocation.height == 1)
     {
       GtkRequisition requisition;
-      GtkAllocation allocation = { 0, 0, 200, 200 };
+
+      allocation.x = 0;
+      allocation.y = 0;
+      allocation.width = 200;
+      allocation.height = 200;
 
       gtk_widget_get_preferred_size (widget, &requisition, NULL);
       if (requisition.width || requisition.height)
@@ -4784,7 +4788,7 @@ gtk_window_realize (GtkWidget *widget)
                               GDK_BUTTON_RELEASE_MASK);
       
       attributes_mask = GDK_WA_VISUAL;
-      
+
       priv->frame = gdk_window_new (gtk_widget_get_root_window (widget),
                                      &attributes, attributes_mask);
                                                 
@@ -5061,11 +5065,13 @@ gtk_window_size_allocate (GtkWidget     *widget,
       gtk_widget_size_allocate (child, &child_allocation);
     }
 
-  if (gtk_widget_get_realized (widget) && priv->frame)
+  if (gtk_widget_get_realized (widget))
     {
-      gdk_window_resize (priv->frame,
-                        allocation->width + priv->frame_left + priv->frame_right,
-                        allocation->height + priv->frame_top + priv->frame_bottom);
+      if (priv->frame)
+        gdk_window_resize (priv->frame,
+                           allocation->width + priv->frame_left + priv->frame_right,
+                           allocation->height + priv->frame_top + priv->frame_bottom);
+      set_grip_position (window);
     }
 }
 
@@ -6720,12 +6726,9 @@ gtk_window_move_resize (GtkWindow *window)
       /* gtk_window_configure_event() filled in widget->allocation */
       gtk_widget_size_allocate (widget, &allocation);
 
-      if (priv->grip_window != NULL)
-        {
-          set_grip_position (window);
-          set_grip_cursor (window);
-          set_grip_shape (window);
-        }
+      set_grip_position (window);
+      set_grip_cursor (window);
+      set_grip_shape (window);
 
       gdk_window_process_updates (gdk_window, TRUE);