Be even more conservative in declaring success

This handles the nonsensical case of Alt_X being mapped to two
different modifiers.
This commit is contained in:
Ravi R Kiran 2021-08-17 21:11:55 -05:00
parent b0c963b650
commit 1b88a68b55

10
glfw/xkb_glfw.c vendored
View File

@ -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 * for each modifier in case there are some modifiers that are only present in
* combination with others, but it is not worth the effort. */ * combination with others, but it is not worth the effort. */
if ( num_keysyms == 1 && mods && ( mods & ( mods-1 ) ) == 0 ) { 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 #define S1( k, a ) if ( ( keysyms[0] == XKB_KEY_##k ) && !algorithm->a ) algorithm->a = mods
S2( Shift, shift ); S2( Shift, shift );
S2( Control, control ); S2( Control, control );