[gtk/gtk-3-24: 1/5] window: Add private API to fixate size
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/gtk-3-24: 1/5] window: Add private API to fixate size
- Date: Thu, 7 Feb 2019 21:29:43 +0000 (UTC)
commit edb57a9202907ff6f54390bdc7ae02e42de87cfe
Author: Jonas Ã…dahl <jadahl gmail com>
Date: Wed Feb 6 19:29:16 2019 +0100
window: Add private API to fixate size
This causes window size guessing to always use the remembered size (the
size of the GdkWindow). This will be useful for menus which size is
managed by gdk_window_move_to_rect(), to avoid overriding the size
calculated by the move-to-rect implementation.
gtk/gtkwindow.c | 22 ++++++++++++++++++++++
gtk/gtkwindowprivate.h | 1 +
2 files changed, 23 insertions(+)
---
diff --git a/gtk/gtkwindow.c b/gtk/gtkwindow.c
index 699a70286c..92d6793995 100644
--- a/gtk/gtkwindow.c
+++ b/gtk/gtkwindow.c
@@ -265,6 +265,7 @@ struct _GtkWindowPrivate
guint unlimited_guessed_size_x : 1;
guint unlimited_guessed_size_y : 1;
guint force_resize : 1;
+ guint fixate_size : 1;
guint use_subsurface : 1;
@@ -551,6 +552,10 @@ static void gtk_window_style_updated (GtkWidget *widget);
static void gtk_window_state_flags_changed (GtkWidget *widget,
GtkStateFlags previous_state);
+static void gtk_window_get_remembered_size (GtkWindow *window,
+ int *width,
+ int *height);
+
static GSList *toplevel_list = NULL;
static guint window_signals[LAST_SIGNAL] = { 0 };
static GList *default_icon_list = NULL;
@@ -6436,6 +6441,8 @@ gtk_window_unmap (GtkWidget *widget)
*/
priv->need_default_position = TRUE;
+ priv->fixate_size = FALSE;
+
info = gtk_window_get_geometry_info (window, FALSE);
if (info)
{
@@ -6477,6 +6484,14 @@ gtk_window_force_resize (GtkWindow *window)
priv->force_resize = TRUE;
}
+void
+gtk_window_fixate_size (GtkWindow *window)
+{
+ GtkWindowPrivate *priv = window->priv;
+
+ priv->fixate_size = TRUE;
+}
+
/* (Note: Replace "size" with "width" or "height". Also, the request
* mode is honoured.)
* For selecting the default window size, the following conditions
@@ -6508,6 +6523,13 @@ gtk_window_guess_default_size (GtkWindow *window,
display = gtk_widget_get_display (widget);
gdkwindow = _gtk_widget_get_window (widget);
+ if (window->priv->fixate_size)
+ {
+ g_assert (gdkwindow);
+ gtk_window_get_remembered_size (window, width, height);
+ return;
+ }
+
if (gdkwindow)
monitor = gdk_display_get_monitor_at_window (display, gdkwindow);
else
diff --git a/gtk/gtkwindowprivate.h b/gtk/gtkwindowprivate.h
index 9c12233c95..0c849d67b2 100644
--- a/gtk/gtkwindowprivate.h
+++ b/gtk/gtkwindowprivate.h
@@ -139,6 +139,7 @@ void gtk_window_set_unlimited_guessed_size (GtkWindow *window,
gboolean x,
gboolean y);
void gtk_window_force_resize (GtkWindow *window);
+void gtk_window_fixate_size (GtkWindow *window);
/* Exported handles */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]