After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 772922 - GtkMenu: Try using gdk_window_move_to_rect() more often
GtkMenu: Try using gdk_window_move_to_rect() more often
Status: RESOLVED FIXED
Product: gtk+
Classification: Platform
Component: Widget: GtkMenu
unspecified
Other All
: Normal normal
: ---
Assigned To: gtk-bugs
gtk-bugs
Depends on:
Blocks:
 
 
Reported: 2016-10-14 09:13 UTC by Jonas Ådahl
Modified: 2016-10-21 15:55 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
GtkMenu: Try using gdk_window_move_to_rect() more often (4.42 KB, patch)
2016-10-14 09:13 UTC, Jonas Ådahl
none Details | Review
GtkMenu: Try using gdk_window_move_to_rect() more often (4.42 KB, patch)
2016-10-14 15:38 UTC, Jonas Ådahl
committed Details | Review

Description Jonas Ådahl 2016-10-14 09:13:24 UTC
In order to make unchanged applications behave better on platforms where the
legacy menu position constraining code often failed badly (e.g. Wayland), let
the GtkMenu positioning code attempt to use gdk_window_move_to_rect() more
often than before.
Comment 1 Jonas Ådahl 2016-10-14 09:13:28 UTC
Created attachment 337692 [details] [review]
GtkMenu: Try using gdk_window_move_to_rect() more often

With best-effort, try to use gdk_window_move_to_rect() more often, when
all pieces fit together. For the non-legacy paths to be triggered for
when gtk_menu_popup_for_device() or gtk_menu_popup() were used, the
following conditions must be met:

 1) There is no custom positioning function specified
 2) The menu is attached to a widget (using gtk_menu_attach_to_widget())
 3) There is a associated grab device
Comment 2 Matthias Clasen 2016-10-14 09:56:56 UTC
Review of attachment 337692 [details] [review]:

sounds good to me
Comment 3 Emmanuele Bassi (:ebassi) 2016-10-14 11:08:01 UTC
Review of attachment 337692 [details] [review]:

::: gtk/gtkmenu.c
@@ +5184,3 @@
+      attach_widget = gtk_menu_get_attach_widget (menu);
+
+       * One of the legacy gtk_menu_popup*() functions were used to popup but

This condition looks wrong. Shouldn't it be:

  if (grab_device && attach_widget)

?
Comment 4 Jonas Ådahl 2016-10-14 15:32:00 UTC
Review of attachment 337692 [details] [review]:

::: gtk/gtkmenu.c
@@ +5184,3 @@
+      attach_widget = gtk_menu_get_attach_widget (menu);
+
+      if (attach_widget && attach_widget)

Ehe, indeed.
Comment 5 Jonas Ådahl 2016-10-14 15:38:10 UTC
Created attachment 337730 [details] [review]
GtkMenu: Try using gdk_window_move_to_rect() more often

With best-effort, try to use gdk_window_move_to_rect() more often, when
all pieces fit together. For the non-legacy paths to be triggered for
when gtk_menu_popup_for_device() or gtk_menu_popup() were used, the
following conditions must be met:

 1) There is no custom positioning function specified
 2) The menu is attached to a widget (using gtk_menu_attach_to_widget())
 3) There is a associated grab device
Comment 6 Matthias Clasen 2016-10-17 09:44:13 UTC
Review of attachment 337730 [details] [review]:

ok
Comment 7 Matthias Clasen 2016-10-17 09:45:30 UTC
Review of attachment 337730 [details] [review]:

ok
Comment 8 Matthias Clasen 2016-10-21 15:55:25 UTC
Attachment 337730 [details] pushed as 11b5cfb - GtkMenu: Try using gdk_window_move_to_rect() more often