<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#c9">Comment # 9</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>OK, I think I now have a much more better understanding of what is happening
here...
The key to the problem is the window used when invoking
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>
It's the menu's priv->bin_window not the actual window where the pointer
resides.
On X11, if the pointer is not in a child of the given window, the child
returned by XIQueryPointer() is None (as not a child of the given window).
On Wayland, the child is the pointer->focus window, being a child or not of the
given window is irrelevant.
So on Wayland, we get a "child_window" whereas on X11 we don't - But then, if
that "child_window" was correct, that wouldn't be much of a problem, but it is
not.
gdk_window_get_device_position() calls _gdk_window_find_child_at() using the
device coordinates minus the window's abs_x, abs_y:
But the device coords are relative to the device's pointer focus window and
abs_x/abs_y are relative to the given window, ie the menu's priv->bin_window
which is not at all at the same location.
As a result, the tmp_x/tmp_y location used to find the window are wrong, and
the wrong window is returned, leading to the sub-menu to be discarded.</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>