Patch from Yoshinori Tahara
parent
81ac2f77f7
commit
f7b22faf0e
|
@ -7,9 +7,15 @@ IN: x11.xim
|
|||
|
||||
SYMBOL: xim
|
||||
|
||||
: (init-xim) ( classname medifier -- im )
|
||||
XSetLocaleModifiers [ "XSetLocaleModifiers() failed" throw ] unless
|
||||
dpy get f rot dup XOpenIM ;
|
||||
|
||||
: init-xim ( classname -- )
|
||||
dpy get f rot dup XOpenIM
|
||||
[ "XOpenIM() failed" throw ] unless* xim set-global ;
|
||||
dup "" (init-xim)
|
||||
[ nip ]
|
||||
[ "@im=none" (init-xim) [ "XOpenIM() failed" throw ] unless* ] if*
|
||||
xim set-global ;
|
||||
|
||||
: close-xim ( -- )
|
||||
xim get-global XCloseIM drop f xim set-global ;
|
||||
|
@ -32,11 +38,11 @@ SYMBOL: keybuf
|
|||
SYMBOL: keysym
|
||||
|
||||
: prepare-lookup ( -- )
|
||||
buf-size "ulong" <c-array> keybuf set
|
||||
buf-size "uint" <c-array> keybuf set
|
||||
0 <KeySym> keysym set ;
|
||||
|
||||
: finish-lookup ( len -- string keysym )
|
||||
keybuf get swap c-ulong-array> >string
|
||||
keybuf get swap c-uint-array> >string
|
||||
keysym get *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 ) ;
|
||||
|
||||
! !!! 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: scr
|
||||
SYMBOL: root
|
||||
|
||||
: init-locale ( -- )
|
||||
LC_ALL "" setlocale [ "setlocale() failed" throw ] unless
|
||||
XSupportsLocale [ "XSupportsLocale() failed" throw ] unless ;
|
||||
|
||||
: flush-dpy ( -- ) dpy get XFlush drop ;
|
||||
|
||||
: x-atom ( string -- atom ) dpy get swap 0 XInternAtom ;
|
||||
|
@ -1353,6 +1371,7 @@ SYMBOL: root
|
|||
] unless* ;
|
||||
|
||||
: initialize-x ( display-string -- )
|
||||
init-locale
|
||||
dup [ string>char-alien ] when
|
||||
XOpenDisplay check-display dpy set-global
|
||||
dpy get XDefaultScreen scr set-global
|
||||
|
|
Loading…
Reference in New Issue