/* Try to find the mode in the list of modes and return it */
SLIST_FOREACH(mode, &modes, modes) {
- if (strcmp(mode->name, name) == 0)
+ if (strcmp(mode->name, name) == 0) {
return mode;
+ }
}
/* If the mode was not found, create a new one */
*/
Binding *configure_binding(const char *bindtype, const char *modifiers, const char *input_code,
const char *release, const char *border, const char *whole_window,
- const char *command, const char *modename, bool pango_markup) {
+ const char *exclude_titlebar, const char *command, const char *modename,
+ bool pango_markup) {
Binding *new_binding = scalloc(1, sizeof(Binding));
DLOG("Binding %p bindtype %s, modifiers %s, input code %s, release %s\n", new_binding, bindtype, modifiers, input_code, release);
new_binding->release = (release != NULL ? B_UPON_KEYRELEASE : B_UPON_KEYPRESS);
new_binding->border = (border != NULL);
new_binding->whole_window = (whole_window != NULL);
+ new_binding->exclude_titlebar = (exclude_titlebar != NULL);
if (strcmp(bindtype, "bindsym") == 0) {
new_binding->input_type = (strncasecmp(input_code, "button", (sizeof("button") - 1)) == 0
? B_MOUSE
*/
static void add_keycode_if_matches(struct xkb_keymap *keymap, xkb_keycode_t key, void *data) {
const struct resolve *resolving = data;
+ struct xkb_state *numlock_state = resolving->xkb_state_numlock;
xkb_keysym_t sym = xkb_state_key_get_one_sym(resolving->xkb_state, key);
if (sym != resolving->keysym) {
/* Check if Shift was specified, and try resolving the symbol without
return;
if (xkb_state_key_get_level(resolving->xkb_state, key, layout) > 1)
return;
+ /* Skip the Shift fallback for keypad keys, otherwise one cannot bind
+ * KP_1 independent of KP_End. */
+ if (sym >= XKB_KEY_KP_Space && sym <= XKB_KEY_KP_Equal)
+ return;
+ numlock_state = resolving->xkb_state_numlock_no_shift;
sym = xkb_state_key_get_one_sym(resolving->xkb_state_no_shift, key);
if (sym != resolving->keysym)
return;
* active. If so, grab the key with NumLock as well, so that users don’t
* need to duplicate every key binding with an additional Mod2 specified.
*/
- xkb_keysym_t sym_numlock = xkb_state_key_get_one_sym(resolving->xkb_state_numlock, key);
- xkb_keysym_t sym_numlock_no_shift = xkb_state_key_get_one_sym(resolving->xkb_state_numlock_no_shift, key);
- if (sym_numlock == resolving->keysym || sym_numlock_no_shift == resolving->keysym) {
+ xkb_keysym_t sym_numlock = xkb_state_key_get_one_sym(numlock_state, key);
+ if (sym_numlock == resolving->keysym) {
/* Also bind the key with active NumLock */
ADD_TRANSLATED_KEY(bind->event_state_mask | xcb_numlock_mask);
}
/* Avoid duplicates. */
- for (int i = 0; i < num_max; i++) {
+ for (int i = 0; i < num; i++) {
if (buffer[i] == button)
continue;
}