menu: Force resize when remapping
A menu will be clamped to the work area as a side effect of the move_to_rect() logic if the resize anchor flags was set. For it to work a second time, the initial size needs to be the actual menu size before being clamped again. Achieve this by forcing a size recalculation before showing the menu.
This commit is contained in:
parent
00486efd51
commit
3e586a82e6
@ -1985,6 +1985,7 @@ gtk_menu_popup_internal (GtkMenu *menu,
|
||||
gtk_menu_shell_select_first (menu_shell, TRUE);
|
||||
|
||||
/* Once everything is set up correctly, map the toplevel */
|
||||
gtk_window_force_resize (GTK_WINDOW (priv->toplevel));
|
||||
gtk_widget_show (priv->toplevel);
|
||||
|
||||
if (xgrab_shell == widget)
|
||||
|
@ -264,6 +264,7 @@ struct _GtkWindowPrivate
|
||||
guint tiled : 1;
|
||||
guint unlimited_guessed_size_x : 1;
|
||||
guint unlimited_guessed_size_y : 1;
|
||||
guint force_resize : 1;
|
||||
|
||||
guint use_subsurface : 1;
|
||||
|
||||
@ -6468,6 +6469,14 @@ gtk_window_set_unlimited_guessed_size (GtkWindow *window,
|
||||
priv->unlimited_guessed_size_y = y;
|
||||
}
|
||||
|
||||
void
|
||||
gtk_window_force_resize (GtkWindow *window)
|
||||
{
|
||||
GtkWindowPrivate *priv = window->priv;
|
||||
|
||||
priv->force_resize = TRUE;
|
||||
}
|
||||
|
||||
/* (Note: Replace "size" with "width" or "height". Also, the request
|
||||
* mode is honoured.)
|
||||
* For selecting the default window size, the following conditions
|
||||
@ -9384,7 +9393,8 @@ gtk_window_compute_configure_request_size (GtkWindow *window,
|
||||
|
||||
info = gtk_window_get_geometry_info (window, FALSE);
|
||||
|
||||
if (priv->need_default_size)
|
||||
if (priv->need_default_size ||
|
||||
priv->force_resize)
|
||||
{
|
||||
gtk_window_guess_default_size (window, width, height);
|
||||
gtk_window_get_remembered_size (window, &w, &h);
|
||||
@ -9789,9 +9799,13 @@ gtk_window_move_resize (GtkWindow *window)
|
||||
info->last.configure_request.y != new_request.y)
|
||||
configure_request_pos_changed = TRUE;
|
||||
|
||||
if ((info->last.configure_request.width != new_request.width ||
|
||||
if (priv->force_resize ||
|
||||
(info->last.configure_request.width != new_request.width ||
|
||||
info->last.configure_request.height != new_request.height))
|
||||
configure_request_size_changed = TRUE;
|
||||
{
|
||||
priv->force_resize = FALSE;
|
||||
configure_request_size_changed = TRUE;
|
||||
}
|
||||
|
||||
hints_changed = FALSE;
|
||||
|
||||
|
@ -138,6 +138,7 @@ GdkScreen *_gtk_window_get_screen (GtkWindow *window);
|
||||
void gtk_window_set_unlimited_guessed_size (GtkWindow *window,
|
||||
gboolean x,
|
||||
gboolean y);
|
||||
void gtk_window_force_resize (GtkWindow *window);
|
||||
|
||||
/* Exported handles */
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user