[gtk+] gtkwindow: Use default size even if not resizable
- From: Olivier Fourdan <ofourdan src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] gtkwindow: Use default size even if not resizable
- Date: Thu, 3 Mar 2016 13:47:14 +0000 (UTC)
commit 0f9547258106c33b9ebf6e13b6b43df013f537ac
Author: Olivier Fourdan <ofourdan redhat com>
Date: Wed Mar 2 11:10:29 2016 +0100
gtkwindow: Use default size even if not resizable
If a window is not resizable (with gtk_window_set_resizable ()),
the size given with gtk_window_set_default_size() is ignored.
The solution to this would be to use gtk_widget_set_size_request() but
that's a GtkWidget API and therefore does not take into account the
client side decorations when in use with GtkWindow.
Refactor the code so that gtk_window_set_default_size() (which is a
GtkWindow API) gives the expected result on non-resizable windows as
well.
bugzilla: https://bugzilla.gnome.org/show_bug.cgi?id=762974
gtk/gtkwindow.c | 15 ++++++++-------
1 files changed, 8 insertions(+), 7 deletions(-)
---
diff --git a/gtk/gtkwindow.c b/gtk/gtkwindow.c
index 920f607..008f630 100644
--- a/gtk/gtkwindow.c
+++ b/gtk/gtkwindow.c
@@ -9133,6 +9133,14 @@ gtk_window_compute_configure_request (GtkWindow *window,
gtk_window_compute_configure_request_size (window,
&new_geometry, new_flags,
&w, &h);
+ /* If not resizeable, set min/max to what we have */
+ if (!priv->resizable)
+ {
+ new_flags |= GDK_HINT_MAX_SIZE;
+
+ new_geometry.max_width = new_geometry.min_width = w;
+ new_geometry.max_height = new_geometry.min_height = h;
+ }
gtk_window_constrain_size (window,
&new_geometry, new_flags,
@@ -9862,13 +9870,6 @@ gtk_window_compute_hints (GtkWindow *window,
new_geometry->max_height = MAX (new_geometry->max_height, new_geometry->min_height);
}
- else if (!priv->resizable)
- {
- *new_flags |= GDK_HINT_MAX_SIZE;
-
- new_geometry->max_width = new_geometry->min_width;
- new_geometry->max_height = new_geometry->min_height;
- }
*new_flags |= GDK_HINT_WIN_GRAVITY;
new_geometry->win_gravity = priv->gravity;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]