Motion handlers are called for either grabbed or focused widgets. If a
menu is displayed, thus grabbed, motion events relative to the parent
surface are delivered to the menu widget motion handler even though it
is not in focus. By checking that the menu widget is the focused one we
can avoid setting incorrect menu elements.

This fixes the issue when an unexpected menu item gets selected when the
pointer is just outside the menu area.

Signed-off-by: Jonas Ådahl <[email protected]>
---
 clients/window.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/clients/window.c b/clients/window.c
index c029691..118dce5 100644
--- a/clients/window.c
+++ b/clients/window.c
@@ -3312,7 +3312,7 @@ menu_motion_handler(struct widget *widget,
 {
        struct menu *menu = data;
 
-       if (widget == menu->widget)
+       if (input->focus_widget == menu->widget)
                menu_set_item(data, y);
 
        return CURSOR_LEFT_PTR;
-- 
1.7.9.5

_______________________________________________
wayland-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/wayland-devel

Reply via email to