Bug#520509: libx11-data: Thai XIM not turned on by default due to excessive Compose files
package libx11
tags 520509 + patch
thanks
On Sat, Mar 21, 2009 at 8:25 AM, Theppitak Karoonboonyanan
<thep@linux.thai.net> wrote:
> Let me elaborate this a little bit.
Summarized patches:
Minimum:
- 020_th_TH_iso8859-11_ct.diff: Fixes conversion which
blocks SCIM.
- 023_Thai_remove_Compose.diff: Remove Compose, to
allow Thai XIM as default for X apps.
Medium seriousness:
- 022_Thai_xim_surr_conv.diff: Fixes surrounding text
retrieval for Thai XIM (good for GTK+, needed for KDE 3).
Minor:
- 021_Thai_xim_num_caps.diff: Makes Thai XIM work when
NumLock/CapsLock is on.
--
Theppitak Karoonboonyanan
http://linux.thai.net/~thep/
Index: libx11-1.1.5/nls/th_TH.UTF-8/XLC_LOCALE.pre
===================================================================
--- libx11-1.1.5.orig/nls/th_TH.UTF-8/XLC_LOCALE.pre 2007-10-13 20:24:34.000000000 +0700
+++ libx11-1.1.5/nls/th_TH.UTF-8/XLC_LOCALE.pre 2009-02-12 16:54:36.000000000 +0700
@@ -27,8 +27,8 @@
}
XCOMM fs1 class (Thai)
fs2 {
- charset TIS620-0:GR
- font TIS620-0:GR
+ charset ISO8859-11:GR
+ font ISO8859-11:GR
}
END XLC_FONTSET
@@ -69,7 +69,13 @@
length 1
wc_encoding \x30000000
- ct_encoding TIS620-0:GR
+ ct_encoding ISO8859-11:GR
+}
+
+XCOMM cs2 class
+cs2 {
+ side none
+ ct_encoding ISO10646-1
}
END XLC_XLOCALE
Index: libx11-1.1.5/nls/th_TH/XLC_LOCALE.pre
===================================================================
--- libx11-1.1.5.orig/nls/th_TH/XLC_LOCALE.pre 2007-10-13 20:24:34.000000000 +0700
+++ libx11-1.1.5/nls/th_TH/XLC_LOCALE.pre 2009-02-12 16:51:30.000000000 +0700
@@ -16,8 +16,8 @@
}
XCOMM fs1 class (Thai)
fs1 {
- charset TIS620-0:GR
- font TIS620-0:GR
+ charset ISO8859-11:GR
+ font ISO8859-11:GR
}
END XLC_FONTSET
@@ -61,7 +61,7 @@
#else
wc_encoding \x00008080
#endif
- ct_encoding TIS620-0:GR
+ ct_encoding ISO8859-11:GR
}
END XLC_XLOCALE
Index: libx11-1.2/nls/compose.dir.pre
===================================================================
--- libx11-1.2.orig/nls/compose.dir.pre 2009-03-20 22:38:58.000000000 +0700
+++ libx11-1.2/nls/compose.dir.pre 2009-03-20 22:40:50.000000000 +0700
@@ -483,7 +483,8 @@
en_US.UTF-8/Compose: ta_IN.UTF-8
en_US.UTF-8/Compose: te_IN.UTF-8
en_US.UTF-8/Compose: tg_TJ.UTF-8
-en_US.UTF-8/Compose: th_TH.UTF-8
+XCOMM Remove Compose for th_TH.UTF-8, as it has XIM support
+XCOMM en_US.UTF-8/Compose: th_TH.UTF-8
en_US.UTF-8/Compose: ti_ER.UTF-8
en_US.UTF-8/Compose: ti_ET.UTF-8
en_US.UTF-8/Compose: tig_ER.UTF-8
Index: libx11-1.1.4/modules/im/ximcp/imThaiFlt.c
===================================================================
--- libx11-1.1.4.orig/modules/im/ximcp/imThaiFlt.c 2008-07-17 21:15:44.000000000 +0700
+++ libx11-1.1.4/modules/im/ximcp/imThaiFlt.c 2008-07-17 21:39:48.000000000 +0700
@@ -560,13 +560,37 @@
{
c = 0;
} else {
+ Xim im;
+ XlcConv conv;
+ int from_left;
+ int to_left;
+ char *from_buf;
+ char *to_buf;
+
+ im = (Xim) XIMOfIC((XIC)ic);
if (screc.text->encoding_is_wchar) {
- c = ucs2tis(screc.text->string.wcs[0]);
- XFree(screc.text->string.wcs);
+ conv = _XlcOpenConverter(im->core.lcd, XlcNWideChar,
+ im->core.lcd, XlcNCharSet);
+ from_buf = (char *) screc.text->string.wcs;
+ from_left = screc.text->length * sizeof(wchar_t);
} else {
- c = screc.text->string.mbs[0];
- XFree(screc.text->string.mbs);
+ conv = _XlcOpenConverter(im->core.lcd, XlcNMultiByte,
+ im->core.lcd, XlcNCharSet);
+ from_buf = screc.text->string.mbs;
+ from_left = screc.text->length;
+ }
+ to_buf = (char *)&c;
+ to_left = 1;
+
+ _XlcResetConverter(conv);
+ if (_XlcConvert(conv, (XPointer *)&from_buf, &from_left,
+ (XPointer *)&to_buf, &to_left, NULL, 0) < 0)
+ {
+ c = (unsigned char) b->mb[b->tree[(ic)->private.local.context].mb];
}
+ _XlcCloseConverter(conv);
+
+ XFree(screc.text->string.mbs);
}
XFree(screc.text);
return c;
Index: libx11-1.1.4/modules/im/ximcp/imThaiFlt.c
===================================================================
--- libx11-1.1.4.orig/modules/im/ximcp/imThaiFlt.c 2008-07-14 18:13:20.000000000 +0700
+++ libx11-1.1.4/modules/im/ximcp/imThaiFlt.c 2008-07-14 19:00:10.000000000 +0700
@@ -1236,6 +1236,22 @@
return True;
}
+Private unsigned
+NumLockMask(Display *d)
+{
+ int i;
+ XModifierKeymap *map = XGetModifierMapping (d);
+ KeyCode numlock_keycode = XKeysymToKeycode (d, XK_Num_Lock);
+ if (numlock_keycode == NoSymbol)
+ return 0;
+
+ for (i = 0; i < 8; i++) {
+ if (map->modifiermap[map->max_keypermod * i] == numlock_keycode)
+ return 1 << i;
+ }
+ return 0;
+}
+
/*
* Filter function for TACTIS
*/
@@ -1271,7 +1287,7 @@
XwcLookupString((XIC)ic, &ev->xkey, wbuf, sizeof(wbuf) / sizeof(wbuf[0]),
&symbol, NULL);
- if ((ev->xkey.state & (AllMods & ~ShiftMask)) ||
+ if ((ev->xkey.state & (AllMods & ~(ShiftMask|LockMask|NumLockMask(d)))) ||
((symbol >> 8 == 0xFF) &&
((XK_BackSpace <= symbol && symbol <= XK_Clear) ||
(symbol == XK_Return) ||
Reply to: