Patch from Yoshinori Tahara
parent
81ac2f77f7
commit
f7b22faf0e
|
@ -7,9 +7,15 @@ IN: x11.xim
|
||||||
|
|
||||||
SYMBOL: xim
|
SYMBOL: xim
|
||||||
|
|
||||||
|
: (init-xim) ( classname medifier -- im )
|
||||||
|
XSetLocaleModifiers [ "XSetLocaleModifiers() failed" throw ] unless
|
||||||
|
dpy get f rot dup XOpenIM ;
|
||||||
|
|
||||||
: init-xim ( classname -- )
|
: init-xim ( classname -- )
|
||||||
dpy get f rot dup XOpenIM
|
dup "" (init-xim)
|
||||||
[ "XOpenIM() failed" throw ] unless* xim set-global ;
|
[ nip ]
|
||||||
|
[ "@im=none" (init-xim) [ "XOpenIM() failed" throw ] unless* ] if*
|
||||||
|
xim set-global ;
|
||||||
|
|
||||||
: close-xim ( -- )
|
: close-xim ( -- )
|
||||||
xim get-global XCloseIM drop f xim set-global ;
|
xim get-global XCloseIM drop f xim set-global ;
|
||||||
|
@ -32,11 +38,11 @@ SYMBOL: keybuf
|
||||||
SYMBOL: keysym
|
SYMBOL: keysym
|
||||||
|
|
||||||
: prepare-lookup ( -- )
|
: prepare-lookup ( -- )
|
||||||
buf-size "ulong" <c-array> keybuf set
|
buf-size "uint" <c-array> keybuf set
|
||||||
0 <KeySym> keysym set ;
|
0 <KeySym> keysym set ;
|
||||||
|
|
||||||
: finish-lookup ( len -- string keysym )
|
: finish-lookup ( len -- string keysym )
|
||||||
keybuf get swap c-ulong-array> >string
|
keybuf get swap c-uint-array> >string
|
||||||
keysym get *KeySym ;
|
keysym get *KeySym ;
|
||||||
|
|
||||||
: lookup-string ( event xic -- string keysym )
|
: lookup-string ( event xic -- string keysym )
|
||||||
|
|
|
@ -1339,10 +1339,28 @@ FUNCTION: int XwcLookupString ( XIC ic, XKeyPressedEvent* event, ulong* buffer_r
|
||||||
|
|
||||||
FUNCTION: int Xutf8LookupString ( XIC ic, XKeyPressedEvent* event, char* buffer_return, int bytes_buffer, KeySym* keysym_return, Status* status_return ) ;
|
FUNCTION: int Xutf8LookupString ( XIC ic, XKeyPressedEvent* event, char* buffer_return, int bytes_buffer, KeySym* keysym_return, Status* status_return ) ;
|
||||||
|
|
||||||
|
! !!! category of setlocale
|
||||||
|
: LC_ALL 0 ; inline
|
||||||
|
: LC_COLLATE 1 ; inline
|
||||||
|
: LC_CTYPE 2 ; inline
|
||||||
|
: LC_MONETARY 3 ; inline
|
||||||
|
: LC_NUMERIC 4 ; inline
|
||||||
|
: LC_TIME 5 ; inline
|
||||||
|
|
||||||
|
FUNCTION: char* setlocale ( int category, char* name ) ;
|
||||||
|
|
||||||
|
FUNCTION: Bool XSupportsLocale ( ) ;
|
||||||
|
|
||||||
|
FUNCTION: char* XSetLocaleModifiers ( char* modifier_list ) ;
|
||||||
|
|
||||||
SYMBOL: dpy
|
SYMBOL: dpy
|
||||||
SYMBOL: scr
|
SYMBOL: scr
|
||||||
SYMBOL: root
|
SYMBOL: root
|
||||||
|
|
||||||
|
: init-locale ( -- )
|
||||||
|
LC_ALL "" setlocale [ "setlocale() failed" throw ] unless
|
||||||
|
XSupportsLocale [ "XSupportsLocale() failed" throw ] unless ;
|
||||||
|
|
||||||
: flush-dpy ( -- ) dpy get XFlush drop ;
|
: flush-dpy ( -- ) dpy get XFlush drop ;
|
||||||
|
|
||||||
: x-atom ( string -- atom ) dpy get swap 0 XInternAtom ;
|
: x-atom ( string -- atom ) dpy get swap 0 XInternAtom ;
|
||||||
|
@ -1353,6 +1371,7 @@ SYMBOL: root
|
||||||
] unless* ;
|
] unless* ;
|
||||||
|
|
||||||
: initialize-x ( display-string -- )
|
: initialize-x ( display-string -- )
|
||||||
|
init-locale
|
||||||
dup [ string>char-alien ] when
|
dup [ string>char-alien ] when
|
||||||
XOpenDisplay check-display dpy set-global
|
XOpenDisplay check-display dpy set-global
|
||||||
dpy get XDefaultScreen scr set-global
|
dpy get XDefaultScreen scr set-global
|
||||||
|
|
Loading…
Reference in New Issue