Ignore capslock state
authorChoe Hwanjin <choe.hwanjin@gmail.com>
Mon, 7 Dec 2009 15:21:05 +0000 (00:21 +0900)
committerChoe Hwanjin <choe.hwanjin@gmail.com>
Mon, 7 Dec 2009 15:21:05 +0000 (00:21 +0900)
 * Korean input method is not transliteration method.
   The position of the pressed key is important, not the character itself.
   So we need to normalize the key event to general qwerty to get the
   correct position of the pressed key.

src/engine.c

index 254531c..8fa917b 100644 (file)
@@ -6,6 +6,7 @@
 #include <ibus.h>
 #include <hangul.h>
 #include <string.h>
+#include <ctype.h>
 
 #include "i18n.h"
 #include "engine.h"
@@ -630,6 +631,15 @@ ibus_hangul_engine_process_key_event (IBusEngine     *engine,
     if (keyval == IBUS_BackSpace) {
         retval = hangul_ic_backspace (hangul->context);
     } else {
+       // ignore capslock
+       if (modifiers & IBUS_LOCK_MASK) {
+           if (keyval >= 'A' && keyval <= 'z') {
+               if (isupper(keyval))
+                   keyval = tolower(keyval);
+               else
+                   keyval = toupper(keyval);
+           }
+       }
         retval = hangul_ic_process (hangul->context, keyval);
     }