menu: Force recalculation of size before positioning
On X11, the position of the menu is calculated synchronously by gdk_window_move_to_rect(). This means that calculating the window size when showing is too late, as that'd mean the size used when calculating the position is out-of-date. The first time a menu is mapped, however, the size is calculated during realization; but a window is only realized once, so it doesn't work for subsequent maps. Currently, this is harmless, as a GtkMenu can change its size however it wants after it has been mapped. This, however, is problematic, as it means the position calculated by gdk_window_move_to_rect() might no longer be valid, or constraints made by the same function might no longer be respected. Thus, this is a preparation for making GtkMenu popups stay the same size until they are remapped again at a later point.
This commit is contained in:
parent
461f5fde03
commit
7298e73c44
@ -5267,6 +5267,7 @@ gtk_menu_position (GtkMenu *menu,
|
||||
* the right place to popup the menu.
|
||||
*/
|
||||
gtk_widget_realize (priv->toplevel);
|
||||
gtk_window_move_resize (GTK_WINDOW (priv->toplevel));
|
||||
|
||||
if (!gtk_widget_get_visible (priv->toplevel))
|
||||
gtk_window_set_type_hint (GTK_WINDOW (priv->toplevel), priv->menu_type_hint);
|
||||
|
Loading…
Reference in New Issue
Block a user