~ubuntu-branches/ubuntu/lucid/libx11/lucid

« back to all changes in this revision

Viewing changes to debian/patches/022_Thai_xim_surr_conv.diff

  • Committer: Bazaar Package Importer
  • Author(s): Timo Aaltonen
  • Date: 2009-01-17 16:34:54 UTC
  • mfrom: (1.1.7 upstream)
  • Revision ID: james.westby@ubuntu.com-20090117163454-gaey3cd32xyavueo
Tags: 2:1.1.99.2-1build1
Fakesync with Debian, all previous Ubuntu changes are included
in the new upstream release.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
Index: libx11-1.1.4/modules/im/ximcp/imThaiFlt.c
2
 
===================================================================
3
 
--- libx11-1.1.4.orig/modules/im/ximcp/imThaiFlt.c      2008-07-17 21:15:44.000000000 +0700
4
 
+++ libx11-1.1.4/modules/im/ximcp/imThaiFlt.c   2008-07-17 21:39:48.000000000 +0700
5
 
@@ -560,13 +560,37 @@
6
 
         {
7
 
             c = 0;
8
 
         } else {
9
 
+            Xim     im;
10
 
+            XlcConv conv;
11
 
+            int     from_left;
12
 
+            int     to_left;
13
 
+            char   *from_buf;
14
 
+            char   *to_buf;
15
 
+
16
 
+            im = (Xim) XIMOfIC((XIC)ic);
17
 
             if (screc.text->encoding_is_wchar) {
18
 
-                c = ucs2tis(screc.text->string.wcs[0]);
19
 
-                XFree(screc.text->string.wcs);
20
 
+                conv = _XlcOpenConverter(im->core.lcd, XlcNWideChar,
21
 
+                                         im->core.lcd, XlcNCharSet);
22
 
+                from_buf = (char *) screc.text->string.wcs;
23
 
+                from_left = screc.text->length * sizeof(wchar_t);
24
 
             } else {
25
 
-                c = screc.text->string.mbs[0];
26
 
-                XFree(screc.text->string.mbs);
27
 
+                conv = _XlcOpenConverter(im->core.lcd, XlcNMultiByte,
28
 
+                                         im->core.lcd, XlcNCharSet);
29
 
+                from_buf = screc.text->string.mbs;
30
 
+                from_left = screc.text->length;
31
 
+            }
32
 
+            to_buf = (char *)&c;
33
 
+            to_left = 1;
34
 
+
35
 
+            _XlcResetConverter(conv);
36
 
+            if (_XlcConvert(conv, (XPointer *)&from_buf, &from_left,
37
 
+                            (XPointer *)&to_buf, &to_left, NULL, 0) < 0)
38
 
+            {
39
 
+                c = (unsigned char) b->mb[b->tree[(ic)->private.local.context].mb];
40
 
             }
41
 
+            _XlcCloseConverter(conv);
42
 
+
43
 
+            XFree(screc.text->string.mbs);
44
 
         }
45
 
         XFree(screc.text);
46
 
         return c;