[PATCH weston 1/2] Clip pointer input to menu surface.

Scott Moreau oreaus at gmail.com
Sun Oct 7 03:28:55 PDT 2012


Don't send motion events to the surface when the pointer is not over the menu.
This was also causing items to be selected when clicking outside of the menu.
---
 src/shell.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/src/shell.c b/src/shell.c
index 1c44e39..e6c8ee9 100644
--- a/src/shell.c
+++ b/src/shell.c
@@ -1796,6 +1796,17 @@ popup_grab_motion(struct wl_pointer_grab *grab,
 		  uint32_t time, wl_fixed_t sx, wl_fixed_t sy)
 {
 	struct wl_resource *resource;
+	int x, y;
+	struct shell_surface *shsurf =
+		container_of(grab, struct shell_surface, popup.grab);
+
+	weston_surface_from_global(shsurf->surface,
+				wl_fixed_to_int(shsurf->popup.seat->pointer->x),
+				wl_fixed_to_int(shsurf->popup.seat->pointer->y),
+				&x, &y);
+
+	if (!pixman_region32_contains_point(&shsurf->surface->input, x, y, NULL))
+		return;
 
 	resource = grab->pointer->focus_resource;
 	if (resource)
-- 
1.7.11.4



More information about the wayland-devel mailing list