[PATCH weston 1/2] window: Only set menu element when menu widget is focused

Jonas Ådahl jadahl at gmail.com
Thu Oct 18 23:23:56 PDT 2012

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 <jadahl at gmail.com>
 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);

More information about the wayland-devel mailing list