From 1b88a68b558b01e7eed9d73ee1f61cc08fb8dc03 Mon Sep 17 00:00:00 2001 From: Ravi R Kiran Date: Tue, 17 Aug 2021 21:11:55 -0500 Subject: [PATCH] Be even more conservative in declaring success This handles the nonsensical case of Alt_X being mapped to two different modifiers. --- glfw/xkb_glfw.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/glfw/xkb_glfw.c b/glfw/xkb_glfw.c index 00d79ec64..24fa7c744 100644 --- a/glfw/xkb_glfw.c +++ b/glfw/xkb_glfw.c @@ -439,7 +439,15 @@ static void modifier_mapping_algorithm( struct xkb_keymap *keymap, xkb_keycode_t * for each modifier in case there are some modifiers that are only present in * combination with others, but it is not worth the effort. */ if ( num_keysyms == 1 && mods && ( mods & ( mods-1 ) ) == 0 ) { -#define S2( k, a ) if ( ( keysyms[0] == XKB_KEY_##k##_L || keysyms[0] == XKB_KEY_##k##_R ) && !algorithm->a ) algorithm->a = mods +#define S2( k, a ) \ + do { \ + if ( keysyms[0] == XKB_KEY_##k##_L || keysyms[0] == XKB_KEY_##k##_R ) { \ + if ( !algorithm->a ) \ + algorithm->a = mods; \ + else if ( algorithm->a != mods ) \ + algorithm->failed = 1; \ + } \ + } while ( 0 ) #define S1( k, a ) if ( ( keysyms[0] == XKB_KEY_##k ) && !algorithm->a ) algorithm->a = mods S2( Shift, shift ); S2( Control, control );