diff options
-rw-r--r-- | config.h | 7 | ||||
-rw-r--r-- | xmouseless.c | 14 |
2 files changed, 13 insertions, 8 deletions
@@ -7,8 +7,6 @@ /* the speed with no modifier */ #define DEFAULT_SPEED 10 -#define EXIT_KEY XK_q - typedef struct { KeySym keysym; int x; @@ -39,6 +37,7 @@ static MoveBinding move_bindings[] = { static ClickBinding click_bindings[] = { /* key button */ + { XK_space, 1 }, { XK_f, 1 }, { XK_d, 2 }, { XK_s, 3 }, @@ -50,3 +49,7 @@ static SpeedBindings speed_bindings[] = { { XK_Alt_L, 50 }, { XK_a, 2 }, }; + +static unsigned int exit_keys[] = { + XK_Escape, XK_q, XK_space +}; diff --git a/xmouseless.c b/xmouseless.c index 65f3e13..c3016bc 100644 --- a/xmouseless.c +++ b/xmouseless.c @@ -92,12 +92,6 @@ void handle_keypress(XKeyEvent event) { keysym = XkbKeycodeToKeysym(dpy, event.keycode, 0, event.state & ShiftMask ? 1 : 0); - /* exit */ - if (keysym == EXIT_KEY) { - close_x(); - exit(0); - } - /* move bindings */ for (i = 0; i < LENGTH(move_bindings); i++) { if (move_bindings[i].keysym == keysym) { @@ -154,6 +148,14 @@ void handle_keyrelease(XKeyEvent event) { speed = DEFAULT_SPEED; } } + + /* exit */ + for (i = 0; i < LENGTH(exit_keys); i++) { + if (exit_keys[i] == keysym) { + close_x(); + exit(0); + } + } } int main () { |