summaryrefslogtreecommitdiff
path: root/libweston
diff options
context:
space:
mode:
authorBenoit Gschwind <gschwind@gnu-log.net>2016-05-18 21:32:11 +0200
committerQuentin Glidic <sardemff7+git@sardemff7.net>2016-08-15 17:43:28 +0200
commit4ddc4cc4fae83c48fc9d40ec4bd0cbb38ba183ff (patch)
tree22933e543170cefc252506fd0b8def99b547fef4 /libweston
parent482ffdf0064113f96aa09646fc21fc5109fc8b75 (diff)
compositor-x11: add assert to avoid misuse of x11_backend_deliver_button_event
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@gnu-log.net> Reviewed-by: Daniel Stone <daniels@collabora.com> Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
Diffstat (limited to 'libweston')
-rw-r--r--libweston/compositor-x11.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/libweston/compositor-x11.c b/libweston/compositor-x11.c
index b9001845..5562b9ff 100644
--- a/libweston/compositor-x11.c
+++ b/libweston/compositor-x11.c
@@ -1068,6 +1068,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;