Skip to content

Commit

Permalink
grab keyboard & escape exits also
Browse files Browse the repository at this point in the history
  • Loading branch information
ix committed Apr 26, 2020
1 parent 3f35f22 commit 3dd5d5c
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions crud.c
Original file line number Diff line number Diff line change
Expand Up @@ -185,9 +185,15 @@ int main(int argc, char **argv) {

switch_cursor(&cursor[1]);

XGrabKeyboard(display, root, GrabModeSync, GrabModeAsync, True, CurrentTime);

while (!done) {
XNextEvent(display, &event);
switch (event.type) {
case KeyPress:
if (XLookupKeysym(&event.xkey, 0) == XK_Escape) return 1;
break;

case ButtonPress:
if (event.xbutton.button == Button3)
return 1;
Expand Down

0 comments on commit 3dd5d5c

Please sign in to comment.