[gtk/gtk-3-24: 3/5] menu: Force recalculation of size before positioning
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/gtk-3-24: 3/5] menu: Force recalculation of size before positioning
- Date: Thu, 7 Feb 2019 21:29:54 +0000 (UTC)
commit 7298e73c445dc06e9840c47667501e1cb5dd5a71
Author: Jonas Ã…dahl <jadahl gmail com>
Date: Thu Feb 7 09:55:51 2019 +0100
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.
gtk/gtkmenu.c | 1 +
1 file changed, 1 insertion(+)
---
diff --git a/gtk/gtkmenu.c b/gtk/gtkmenu.c
index 7b156f9861..3a9c69ae6d 100644
--- a/gtk/gtkmenu.c
+++ b/gtk/gtkmenu.c
@@ -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);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]