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.
This commit is contained in:
parent
5b360f2198
commit
edb57a9202
@ -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
|
||||
|
@ -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 */
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user