summaryrefslogtreecommitdiff
path: root/i3lock.c
diff options
context:
space:
mode:
authorMichael Stapelberg <michael@stapelberg.de>2010-07-20 20:13:40 +0200
committerMichael Stapelberg <michael@stapelberg.de>2010-07-20 20:13:40 +0200
commit9d19a8bb53d7285ba352004e47e76474f20ab7c2 (patch)
tree566d9361e46d82e94dfff0ddcd863aa3bac28c26 /i3lock.c
parent6a52ba8beabbb26ebcd2716d4c2734cb7500a33d (diff)
make event loop simpler (Thanks to Jamey Sharp)
As explained in Jamey’s post on the XCB mailing list, the event loop can/should be written in a more simple way than it was before in xcb-event. See: <AANLkTinhIM320wUjSeHkBTVk4ysBuiSZkvfs8pMLVykO@mail.gmail.com> or http://lists.freedesktop.org/archives/xcb/2010-July/006292.html
Diffstat (limited to 'i3lock.c')
-rw-r--r--i3lock.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/i3lock.c b/i3lock.c
index 0fa384c..cb671d5 100644
--- a/i3lock.c
+++ b/i3lock.c
@@ -324,7 +324,11 @@ int main(int argc, char *argv[]) {
dpms_turn_off_screen(conn);
while ((event = xcb_wait_for_event(conn))) {
- int type = x_event_type(event);
+ if (event->response_type == 0)
+ errx(1, "XCB: Invalid event received");
+
+ /* Strip off the highest bit (set if the event is generated) */
+ int type = (event->response_type & 0x7F);
if (type == XCB_EXPOSE) {
handle_expose_event();