Fix X11 UI backend for char* FFI change

slava 2006-08-01 23:25:12 +00:00
parent a7039a8e0d
commit 477fb4db7a
5 changed files with 7 additions and 10 deletions

View File

@ -58,7 +58,7 @@ SYMBOL: height
CWBorderPixel CWColormap bitor CWEventMask bitor swap ; CWBorderPixel CWColormap bitor CWEventMask bitor swap ;
: make-display ( display-num -- display ) : make-display ( display-num -- display )
XOpenDisplay dup dpy set ; dup [ <c-string> ] when XOpenDisplay dup dpy set ;
: make-screen ( display -- screen ) : make-screen ( display -- screen )
XDefaultScreen dup screen set ; XDefaultScreen dup screen set ;

View File

@ -1,5 +1,4 @@
USING: namespaces kernel words compiler math arrays strings alien sequences io USING: alien namespaces kernel words compiler math arrays strings alien sequences io prettyprint x11 rectangle ;
prettyprint x11 rectangle ;
IN: x IN: x
@ -500,7 +499,7 @@ nip ;
[ swap gcontext set call ] with-scope ; inline [ swap gcontext set call ] with-scope ; inline
: initialize-x ( display-string -- ) : initialize-x ( display-string -- )
XOpenDisplay dpy set dup [ string>char-alien ] when XOpenDisplay dpy set
dpy get XDefaultScreen scr set dpy get XDefaultScreen scr set
dpy get scr get XRootWindow root set dpy get scr get XRootWindow root set
dpy get scr get XBlackPixel black-pixel set dpy get scr get XBlackPixel black-pixel set
@ -589,7 +588,7 @@ dpy get win get "XWindowAttributes" <c-object> XGetWindowAttributes 0 = not ;
swap >array [ swap char-nth ] map-with >string ; swap >array [ swap char-nth ] map-with >string ;
: lookup-string ( event -- string ) : lookup-string ( event -- string )
10 "char" <c-array> dup >r 10 0 <alien> 0 <alien> XLookupString r> 10 "char" <c-array> dup >r 10 f f XLookupString r>
char-array>string ; char-array>string ;
: send-client-message ( atom x -- ) : send-client-message ( atom x -- )

View File

@ -19,9 +19,6 @@ C: alien-invoke make-node ;
TUPLE: alien-invoke-error library symbol ; TUPLE: alien-invoke-error library symbol ;
M: alien-invoke-error summary ( error -- )
drop "Words calling ``alien-invoke'' cannot run in the interpreter. Compile the caller word and try again." ;
: alien-invoke ( ... return library function parameters -- ... ) : alien-invoke ( ... return library function parameters -- ... )
pick pick <alien-invoke-error> throw ; pick pick <alien-invoke-error> throw ;

View File

@ -22,6 +22,7 @@ SYMBOL: root
[ "Cannot connect to X server - check $DISPLAY" throw ] unless* ; [ "Cannot connect to X server - check $DISPLAY" throw ] unless* ;
: initialize-x ( display-string -- ) : initialize-x ( display-string -- )
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
dpy get scr get XRootWindow root set-global ; dpy get scr get XRootWindow root set-global ;

View File

@ -62,7 +62,7 @@ TYPEDEF: void* Atom**
! 2 - Display Functions ! 2 - Display Functions
! !
FUNCTION: Display* XOpenDisplay ( char* display_name ) ; FUNCTION: Display* XOpenDisplay ( void* display_name ) ;
! 2.2 Obtaining Information about the Display, Image Formats, or Screens ! 2.2 Obtaining Information about the Display, Image Formats, or Screens
@ -1175,7 +1175,7 @@ FUNCTION: KeySym XLookupKeysym ( XKeyEvent* key_event, int index ) ;
FUNCTION: int XLookupString ( FUNCTION: int XLookupString (
XKeyEvent* event_struct, XKeyEvent* event_struct,
char* buffer_return, void* buffer_return,
int bytes_buffer, int bytes_buffer,
KeySym* keysym_return, KeySym* keysym_return,
XComposeStatus* status_in_out ) ; XComposeStatus* status_in_out ) ;