diff --git a/contrib/x11/examples/lesson2.factor b/contrib/x11/examples/lesson2.factor index 6b070cab38..e81d72c55e 100644 --- a/contrib/x11/examples/lesson2.factor +++ b/contrib/x11/examples/lesson2.factor @@ -58,7 +58,7 @@ SYMBOL: height CWBorderPixel CWColormap bitor CWEventMask bitor swap ; : make-display ( display-num -- display ) - XOpenDisplay dup dpy set ; + dup [ ] when XOpenDisplay dup dpy set ; : make-screen ( display -- screen ) XDefaultScreen dup screen set ; diff --git a/contrib/x11/x.factor b/contrib/x11/x.factor index 66a18124c6..23b04d5a75 100644 --- a/contrib/x11/x.factor +++ b/contrib/x11/x.factor @@ -1,5 +1,4 @@ -USING: namespaces kernel words compiler math arrays strings alien sequences io -prettyprint x11 rectangle ; +USING: alien namespaces kernel words compiler math arrays strings alien sequences io prettyprint x11 rectangle ; IN: x @@ -500,7 +499,7 @@ nip ; [ swap gcontext set call ] with-scope ; inline : initialize-x ( display-string -- ) - XOpenDisplay dpy set + dup [ string>char-alien ] when XOpenDisplay dpy set dpy get XDefaultScreen scr set dpy get scr get XRootWindow root set dpy get scr get XBlackPixel black-pixel set @@ -589,7 +588,7 @@ dpy get win get "XWindowAttributes" XGetWindowAttributes 0 = not ; swap >array [ swap char-nth ] map-with >string ; : lookup-string ( event -- string ) -10 "char" dup >r 10 0 0 XLookupString r> +10 "char" dup >r 10 f f XLookupString r> char-array>string ; : send-client-message ( atom x -- ) diff --git a/library/compiler/alien/alien-invoke.factor b/library/compiler/alien/alien-invoke.factor index 65775a87e3..35e284ac19 100644 --- a/library/compiler/alien/alien-invoke.factor +++ b/library/compiler/alien/alien-invoke.factor @@ -19,9 +19,6 @@ C: alien-invoke make-node ; 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 -- ... ) pick pick throw ; diff --git a/library/ui/x11/utilities.factor b/library/ui/x11/utilities.factor index e952566691..30e5033608 100644 --- a/library/ui/x11/utilities.factor +++ b/library/ui/x11/utilities.factor @@ -22,6 +22,7 @@ SYMBOL: root [ "Cannot connect to X server - check $DISPLAY" throw ] unless* ; : initialize-x ( display-string -- ) + dup [ string>char-alien ] when XOpenDisplay check-display dpy set-global dpy get XDefaultScreen scr set-global dpy get scr get XRootWindow root set-global ; diff --git a/library/ui/x11/xlib.factor b/library/ui/x11/xlib.factor index 9bc1d0acf0..050da43189 100644 --- a/library/ui/x11/xlib.factor +++ b/library/ui/x11/xlib.factor @@ -62,7 +62,7 @@ TYPEDEF: void* Atom** ! 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 @@ -1175,7 +1175,7 @@ FUNCTION: KeySym XLookupKeysym ( XKeyEvent* key_event, int index ) ; FUNCTION: int XLookupString ( XKeyEvent* event_struct, - char* buffer_return, + void* buffer_return, int bytes_buffer, KeySym* keysym_return, XComposeStatus* status_in_out ) ;