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 everywheredb4
parent
7b28949331
commit
2f92f29d2a
|
@ -3,8 +3,7 @@
|
||||||
USING: alien alien.c-types alien.data alien.strings arrays
|
USING: alien alien.c-types alien.data alien.strings arrays
|
||||||
byte-arrays hashtables io io.encodings.string kernel math
|
byte-arrays hashtables io io.encodings.string kernel math
|
||||||
namespaces sequences strings continuations x11 x11.xlib
|
namespaces sequences strings continuations x11 x11.xlib
|
||||||
specialized-arrays accessors io.encodings.utf16n ;
|
accessors io.encodings.utf8 ;
|
||||||
SPECIALIZED-ARRAY: uint
|
|
||||||
IN: x11.xim
|
IN: x11.xim
|
||||||
|
|
||||||
SYMBOL: xim
|
SYMBOL: xim
|
||||||
|
@ -41,17 +40,17 @@ SYMBOL: keybuf
|
||||||
SYMBOL: keysym
|
SYMBOL: keysym
|
||||||
|
|
||||||
: prepare-lookup ( -- )
|
: prepare-lookup ( -- )
|
||||||
buf-size uint <c-array> keybuf set
|
buf-size <byte-array> keybuf set
|
||||||
0 KeySym <ref> keysym set ;
|
0 KeySym <ref> keysym set ;
|
||||||
|
|
||||||
: finish-lookup ( len -- string keysym )
|
: finish-lookup ( len -- string keysym )
|
||||||
keybuf get swap 2 * head utf16n decode
|
keybuf get swap head utf8 decode
|
||||||
keysym get *KeySym ;
|
keysym get *KeySym ;
|
||||||
|
|
||||||
: lookup-string ( event xic -- string keysym )
|
: lookup-string ( event xic -- string keysym )
|
||||||
[
|
[
|
||||||
prepare-lookup
|
prepare-lookup
|
||||||
swap keybuf get buf-size keysym get 0 int <ref>
|
swap keybuf get buf-size keysym get 0 int <ref>
|
||||||
XwcLookupString
|
Xutf8LookupString
|
||||||
finish-lookup
|
finish-lookup
|
||||||
] with-scope ;
|
] with-scope ;
|
||||||
|
|
Loading…
Reference in New Issue