changeset 1175:2a7ed92e55d4

NumLock, CapsLock, etc. modifiers should be ignored in parseKey().
author Rogutes Sparnuotos <rogutes@googlemail.com>
date Thu, 07 May 2009 20:22:13 +0300
parents cc02358c8e6d
children 7ac828844742
files src/keys.cc
diffstat 1 files changed, 4 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/keys.cc	Tue Jun 16 13:49:05 2009 -0400
+++ b/src/keys.cc	Thu May 07 20:22:13 2009 +0300
@@ -156,15 +156,17 @@
 {
    KeysCommand_t ret = KEYS_NOP;
    KeyBinding_t keyNode;
+   // We're only interested in some flags
+   keyNode.modifier = fltk::event_state() &
+     (fltk::SHIFT | fltk::CTRL | fltk::ALT | fltk::META);
 
-   if (fltk::event_state() == fltk::SHIFT &&
+   if (keyNode.modifier == fltk::SHIFT &&
        ispunct(fltk::event_text()[0])) {
       // Get key code for a shifted character
       keyNode.key = fltk::event_text()[0];
       keyNode.modifier = 0;
    } else {
       keyNode.key = fltk::event_key();
-      keyNode.modifier = fltk::event_state();
    }
 
    _MSG("getKeyCmd: key=%d, mod=%d\n", keyNode.key, keyNode.modifier);