Revision: 6446
Author: ek.kato
Date: Sun Jun 13 18:59:57 2010
Log: * qt/immodule-quiminputcontext_compose.cpp
  - (QUimInputContext::get_mb_string) : Fix to use a right
    unicode character for keysym.
* qt4/immodule/quiminputcontext_compose.cpp
  - (KeySymToUcs4) : Revert r6439.
  - (QUimInputContext::get_mb_string) : Fix to use a right
    unicode character for keysym.
  - (keysym_to_unicode_680_6ff) : Revert r6439.
  - (keysym_to_unicode_7a1_7f9) : Ditto.
  - (keysym_to_unicode_12a1_12fe) : Ditto.
  - (keysym_to_unicode_14a1_14ff) : Ditto.
  - (keysym_to_unicode_15d0_15f6) : Ditto.
  - (keysym_to_unicode_16a0_16f6) : Ditto.

http://code.google.com/p/uim/source/detail?r=6446

Modified:
 /trunk/qt/immodule-quiminputcontext_compose.cpp
 /trunk/qt4/immodule/quiminputcontext_compose.cpp

=======================================
--- /trunk/qt/immodule-quiminputcontext_compose.cpp     Sun Apr  4 20:35:54 2010
+++ /trunk/qt/immodule-quiminputcontext_compose.cpp     Sun Jun 13 18:59:57 2010
@@ -593,7 +593,7 @@
     unsigned int ucs;

     ucs = KeySymToUcs4(ks);
-    QString qs = QString(QChar(ks));
+    QString qs = QString(QChar(ucs));
     mb = (const char *)qs.local8Bit();
     if (!mb)
        return 0;
=======================================
--- /trunk/qt4/immodule/quiminputcontext_compose.cpp Sat Jun 12 21:15:09 2010 +++ /trunk/qt4/immodule/quiminputcontext_compose.cpp Sun Jun 13 18:59:57 2010
@@ -68,6 +68,7 @@


 static int parse_line(char *line, char **argv, int argsize);
