[PATCH weston v3 1/3] compositor-x11: add assert to avoid misuse of x11_backend_deliver_button_event

Benoit Gschwind gschwind at gnu-log.net
Thu Jun 30 18:54:51 UTC 2016


The x11_backend_deliver_button_event can be called with any
xcb_generic_event. The assert check if the call is done with the
expected events.

Signed-off-by: Benoit Gschwind <gschwind at gnu-log.net>
---
 libweston/compositor-x11.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/libweston/compositor-x11.c b/libweston/compositor-x11.c
index a3319b4..b934e09 100644
--- a/libweston/compositor-x11.c
+++ b/libweston/compositor-x11.c
@@ -1055,6 +1055,9 @@ x11_backend_deliver_button_event(struct x11_backend *b,
 	struct x11_output *output;
 	struct weston_pointer_axis_event weston_event;
 
+	assert(event->response_type == XCB_BUTTON_PRESS ||
+	       event->response_type == XCB_BUTTON_RELEASE);
+
 	output = x11_backend_find_output(b, button_event->event);
 	if (!output)
 		return;
-- 
2.7.3



More information about the wayland-devel mailing list