[gtk+] Fix grip window positioning
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] Fix grip window positioning
- Date: Fri, 8 Oct 2010 18:23:23 +0000 (UTC)
commit 31a45c957c5d398b4dfe970825198d8fd15fd618
Author: Matthias Clasen <mclasen redhat com>
Date: Fri Oct 8 14:21:11 2010 -0400
Fix grip window positioning
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 | 27 +++++++++++++++------------
1 files changed, 15 insertions(+), 12 deletions(-)
---
diff --git a/gtk/gtkwindow.c b/gtk/gtkwindow.c
index 0d363a0..397e41b 100644
--- a/gtk/gtkwindow.c
+++ b/gtk/gtkwindow.c
@@ -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);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]