<html>
<head>
<base href="https://bugzilla.gnome.org/" />
</head>
<body>
<p>
<div>
<b><a class="bz_bug_link
bz_status_NEW "
title="NEW - [Wayland] Submenus often get closed after ~2 seconds"
href="https://bugzilla.gnome.org/show_bug.cgi?id=768016#c8">Comment # 8</a>
on <a class="bz_bug_link
bz_status_NEW "
title="NEW - [Wayland] Submenus often get closed after ~2 seconds"
href="https://bugzilla.gnome.org/show_bug.cgi?id=768016">bug 768016</a>
from <span class="vcard"><a href="page.cgi?id=describeuser.html&login=ofourdan%40redhat.com" title="Olivier Fourdan <ofourdan@redhat.com>"> <span class="fn">Olivier Fourdan</span></a>
</span></b>
<pre>Sorry in advance for this lengthy post, I find this issue rather complex, what
follows is mostly a brain dump, as a reminder for myself and if anyone else
wishes to chime in with ideas...
I think the problem with the coords from the LeaveNotify ewent being within the
previous window can happen even in X11, so the root of the problem is actually
the wrong child window being returned by gdk_window_get_device_position() in
gtk_menu_stop_navigating_submenu_cb():
<a href="https://git.gnome.org/browse/gtk+/tree/gtk/gtkmenu.c#n4116">https://git.gnome.org/browse/gtk+/tree/gtk/gtkmenu.c#n4116</a>
Adding traces in gdk_window_get_device_position() I can see that under Wayland,
it's indeed another menu item which is returned and therefore wrongly selected:
gdk_window_get_device_position - tmp (15.58,22.20) window 0x1a128a0 [408x160]
child 0x1a12a10 [408x32]
On X11 this does not occur because get_device_state() returns FALSE:
<a href="https://git.gnome.org/browse/gtk+/tree/gdk/gdkwindow.c#n4945">https://git.gnome.org/browse/gtk+/tree/gdk/gdkwindow.c#n4945</a>
So in gdk_window_get_device_position(), "normal_child" is FALSE on X11 and
therefore gdk_window_get_device_position() returns NULL.
On Wayland, it returns TRUE, leading to another window/widget to be selected.
get_device_state() on both X11 and Wayland calls query_state() of the
corresponding backend and returns TRUE in the child is not NULL.
gdkwindow-wayland impl:
<a href="https://git.gnome.org/browse/gtk+/tree/gdk/wayland/gdkwindow-wayland.c#n2053">https://git.gnome.org/browse/gtk+/tree/gdk/wayland/gdkwindow-wayland.c#n2053</a>
gdkwindow-x11 impl:
<a href="https://git.gnome.org/browse/gtk+/tree/gdk/x11/gdkwindow-x11.c#n3306">https://git.gnome.org/browse/gtk+/tree/gdk/x11/gdkwindow-x11.c#n3306</a>
So it all comes down to the child window returned by query_state().
On X11 (XI2 backend), it relies on the child as returned by XIQueryPointer()
<a href="https://git.gnome.org/browse/gtk+/tree/gdk/x11/gdkdevice-xi2.c#n317">https://git.gnome.org/browse/gtk+/tree/gdk/x11/gdkdevice-xi2.c#n317</a>
Whereas on Wayland, it relies on the pointer's focus_window:
<a href="https://git.gnome.org/browse/gtk+/tree/gdk/wayland/gdkdevice-wayland.c#n498">https://git.gnome.org/browse/gtk+/tree/gdk/wayland/gdkdevice-wayland.c#n498</a>
I suspect there is a difference between the child window returned by
XIQueryPointer() on X11 and the pointer->focus_window in Wayland.
FWIW, the value of the child window returned by XIQueryPointer() in our case is
None whereas in the same case pointer->focus_window is whatever window the
pointer last entered.</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are on the CC list for the bug.</li>
</ul>
</body>
</html>