Author: yamakenz
Date: Sun Sep 16 09:17:48 2007
New Revision: 4972
Modified:
trunk/xim/ximserver.cpp
Log:
* xim/ximserver.cpp
- Port the kana-input hack by Yusuke for GTK+ bridge to
uim-xim. Working correctly
- (UIM_XIM_USE_JAPANESE_KANA_KEYBOARD_HACK): New macro
- (gProlongedsoundKeyCode): New static variable
- (keyState::check_key): Add the yen sign key hack
- (check_modifier): Add initialization for gProlongedsoundKeyCode
Modified: trunk/xim/ximserver.cpp
==============================================================================
--- trunk/xim/ximserver.cpp (original)
+++ trunk/xim/ximserver.cpp Sun Sep 16 09:17:48 2007
@@ -71,6 +71,8 @@
# endif
#endif
+#define UIM_XIM_USE_JAPANESE_KANA_KEYBOARD_HACK 1
+
extern int lib_uim_fd;
extern Atom xim_servers;
InputContext *InputContext::mFocusedContext = NULL;
@@ -78,6 +80,9 @@
static int check_modifier(std::list<KeySym> list);
static int gMod1Mask, gMod2Mask, gMod3Mask, gMod4Mask, gMod5Mask;
static int gXNumLockMask;
+#if UIM_XIM_USE_JAPANESE_KANA_KEYBOARD_HACK
+static unsigned int gProlongedsoundKeyCode;
+#endif
void print_ustring(uString *s)
@@ -1096,6 +1101,20 @@
if (x->state & Mod5Mask)
mModifier |= (gMod5Mask & mPreModState);
+#if UIM_XIM_USE_JAPANESE_KANA_KEYBOARD_HACK
+ // A hack to distinguish Japanese kana_RO key from yen sign key
+ // (both keys normally generates backslash on ASCII input). See
+ // [uim-en 11] and the follow messages for the discussion.
+ //
+ // This hack assumes that the xmodmap for the Japanese kana
+ // keyboard is defined as follows:
+ //
+ // yen sign key: keycode X = backslash bar prolongedsound
+ // kana_RO key: keycode Y = backslash underscore kana_RO
+ if (x->key_sym == '\\' && x->ev.xkey.keycode == gProlongedsoundKeyCode)
+ mKey = UKey_Yen;
+ else
+#endif
if (x->key_sym < 128 && x->key_sym >= 32)
mKey = x->key_sym;
else if (x->key_sym >= XK_F1 && x->key_sym <= XK_F35)
@@ -1275,6 +1294,12 @@
gMod3Mask = check_modifier(Mod3MaskSyms);
gMod4Mask = check_modifier(Mod4MaskSyms);
gMod5Mask = check_modifier(Mod5MaskSyms);
+
+#if UIM_XIM_USE_JAPANESE_KANA_KEYBOARD_HACK
+ // Init at here with sync to proper update timing although not a modifier.
+ gProlongedsoundKeyCode
+ = XKeysymToKeycode(XimServer::gDpy, XK_prolongedsound);
+#endif
}