>From 65a5be82d4a867ebb5dc4858ee5a2186aec594e4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hugo=20H=C3=B6rnquist?= Date: Sun, 28 Apr 2019 22:50:25 +0200 Subject: [PATCH 6/7] Add default to event-caputer. --- guile-xlib.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/guile-xlib.c b/guile-xlib.c index 9df32c1..e073490 100644 --- a/guile-xlib.c +++ b/guile-xlib.c @@ -2356,6 +2356,15 @@ static SCM copy_event_fields (SCM display, XEvent *e, SCM event, const char *fun scm_c_vector_set_x(event, XEVENT_SLOT_COUNT, scm_from_int (E.count)); break; #undef E + + default: + /* Default to a type value of -1. This makes the scheme code safer since + * event:type will always return an integer. This will both be triggered + * for any event type not mentioned above, as well as the first event + * captured, which might contain garbage data. + */ + scm_c_vector_set_x(event, XEVENT_SLOT_TYPE, scm_from_int(-1)); + break; } return event; -- 2.21.0