diff options
author | Georgios Bitzes <georgios.bitzes@cern.ch> | 2016-04-23 12:19:40 +0200 |
---|---|---|
committer | Quentin Glidic <sardemff7+git@sardemff7.net> | 2016-05-07 15:20:48 +0200 |
commit | 8af7f014cdc06f6b6ac9d6c6796a143e6307e7dd (patch) | |
tree | 4c127c8a471d8c901123aec3082496f86ebb65c7 /source/x11-helper.c | |
parent | 999bf56b7edccb618394e895347b6b4a1ca9aba5 (diff) |
Permit binding a modifier key on its own
Diffstat (limited to 'source/x11-helper.c')
-rw-r--r-- | source/x11-helper.c | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/source/x11-helper.c b/source/x11-helper.c index 8adb6c54..a0ab25d7 100644 --- a/source/x11-helper.c +++ b/source/x11-helper.c @@ -500,14 +500,22 @@ gboolean x11_parse_key ( char *combo, unsigned int *mod, xkb_keysym_t *key, gboo seen_mod = TRUE; } - *mod = modmask; - - // Skip modifier (if exist) and parse key. + // Find location of modifier (if it exists) char i = strlen ( combo ); while ( i > 0 && !strchr ( "-+", combo[i - 1] ) ) { i--; } + + // if there's no "-" or "+", we might be binding directly to a modifier key - no modmask + if( i == 0 ) { + *mod = 0; + } + else { + *mod = modmask; + } + + // Parse key xkb_keysym_t sym = XKB_KEY_NoSymbol; if ( ( modmask & x11_mod_masks[X11MOD_SHIFT] ) != 0 ) { gchar * str = g_utf8_next_char ( combo + i ); |