+static unsigned int KeySymToUcs4(KeySym keysym);

 Compose::Compose(DefTree *top, QUimInputContext *ic)
 {
@@ -602,7 +603,8 @@
 int
 QUimInputContext::get_mb_string(char *buf, unsigned int ks)
 {
-    QString qs = QString(QChar(ks));
+    unsigned int ucs = KeySymToUcs4(ks);
+    QString qs = QString(QChar(ucs));
     const char *mb = qs.toLocal8Bit().data();
     if (!mb)
         return 0;
@@ -1057,6 +1059,25 @@
0x06a9, 0x06af, 0x06ba, 0x06be, 0x06cc, 0x06d2, 0x06c1 /* 0x05f8-0x05fe */
 };

+static unsigned short keysym_to_unicode_680_6ff[] = {
+ 0x0492, 0x0496, 0x049a, 0x049c, 0x04a2, 0x04ae, 0x04b0, 0x04b2, /* 0x0680-0x0687 */ + 0x04b6, 0x04b8, 0x04ba, 0x0000, 0x04d8, 0x04e2, 0x04e8, 0x04ee, /* 0x0688-0x068f */ + 0x0493, 0x0497, 0x049b, 0x049d, 0x04a3, 0x04af, 0x04b1, 0x04b3, /* 0x0690-0x0697 */ + 0x04b7, 0x04b9, 0x04bb, 0x0000, 0x04d9, 0x04e3, 0x04e9, 0x04ef, /* 0x0698-0x069f */ + 0x0000, 0x0452, 0x0453, 0x0451, 0x0454, 0x0455, 0x0456, 0x0457, /* 0x06a0-0x06a7 */ + 0x0458, 0x0459, 0x045a, 0x045b, 0x045c, 0x0491, 0x045e, 0x045f, /* 0x06a8-0x06af */ + 0x2116, 0x0402, 0x0403, 0x0401, 0x0404, 0x0405, 0x0406, 0x0407, /* 0x06b0-0x06b7 */ + 0x0408, 0x0409, 0x040a, 0x040b, 0x040c, 0x0490, 0x040e, 0x040f, /* 0x06b8-0x06bf */ + 0x044e, 0x0430, 0x0431, 0x0446, 0x0434, 0x0435, 0x0444, 0x0433, /* 0x06c0-0x06c7 */ + 0x0445, 0x0438, 0x0439, 0x043a, 0x043b, 0x043c, 0x043d, 0x043e, /* 0x06c8-0x06cf */ + 0x043f, 0x044f, 0x0440, 0x0441, 0x0442, 0x0443, 0x0436, 0x0432, /* 0x06d0-0x06d7 */ + 0x044c, 0x044b, 0x0437, 0x0448, 0x044d, 0x0449, 0x0447, 0x044a, /* 0x06d8-0x06df */ + 0x042e, 0x0410, 0x0411, 0x0426, 0x0414, 0x0415, 0x0424, 0x0413, /* 0x06e0-0x06e7 */ + 0x0425, 0x0418, 0x0419, 0x041a, 0x041b, 0x041c, 0x041d, 0x041e, /* 0x06e8-0x06ef */ + 0x041f, 0x042f, 0x0420, 0x0421, 0x0422, 0x0423, 0x0416, 0x0412, /* 0x06f0-0x06f7 */ + 0x042c, 0x042b, 0x0417, 0x0428, 0x042d, 0x0429, 0x0427, 0x042a /* 0x06f8-0x06ff */
+};
+
 static unsigned short const keysym_to_unicode_7a1_7f9[] = {
0x0386, 0x0388, 0x0389, 0x038a, 0x03aa, 0x0000, 0x038c, /* 0x07a0-0x07a7 */ 0x038e, 0x03ab, 0x0000, 0x038f, 0x0000, 0x0000, 0x0385, 0x2015, /* 0x07a8-0x07af */
@@ -1150,10 +1171,62 @@
0x11eb, 0x0000, 0x11f9, 0x0000, 0x0000, 0x0000, 0x0000, 0x20a9, /* 0x0ef8-0x0eff */
 };

+static unsigned short keysym_to_unicode_12a1_12fe[] = {
+ 0x1e02, 0x1e03, 0x0000, 0x0000, 0x0000, 0x1e0a, 0x0000, /* 0x12a0-0x12a7 */ + 0x1e80, 0x0000, 0x1e82, 0x1e0b, 0x1ef2, 0x0000, 0x0000, 0x0000, /* 0x12a8-0x12af */ + 0x1e1e, 0x1e1f, 0x0000, 0x0000, 0x1e40, 0x1e41, 0x0000, 0x1e56, /* 0x12b0-0x12b7 */ + 0x1e81, 0x1e57, 0x1e83, 0x1e60, 0x1ef3, 0x1e84, 0x1e85, 0x1e61, /* 0x12b8-0x12bf */ + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /* 0x12c0-0x12c7 */ + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /* 0x12c8-0x12cf */ + 0x0174, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x1e6a, /* 0x12d0-0x12d7 */ + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0176, 0x0000, /* 0x12d8-0x12df */ + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /* 0x12e0-0x12e7 */ + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /* 0x12e8-0x12ef */ + 0x0175, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x1e6b, /* 0x12f0-0x12f7 */ + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0177 /* 0x12f0-0x12ff */
+};
+
 static unsigned short const keysym_to_unicode_13bc_13be[] = {
0x0152, 0x0153, 0x0178 /* 0x13b8-0x13bf */
 };

+static unsigned short keysym_to_unicode_14a1_14ff[] = {
+ 0x2741, 0x00a7, 0x0589, 0x0029, 0x0028, 0x00bb, 0x00ab, /* 0x14a0-0x14a7 */ + 0x2014, 0x002e, 0x055d, 0x002c, 0x2013, 0x058a, 0x2026, 0x055c, /* 0x14a8-0x14af */ + 0x055b, 0x055e, 0x0531, 0x0561, 0x0532, 0x0562, 0x0533, 0x0563, /* 0x14b0-0x14b7 */ + 0x0534, 0x0564, 0x0535, 0x0565, 0x0536, 0x0566, 0x0537, 0x0567, /* 0x14b8-0x14bf */ + 0x0538, 0x0568, 0x0539, 0x0569, 0x053a, 0x056a, 0x053b, 0x056b, /* 0x14c0-0x14c7 */ + 0x053c, 0x056c, 0x053d, 0x056d, 0x053e, 0x056e, 0x053f, 0x056f, /* 0x14c8-0x14cf */ + 0x0540, 0x0570, 0x0541, 0x0571, 0x0542, 0x0572, 0x0543, 0x0573, /* 0x14d0-0x14d7 */ + 0x0544, 0x0574, 0x0545, 0x0575, 0x0546, 0x0576, 0x0547, 0x0577, /* 0x14d8-0x14df */ + 0x0548, 0x0578, 0x0549, 0x0579, 0x054a, 0x057a, 0x054b, 0x057b, /* 0x14e0-0x14e7 */ + 0x054c, 0x057c, 0x054d, 0x057d, 0x054e, 0x057e, 0x054f, 0x057f, /* 0x14e8-0x14ef */ + 0x0550, 0x0580, 0x0551, 0x0581, 0x0552, 0x0582, 0x0553, 0x0583, /* 0x14f0-0x14f7 */ + 0x0554, 0x0584, 0x0555, 0x0585, 0x0556, 0x0586, 0x2019, 0x0027, /* 0x14f8-0x14ff */
+};
+
+static unsigned short keysym_to_unicode_15d0_15f6[] = {
+ 0x10d0, 0x10d1, 0x10d2, 0x10d3, 0x10d4, 0x10d5, 0x10d6, 0x10d7, /* 0x15d0-0x15d7 */ + 0x10d8, 0x10d9, 0x10da, 0x10db, 0x10dc, 0x10dd, 0x10de, 0x10df, /* 0x15d8-0x15df */ + 0x10e0, 0x10e1, 0x10e2, 0x10e3, 0x10e4, 0x10e5, 0x10e6, 0x10e7, /* 0x15e0-0x15e7 */ + 0x10e8, 0x10e9, 0x10ea, 0x10eb, 0x10ec, 0x10ed, 0x10ee, 0x10ef, /* 0x15e8-0x15ef */ + 0x10f0, 0x10f1, 0x10f2, 0x10f3, 0x10f4, 0x10f5, 0x10f6 /* 0x15f0-0x15f7 */
+};
+
+static unsigned short keysym_to_unicode_16a0_16f6[] = {
+ 0x0000, 0x0000, 0xf0a2, 0x1e8a, 0x0000, 0xf0a5, 0x012c, 0xf0a7, /* 0x16a0-0x16a7 */ + 0xf0a8, 0x01b5, 0x01e6, 0x0000, 0x0000, 0x0000, 0x0000, 0x019f, /* 0x16a8-0x16af */ + 0x0000, 0x0000, 0xf0b2, 0x1e8b, 0x01d1, 0xf0b5, 0x012d, 0xf0b7, /* 0x16b0-0x16b7 */ + 0xf0b8, 0x01b6, 0x01e7, 0x0000, 0x0000, 0x01d2, 0x0000, 0x0275, /* 0x16b8-0x16bf */ + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x018f, 0x0000, /* 0x16c0-0x16c7 */ + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /* 0x16c8-0x16cf */ + 0x0000, 0x1e36, 0xf0d2, 0xf0d3, 0x0000, 0x0000, 0x0000, 0x0000, /* 0x16d0-0x16d7 */ + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /* 0x16d8-0x16df */ + 0x0000, 0x1e37, 0xf0e2, 0xf0e3, 0x0000, 0x0000, 0x0000, 0x0000, /* 0x16e0-0x16e7 */ + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /* 0x16e8-0x16ef */ + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0259 /* 0x16f0-0x16f6 */
+};
+
 static unsigned short const keysym_to_unicode_1e9f_1eff[] = {
                                                             0x0303,
0x1ea0, 0x1ea1, 0x1ea2, 0x1ea3, 0x1ea4, 0x1ea5, 0x1ea6, 0x1ea7, /* 0x1ea0-0x1ea7 */
@@ -1174,6 +1247,60 @@
0x20a0, 0x20a1, 0x20a2, 0x20a3, 0x20a4, 0x20a5, 0x20a6, 0x20a7, /* 0x20a0-0x20a7 */ 0x20a8, 0x20a9, 0x20aa, 0x20ab, 0x20ac /* 0x20a8-0x20af */
 };
+
+static unsigned int
+KeySymToUcs4(KeySym keysym)
+{
+    /* 'Unicode keysym' */
+    if ((keysym & 0xff000000) == 0x01000000)
+        return (keysym & 0x00ffffff);
+
+    if (keysym > 0 && keysym < 0x100)
+        return keysym;
+    else if (keysym > 0x1a0 && keysym < 0x200)
+        return keysym_to_unicode_1a1_1ff[keysym - 0x1a1];
+    else if (keysym > 0x2a0 && keysym < 0x2ff)
+        return keysym_to_unicode_2a1_2fe[keysym - 0x2a1];
+    else if (keysym > 0x3a1 && keysym < 0x3ff)
+        return keysym_to_unicode_3a2_3fe[keysym - 0x3a2];
+    else if (keysym > 0x4a0 && keysym < 0x4e0)
+        return keysym_to_unicode_4a1_4df[keysym - 0x4a1];
+    else if (keysym > 0x589 && keysym < 0x5ff)
+        return keysym_to_unicode_590_5fe[keysym - 0x590];
+    else if (keysym > 0x67f && keysym < 0x700)
+        return keysym_to_unicode_680_6ff[keysym - 0x680];
+    else if (keysym > 0x7a0 && keysym < 0x7fa)
+        return keysym_to_unicode_7a1_7f9[keysym - 0x7a1];
+    else if (keysym > 0x8a3 && keysym < 0x8ff)
+        return keysym_to_unicode_8a4_8fe[keysym - 0x8a4];
+    else if (keysym > 0x9de && keysym < 0x9f9)
+        return keysym_to_unicode_9df_9f8[keysym - 0x9df];
+    else if (keysym > 0xaa0 && keysym < 0xaff)
+        return keysym_to_unicode_aa1_afe[keysym - 0xaa1];
+    else if (keysym > 0xcde && keysym < 0xcfb)
+        return keysym_to_unicode_cdf_cfa[keysym - 0xcdf];
+    else if (keysym > 0xda0 && keysym < 0xdfa)
+        return keysym_to_unicode_da1_df9[keysym - 0xda1];
+    else if (keysym > 0xe9f && keysym < 0xf00)
+        return keysym_to_unicode_ea0_eff[keysym - 0xea0];
+    else if (keysym > 0x12a0 && keysym < 0x12ff)
+        return keysym_to_unicode_12a1_12fe[keysym - 0x12a1];
+    else if (keysym > 0x13bb && keysym < 0x13bf)
+        return keysym_to_unicode_13bc_13be[keysym - 0x13bc];
+    else if (keysym > 0x14a0 && keysym < 0x1500)
+        return keysym_to_unicode_14a1_14ff[keysym - 0x14a1];
+    else if (keysym > 0x15cf && keysym < 0x15f7)
+        return keysym_to_unicode_15d0_15f6[keysym - 0x15d0];
+    else if (keysym > 0x169f && keysym < 0x16f7)
+        return keysym_to_unicode_16a0_16f6[keysym - 0x16a0];
+    else if (keysym > 0x1e9e && keysym < 0x1f00)
+        return keysym_to_unicode_1e9f_1eff[keysym - 0x1e9f];
+    else if (keysym > 0x209f && keysym < 0x20ad)
+        return keysym_to_unicode_20a0_20ac[keysym - 0x20a0];
+    else
+        return 0;
+}
+
 /*
  * Local variables:
  *  c-indent-level: 4

Reply via email to