[gtk+/wip/frame-window: 4/6] csd: Fix gtk_window_get_remembered_size to never grow
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/wip/frame-window: 4/6] csd: Fix gtk_window_get_remembered_size to never grow
- Date: Sun, 7 Jul 2013 03:14:18 +0000 (UTC)
commit 1757c138382126ec4a826307746c9b0c42b683ee
Author: Matthias Clasen <mclasen redhat com>
Date: Sat Jul 6 21:50:48 2013 -0400
csd: Fix gtk_window_get_remembered_size to never grow
gtk_window_get_remembered_size returns a size for the content
area, to which we then add the frame size to get the new size
for the frame window. To avoid accidentally growing the window,
return a remembered size that comes from subtracting the frame
size from the frame_window size.
gtk/gtkwindow.c | 27 ++++++++++++++++++++++-----
1 files changed, 22 insertions(+), 5 deletions(-)
---
diff --git a/gtk/gtkwindow.c b/gtk/gtkwindow.c
index 020d353..f01f41f 100644
--- a/gtk/gtkwindow.c
+++ b/gtk/gtkwindow.c
@@ -5654,6 +5654,10 @@ gtk_window_guess_default_size (GtkWindow *window,
}
static void
+subtract_frame_size_from_allocation (GtkWindow *window,
+ GdkRectangle *rect);
+
+static void
gtk_window_get_remembered_size (GtkWindow *window,
int *width,
int *height)
@@ -5664,12 +5668,25 @@ gtk_window_get_remembered_size (GtkWindow *window,
*width = 0;
*height = 0;
- gdk_window = gtk_widget_get_window (GTK_WIDGET (window));
- if (gdk_window)
+ if (window->priv->frame_window)
{
- *width = gdk_window_get_width (gdk_window);
- *height = gdk_window_get_height (gdk_window);
- return;
+ GdkRectangle rect;
+ rect.x = rect.y = 0;
+ rect.width = gdk_window_get_width (window->priv->frame_window);
+ rect.height = gdk_window_get_height (window->priv->frame_window);
+ subtract_frame_size_from_allocation (window, &rect);
+ *width = rect.width;
+ *height = rect.height;
+ }
+ else
+ {
+ gdk_window = gtk_widget_get_window (GTK_WIDGET (window));
+ if (gdk_window)
+ {
+ *width = gdk_window_get_width (gdk_window);
+ *height = gdk_window_get_height (gdk_window);
+ return;
+ }
}
info = gtk_window_get_geometry_info (window, FALSE);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]