diff options
Diffstat (limited to 'src/bindings.c')
-rw-r--r-- | src/bindings.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/src/bindings.c b/src/bindings.c index 2c8d5970..e5804919 100644 --- a/src/bindings.c +++ b/src/bindings.c @@ -631,6 +631,7 @@ void switch_mode(const char *new_mode) { current_binding_mode = mode->name; translate_keysyms(); grab_all_keys(conn); + regrab_all_buttons(conn); /* Reset all B_UPON_KEYRELEASE_IGNORE_MODS bindings to avoid possibly * activating one of them. */ @@ -1008,7 +1009,7 @@ bool load_keymap(void) { int *bindings_get_buttons_to_grab(void) { /* Let's make the reasonable assumption that there's no more than 25 * buttons. */ - int num_max = 25; + const int num_max = 25; int buffer[num_max]; int num = 0; @@ -1034,12 +1035,17 @@ int *bindings_get_buttons_to_grab(void) { } /* Avoid duplicates. */ + bool exists = false; for (int i = 0; i < num; i++) { - if (buffer[i] == button) - continue; + if (buffer[i] == button) { + exists = true; + break; + } } - buffer[num++] = button; + if (!exists) { + buffer[num++] = button; + } } buffer[num++] = 0; |