From 2f92f29d2a761d24d66141b48f92e79111beac9a Mon Sep 17 00:00:00 2001 From: Jon Harper Date: Sat, 9 Jan 2016 19:06:26 +0100 Subject: [PATCH] x11 xlib, use Xutf8LookupString instead of XwcLookupString 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 | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/basis/x11/xim/xim.factor b/basis/x11/xim/xim.factor index 5fd42fd77e..b02d853f10 100644 --- a/basis/x11/xim/xim.factor +++ b/basis/x11/xim/xim.factor @@ -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 keybuf set + buf-size keybuf set 0 KeySym 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 - XwcLookupString + Xutf8LookupString finish-lookup ] with-scope ;