]> gitweb.factorcode.org Git - factor.git/commitdiff
x11 xlib, use Xutf8LookupString instead of XwcLookupString
authorJon Harper <jon.harper87@gmail.com>
Sat, 9 Jan 2016 18:06:26 +0000 (19:06 +0100)
committerJon Harper <jon.harper87@gmail.com>
Sat, 9 Jan 2016 18:28:33 +0000 (19:28 +0100)
XwcLookupString uses a locale dependant encoding, but was always
decoded using utf16. On my system, it was not utf16 that was used.
Xutf8LookupString always uses utf8 so it should work everywhere

basis/x11/xim/xim.factor

index 5fd42fd77efedfb5593a6127cfe3fd476e56ce8a..b02d853f10e3f38489c6e5090bdf9e7765dc5c33 100644 (file)
@@ -3,8 +3,7 @@
 USING: alien alien.c-types alien.data alien.strings arrays
 byte-arrays hashtables io io.encodings.string kernel math
 namespaces sequences strings continuations x11 x11.xlib
-specialized-arrays accessors io.encodings.utf16n ;
-SPECIALIZED-ARRAY: uint
+accessors io.encodings.utf8 ;
 IN: x11.xim
 
 SYMBOL: xim
@@ -41,17 +40,17 @@ SYMBOL: keybuf
 SYMBOL: keysym
 
 : prepare-lookup ( -- )
-    buf-size uint <c-array> keybuf set
+    buf-size <byte-array> keybuf set
     0 KeySym <ref> keysym set ;
 
 : finish-lookup ( len -- string keysym )
-    keybuf get swap 2 * head utf16n decode
+    keybuf get swap head utf8 decode
     keysym get *KeySym ;
 
 : lookup-string ( event xic -- string keysym )
     [
         prepare-lookup
         swap keybuf get buf-size keysym get 0 int <ref>
-        XwcLookupString
+        Xutf8LookupString
         finish-lookup
     ] with-scope ;