- /* First compare the modifiers */
- if (bind->mods != modifiers)
- continue;
-
- /* If a symbol was specified by the user, we need to look in
- * the array of translated keycodes for the event’s keycode */
- if (bind->symbol != NULL) {
- if (memmem(bind->translated_to,
- bind->number_keycodes * sizeof(xcb_keycode_t),
- &keycode, sizeof(xcb_keycode_t)) != NULL)
- break;
- } else {
- /* This case is easier: The user specified a keycode */
- if (bind->keycode == keycode)
- break;
- }
+ if (bind->release == B_UPON_KEYRELEASE_IGNORE_MODS)
+ bind->release = B_UPON_KEYRELEASE;
+ }
+ }
+
+ TAILQ_FOREACH(bind, bindings, bindings) {
+ /* First compare the modifiers (unless this is a
+ * B_UPON_KEYRELEASE_IGNORE_MODS binding and this is a KeyRelease
+ * event) */
+ if (bind->mods != modifiers &&
+ (bind->release != B_UPON_KEYRELEASE_IGNORE_MODS ||
+ !key_release))
+ continue;
+
+ /* If a symbol was specified by the user, we need to look in
+ * the array of translated keycodes for the event’s keycode */
+ if (bind->symbol != NULL) {
+ if (memmem(bind->translated_to,
+ bind->number_keycodes * sizeof(xcb_keycode_t),
+ &keycode, sizeof(xcb_keycode_t)) == NULL)
+ continue;
+ } else {
+ /* This case is easier: The user specified a keycode */
+ if (bind->keycode != keycode)
+ continue;