Merge branch 'x11_event_loop'

db4
Slava Pestov 2009-04-18 03:28:36 -05:00
commit 6427360309
17 changed files with 266 additions and 208 deletions

View File

@ -1,7 +1,7 @@
! Copyright (C) 2008 Slava Pestov. ! Copyright (C) 2008, 2009 Slava Pestov.
! See http://factorcode.org/license.txt for BSD license. ! See http://factorcode.org/license.txt for BSD license.
USING: alien alien.c-types arrays assocs effects grouping kernel USING: alien alien.c-types arrays assocs effects grouping kernel
parser sequences splitting words fry locals ; parser sequences splitting words fry locals lexer namespaces ;
IN: alien.parser IN: alien.parser
: parse-arglist ( parameters return -- types effect ) : parse-arglist ( parameters return -- types effect )
@ -12,8 +12,15 @@ IN: alien.parser
: function-quot ( return library function types -- quot ) : function-quot ( return library function types -- quot )
'[ _ _ _ _ alien-invoke ] ; '[ _ _ _ _ alien-invoke ] ;
:: define-function ( return library function parameters -- ) :: make-function ( return library function parameters -- word quot effect )
function create-in dup reset-generic function create-in dup reset-generic
return library function return library function
parameters return parse-arglist [ function-quot ] dip parameters return parse-arglist [ function-quot ] dip ;
define-declared ;
: (FUNCTION:) ( -- word quot effect )
scan "c-library" get scan ";" parse-tokens
[ "()" subseq? not ] filter
make-function ;
: define-function ( return library function parameters -- )
make-function define-declared ;

View File

@ -16,9 +16,7 @@ SYNTAX: BAD-ALIEN <bad-alien> parsed ;
SYNTAX: LIBRARY: scan "c-library" set ; SYNTAX: LIBRARY: scan "c-library" set ;
SYNTAX: FUNCTION: SYNTAX: FUNCTION:
scan "c-library" get scan ";" parse-tokens (FUNCTION:) define-declared ;
[ "()" subseq? not ] filter
define-function ;
SYNTAX: TYPEDEF: SYNTAX: TYPEDEF:
scan scan typedef ; scan scan typedef ;

View File

@ -3,11 +3,11 @@
USING: accessors alien alien.c-types arrays ui ui.private ui.gadgets USING: accessors alien alien.c-types arrays ui ui.private ui.gadgets
ui.gadgets.private ui.gestures ui.backend ui.clipboards ui.gadgets.private ui.gestures ui.backend ui.clipboards
ui.gadgets.worlds ui.render ui.event-loop assocs kernel math ui.gadgets.worlds ui.render ui.event-loop assocs kernel math
namespaces opengl sequences strings x11.xlib x11.events x11.xim namespaces opengl sequences strings x11 x11.xlib x11.events x11.xim
x11.glx x11.clipboard x11.constants x11.windows io.encodings.string x11.glx x11.clipboard x11.constants x11.windows x11.io
io.encodings.ascii io.encodings.utf8 combinators command-line io.encodings.string io.encodings.ascii io.encodings.utf8 combinators
math.vectors classes.tuple opengl.gl threads math.rectangles command-line math.vectors classes.tuple opengl.gl threads
environment ascii ; math.rectangles environment ascii ;
IN: ui.backend.x11 IN: ui.backend.x11
SINGLETON: x11-ui-backend SINGLETON: x11-ui-backend
@ -196,7 +196,7 @@ M: world client-event
QueuedAfterFlush events-queued 0 > [ QueuedAfterFlush events-queued 0 > [
next-event dup next-event dup
None XFilterEvent 0 = [ drop wait-event ] unless None XFilterEvent 0 = [ drop wait-event ] unless
] [ ui-wait wait-event ] if ; ] [ wait-for-display wait-event ] if ;
M: x11-ui-backend do-events M: x11-ui-backend do-events
wait-event dup XAnyEvent-window window dup wait-event dup XAnyEvent-window window dup

2
basis/x11/authors.txt Normal file
View File

@ -0,0 +1,2 @@
Eduardo Cavazos
Slava Pestov

View File

@ -2,7 +2,7 @@
! See http://factorcode.org/license.txt for BSD license. ! See http://factorcode.org/license.txt for BSD license.
USING: alien alien.c-types alien.strings alien.syntax arrays USING: alien alien.c-types alien.strings alien.syntax arrays
kernel math namespaces sequences io.encodings.string kernel math namespaces sequences io.encodings.string
io.encodings.utf8 io.encodings.ascii x11.xlib x11.constants io.encodings.utf8 io.encodings.ascii x11 x11.xlib x11.constants
specialized-arrays.int accessors ; specialized-arrays.int accessors ;
IN: x11.clipboard IN: x11.clipboard

View File

@ -2,7 +2,7 @@
! See http://factorcode.org/license.txt for BSD license. ! See http://factorcode.org/license.txt for BSD license.
USING: alien alien.c-types arrays hashtables io kernel math USING: alien alien.c-types arrays hashtables io kernel math
math.order namespaces prettyprint sequences strings combinators math.order namespaces prettyprint sequences strings combinators
x11.xlib ; x11 x11.xlib ;
IN: x11.events IN: x11.events
GENERIC: expose-event ( event window -- ) GENERIC: expose-event ( event window -- )

View File

@ -2,8 +2,9 @@
! See http://factorcode.org/license.txt for BSD license. ! See http://factorcode.org/license.txt for BSD license.
! !
! based on glx.h from xfree86, and some of glxtokens.h ! based on glx.h from xfree86, and some of glxtokens.h
USING: alien alien.c-types alien.syntax x11.xlib namespaces make USING: alien alien.c-types alien.syntax x11 x11.xlib x11.syntax
kernel sequences parser words specialized-arrays.int accessors ; namespaces make kernel sequences parser words specialized-arrays.int
accessors ;
IN: x11.glx IN: x11.glx
LIBRARY: glx LIBRARY: glx
@ -36,52 +37,52 @@ TYPEDEF: XID GLXFBConfigID
TYPEDEF: void* GLXContext ! typedef struct __GLXcontextRec *GLXContext; TYPEDEF: void* GLXContext ! typedef struct __GLXcontextRec *GLXContext;
TYPEDEF: void* GLXFBConfig ! typedef struct __GLXFBConfigRec *GLXFBConfig; TYPEDEF: void* GLXFBConfig ! typedef struct __GLXFBConfigRec *GLXFBConfig;
FUNCTION: XVisualInfo* glXChooseVisual ( Display* dpy, int screen, int* attribList ) ; X-FUNCTION: XVisualInfo* glXChooseVisual ( Display* dpy, int screen, int* attribList ) ;
FUNCTION: void glXCopyContext ( Display* dpy, GLXContext src, GLXContext dst, ulong mask ) ; X-FUNCTION: void glXCopyContext ( Display* dpy, GLXContext src, GLXContext dst, ulong mask ) ;
FUNCTION: GLXContext glXCreateContext ( Display* dpy, XVisualInfo* vis, GLXContext shareList, bool direct ) ; X-FUNCTION: GLXContext glXCreateContext ( Display* dpy, XVisualInfo* vis, GLXContext shareList, bool direct ) ;
FUNCTION: GLXPixmap glXCreateGLXPixmap ( Display* dpy, XVisualInfo* vis, Pixmap pixmap ) ; X-FUNCTION: GLXPixmap glXCreateGLXPixmap ( Display* dpy, XVisualInfo* vis, Pixmap pixmap ) ;
FUNCTION: void glXDestroyContext ( Display* dpy, GLXContext ctx ) ; X-FUNCTION: void glXDestroyContext ( Display* dpy, GLXContext ctx ) ;
FUNCTION: void glXDestroyGLXPixmap ( Display* dpy, GLXPixmap pix ) ; X-FUNCTION: void glXDestroyGLXPixmap ( Display* dpy, GLXPixmap pix ) ;
FUNCTION: int glXGetConfig ( Display* dpy, XVisualInfo* vis, int attrib, int* value ) ; X-FUNCTION: int glXGetConfig ( Display* dpy, XVisualInfo* vis, int attrib, int* value ) ;
FUNCTION: GLXContext glXGetCurrentContext ( ) ; X-FUNCTION: GLXContext glXGetCurrentContext ( ) ;
FUNCTION: GLXDrawable glXGetCurrentDrawable ( ) ; X-FUNCTION: GLXDrawable glXGetCurrentDrawable ( ) ;
FUNCTION: bool glXIsDirect ( Display* dpy, GLXContext ctx ) ; X-FUNCTION: bool glXIsDirect ( Display* dpy, GLXContext ctx ) ;
FUNCTION: bool glXMakeCurrent ( Display* dpy, GLXDrawable drawable, GLXContext ctx ) ; X-FUNCTION: bool glXMakeCurrent ( Display* dpy, GLXDrawable drawable, GLXContext ctx ) ;
FUNCTION: bool glXQueryExtension ( Display* dpy, int* errorBase, int* eventBase ) ; X-FUNCTION: bool glXQueryExtension ( Display* dpy, int* errorBase, int* eventBase ) ;
FUNCTION: bool glXQueryVersion ( Display* dpy, int* major, int* minor ) ; X-FUNCTION: bool glXQueryVersion ( Display* dpy, int* major, int* minor ) ;
FUNCTION: void glXSwapBuffers ( Display* dpy, GLXDrawable drawable ) ; X-FUNCTION: void glXSwapBuffers ( Display* dpy, GLXDrawable drawable ) ;
FUNCTION: void glXUseXFont ( Font font, int first, int count, int listBase ) ; X-FUNCTION: void glXUseXFont ( Font font, int first, int count, int listBase ) ;
FUNCTION: void glXWaitGL ( ) ; X-FUNCTION: void glXWaitGL ( ) ;
FUNCTION: void glXWaitX ( ) ; X-FUNCTION: void glXWaitX ( ) ;
FUNCTION: char* glXGetClientString ( Display* dpy, int name ) ; X-FUNCTION: char* glXGetClientString ( Display* dpy, int name ) ;
FUNCTION: char* glXQueryServerString ( Display* dpy, int screen, int name ) ; X-FUNCTION: char* glXQueryServerString ( Display* dpy, int screen, int name ) ;
FUNCTION: char* glXQueryExtensionsString ( Display* dpy, int screen ) ; X-FUNCTION: char* glXQueryExtensionsString ( Display* dpy, int screen ) ;
! New for GLX 1.3 ! New for GLX 1.3
FUNCTION: GLXFBConfig* glXGetFBConfigs ( Display* dpy, int screen, int* nelements ) ; X-FUNCTION: GLXFBConfig* glXGetFBConfigs ( Display* dpy, int screen, int* nelements ) ;
FUNCTION: GLXFBConfig* glXChooseFBConfig ( Display* dpy, int screen, int* attrib_list, int* nelements ) ; X-FUNCTION: GLXFBConfig* glXChooseFBConfig ( Display* dpy, int screen, int* attrib_list, int* nelements ) ;
FUNCTION: int glXGetFBConfigAttrib ( Display* dpy, GLXFBConfig config, int attribute, int* value ) ; X-FUNCTION: int glXGetFBConfigAttrib ( Display* dpy, GLXFBConfig config, int attribute, int* value ) ;
FUNCTION: XVisualInfo* glXGetVisualFromFBConfig ( Display* dpy, GLXFBConfig config ) ; X-FUNCTION: XVisualInfo* glXGetVisualFromFBConfig ( Display* dpy, GLXFBConfig config ) ;
FUNCTION: GLXWindow glXCreateWindow ( Display* dpy, GLXFBConfig config, Window win, int* attrib_list ) ; X-FUNCTION: GLXWindow glXCreateWindow ( Display* dpy, GLXFBConfig config, Window win, int* attrib_list ) ;
FUNCTION: void glXDestroyWindow ( Display* dpy, GLXWindow win ) ; X-FUNCTION: void glXDestroyWindow ( Display* dpy, GLXWindow win ) ;
FUNCTION: GLXPixmap glXCreatePixmap ( Display* dpy, GLXFBConfig config, Pixmap pixmap, int* attrib_list ) ; X-FUNCTION: GLXPixmap glXCreatePixmap ( Display* dpy, GLXFBConfig config, Pixmap pixmap, int* attrib_list ) ;
FUNCTION: void glXDestroyPixmap ( Display* dpy, GLXPixmap pixmap ) ; X-FUNCTION: void glXDestroyPixmap ( Display* dpy, GLXPixmap pixmap ) ;
FUNCTION: GLXPbuffer glXCreatePbuffer ( Display* dpy, GLXFBConfig config, int* attrib_list ) ; X-FUNCTION: GLXPbuffer glXCreatePbuffer ( Display* dpy, GLXFBConfig config, int* attrib_list ) ;
FUNCTION: void glXDestroyPbuffer ( Display* dpy, GLXPbuffer pbuf ) ; X-FUNCTION: void glXDestroyPbuffer ( Display* dpy, GLXPbuffer pbuf ) ;
FUNCTION: void glXQueryDrawable ( Display* dpy, GLXDrawable draw, int attribute, uint* value ) ; X-FUNCTION: void glXQueryDrawable ( Display* dpy, GLXDrawable draw, int attribute, uint* value ) ;
FUNCTION: GLXContext glXCreateNewContext ( Display* dpy, GLXFBConfig config, int render_type, GLXContext share_list, bool direct ) ; X-FUNCTION: GLXContext glXCreateNewContext ( Display* dpy, GLXFBConfig config, int render_type, GLXContext share_list, bool direct ) ;
FUNCTION: bool glXMakeContextCurrent ( Display* display, GLXDrawable draw, GLXDrawable read, GLXContext ctx ) ; X-FUNCTION: bool glXMakeContextCurrent ( Display* display, GLXDrawable draw, GLXDrawable read, GLXContext ctx ) ;
FUNCTION: GLXDrawable glXGetCurrentReadDrawable ( ) ; X-FUNCTION: GLXDrawable glXGetCurrentReadDrawable ( ) ;
FUNCTION: Display* glXGetCurrentDisplay ( ) ; X-FUNCTION: Display* glXGetCurrentDisplay ( ) ;
FUNCTION: int glXQueryContext ( Display* dpy, GLXContext ctx, int attribute, int* value ) ; X-FUNCTION: int glXQueryContext ( Display* dpy, GLXContext ctx, int attribute, int* value ) ;
FUNCTION: void glXSelectEvent ( Display* dpy, GLXDrawable draw, ulong event_mask ) ; X-FUNCTION: void glXSelectEvent ( Display* dpy, GLXDrawable draw, ulong event_mask ) ;
FUNCTION: void glXGetSelectedEvent ( Display* dpy, GLXDrawable draw, ulong* event_mask ) ; X-FUNCTION: void glXGetSelectedEvent ( Display* dpy, GLXDrawable draw, ulong* event_mask ) ;
! GLX 1.4 and later ! GLX 1.4 and later
FUNCTION: void* glXGetProcAddress ( char* procname ) ; X-FUNCTION: void* glXGetProcAddress ( char* procname ) ;
! GLX_ARB_get_proc_address extension ! GLX_ARB_get_proc_address extension
FUNCTION: void* glXGetProcAddressARB ( char* procname ) ; X-FUNCTION: void* glXGetProcAddressARB ( char* procname ) ;
! GLX Events ! GLX Events
! (also skipped for now. only has GLXPbufferClobberEvent, the rest is handled by xlib methinks) ! (also skipped for now. only has GLXPbufferClobberEvent, the rest is handled by xlib methinks)

1
basis/x11/io/authors.txt Normal file
View File

@ -0,0 +1 @@
Slava Pestov

16
basis/x11/io/io.factor Normal file
View File

@ -0,0 +1,16 @@
! Copyright (C) 2009 Slava Pestov.
! See http://factorcode.org/license.txt for BSD license.
USING: io.backend calendar threads kernel ;
IN: x11.io
HOOK: init-x-io io-backend ( -- )
M: object init-x-io ;
HOOK: wait-for-display io-backend ( -- )
M: object wait-for-display 10 milliseconds sleep ;
HOOK: awaken-event-loop io-backend ( -- )
M: object awaken-event-loop ;

View File

@ -0,0 +1 @@
Slava Pestov

View File

@ -0,0 +1,15 @@
! Copyright (C) 2009 Slava Pestov.
! See http://factorcode.org/license.txt for BSD license.
USING: io.backend.unix io.backend.unix.multiplexers
namespaces system x11 x11.xlib x11.io
accessors threads sequences kernel ;
IN: x11.io.unix
SYMBOL: dpy-fd
M: unix init-x-io dpy get XConnectionNumber <fd> dpy-fd set-global ;
M: unix wait-for-display dpy-fd get +input+ wait-for-fd ;
M: unix awaken-event-loop
dpy-fd get [ fd>> mx get remove-input-callbacks [ resume ] each ] when* ;

View File

@ -0,0 +1 @@
Slava Pestov

View File

@ -0,0 +1,9 @@
! Copyright (C) 2009 Slava Pestov.
! See http://factorcode.org/license.txt for BSD license.
USING: alien.syntax alien.parser words x11.io sequences kernel ;
IN: x11.syntax
SYNTAX: X-FUNCTION:
(FUNCTION:)
[ \ awaken-event-loop suffix ] dip
define-declared ;

View File

@ -1,7 +1,7 @@
! Copyright (C) 2005, 2006 Eduardo Cavazos and Slava Pestov ! Copyright (C) 2005, 2006 Eduardo Cavazos and Slava Pestov
! See http://factorcode.org/license.txt for BSD license. ! See http://factorcode.org/license.txt for BSD license.
USING: alien alien.c-types hashtables kernel math math.vectors USING: alien alien.c-types hashtables kernel math math.vectors
math.bitwise namespaces sequences x11.xlib x11.constants x11.glx math.bitwise namespaces sequences x11 x11.xlib x11.constants x11.glx
arrays fry ; arrays fry ;
IN: x11.windows IN: x11.windows

36
basis/x11/x11.factor Normal file
View File

@ -0,0 +1,36 @@
! Copyright (C) 2005, 2009 Eduardo Cavazos, Slava Pestov.
! See http://factorcode.org/license.txt for BSD license.
USING: alien.strings continuations io
io.encodings.ascii kernel namespaces x11.xlib x11.io
vocabs vocabs.loader ;
IN: x11
SYMBOL: dpy
SYMBOL: scr
SYMBOL: root
: init-locale ( -- )
LC_ALL "" setlocale [ "setlocale() failed" print flush ] unless
XSupportsLocale [ "XSupportsLocale() failed" print flush ] unless ;
: flush-dpy ( -- ) dpy get XFlush drop ;
: x-atom ( string -- atom ) [ dpy get ] dip 0 XInternAtom ;
: check-display ( alien -- alien' )
[ "Cannot connect to X server - check $DISPLAY" throw ] unless* ;
: init-x ( display-string -- )
init-locale
dup [ ascii string>alien ] when
XOpenDisplay check-display dpy set-global
dpy get XDefaultScreen scr set-global
dpy get scr get XRootWindow root set-global
init-x-io ;
: close-x ( -- ) dpy get XCloseDisplay drop ;
: with-x ( display-string quot -- )
[ init-x ] dip [ close-x ] [ ] cleanup ; inline
"io.backend.unix" vocab [ "x11.io.unix" require ] when

View File

@ -2,7 +2,7 @@
! See http://factorcode.org/license.txt for BSD license. ! See http://factorcode.org/license.txt for BSD license.
USING: alien alien.c-types alien.strings arrays byte-arrays USING: alien alien.c-types alien.strings arrays byte-arrays
hashtables io io.encodings.string kernel math namespaces hashtables io io.encodings.string kernel math namespaces
sequences strings continuations x11.xlib specialized-arrays.uint sequences strings continuations x11 x11.xlib specialized-arrays.uint
accessors io.encodings.utf16n ; accessors io.encodings.utf16n ;
IN: x11.xim IN: x11.xim

View File

@ -13,7 +13,7 @@
USING: kernel arrays alien alien.c-types alien.strings USING: kernel arrays alien alien.c-types alien.strings
alien.syntax math math.bitwise words sequences namespaces alien.syntax math math.bitwise words sequences namespaces
continuations io io.encodings.ascii ; continuations io io.encodings.ascii x11.syntax ;
IN: x11.xlib IN: x11.xlib
LIBRARY: xlib LIBRARY: xlib
@ -71,26 +71,26 @@ C-STRUCT: Display
{ "void*" "free_funcs" } { "void*" "free_funcs" }
{ "int" "fd" } ; { "int" "fd" } ;
FUNCTION: Display* XOpenDisplay ( void* display_name ) ; X-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
FUNCTION: ulong XBlackPixel ( Display* display, int screen_number ) ; X-FUNCTION: ulong XBlackPixel ( Display* display, int screen_number ) ;
FUNCTION: ulong XWhitePixel ( Display* display, int screen_number ) ; X-FUNCTION: ulong XWhitePixel ( Display* display, int screen_number ) ;
FUNCTION: Colormap XDefaultColormap ( Display* display, int screen_number ) ; X-FUNCTION: Colormap XDefaultColormap ( Display* display, int screen_number ) ;
FUNCTION: int XDefaultDepth ( Display* display, int screen_number ) ; X-FUNCTION: int XDefaultDepth ( Display* display, int screen_number ) ;
FUNCTION: GC XDefaultGC ( Display* display, int screen_number ) ; X-FUNCTION: GC XDefaultGC ( Display* display, int screen_number ) ;
FUNCTION: int XDefaultScreen ( Display* display ) ; X-FUNCTION: int XDefaultScreen ( Display* display ) ;
FUNCTION: Window XRootWindow ( Display* display, int screen_number ) ; X-FUNCTION: Window XRootWindow ( Display* display, int screen_number ) ;
FUNCTION: Window XDefaultRootWindow ( Display* display ) ; X-FUNCTION: Window XDefaultRootWindow ( Display* display ) ;
FUNCTION: int XProtocolVersion ( Display* display ) ; X-FUNCTION: int XProtocolVersion ( Display* display ) ;
FUNCTION: int XProtocolRevision ( Display* display ) ; X-FUNCTION: int XProtocolRevision ( Display* display ) ;
FUNCTION: int XQLength ( Display* display ) ; X-FUNCTION: int XQLength ( Display* display ) ;
FUNCTION: int XScreenCount ( Display* display ) ; X-FUNCTION: int XScreenCount ( Display* display ) ;
FUNCTION: int XConnectionNumber ( Display* display ) ; X-FUNCTION: int XConnectionNumber ( Display* display ) ;
! 2.5 Closing the Display ! 2.5 Closing the Display
FUNCTION: int XCloseDisplay ( Display* display ) ; X-FUNCTION: int XCloseDisplay ( Display* display ) ;
! !
! 3 - Window Functions ! 3 - Window Functions
@ -147,17 +147,17 @@ CONSTANT: StaticGravity 10
! 3.3 - Creating Windows ! 3.3 - Creating Windows
FUNCTION: Window XCreateWindow ( Display* display, Window parent, int x, int y, uint width, uint height, uint border_width, int depth, uint class, Visual* visual, ulong valuemask, XSetWindowAttributes* attributes ) ; X-FUNCTION: Window XCreateWindow ( Display* display, Window parent, int x, int y, uint width, uint height, uint border_width, int depth, uint class, Visual* visual, ulong valuemask, XSetWindowAttributes* attributes ) ;
FUNCTION: Window XCreateSimpleWindow ( Display* display, Window parent, int x, int y, uint width, uint height, uint border_width, ulong border, ulong background ) ; X-FUNCTION: Window XCreateSimpleWindow ( Display* display, Window parent, int x, int y, uint width, uint height, uint border_width, ulong border, ulong background ) ;
FUNCTION: Status XDestroyWindow ( Display* display, Window w ) ; X-FUNCTION: Status XDestroyWindow ( Display* display, Window w ) ;
FUNCTION: Status XMapWindow ( Display* display, Window window ) ; X-FUNCTION: Status XMapWindow ( Display* display, Window window ) ;
FUNCTION: Status XMapSubwindows ( Display* display, Window window ) ; X-FUNCTION: Status XMapSubwindows ( Display* display, Window window ) ;
FUNCTION: Status XUnmapWindow ( Display* display, Window w ) ; X-FUNCTION: Status XUnmapWindow ( Display* display, Window w ) ;
FUNCTION: Status XUnmapSubwindows ( Display* display, Window w ) ; X-FUNCTION: Status XUnmapSubwindows ( Display* display, Window w ) ;
! 3.5 Mapping Windows ! 3.5 Mapping Windows
FUNCTION: int XMapRaised ( Display* display, Window w ) ; X-FUNCTION: int XMapRaised ( Display* display, Window w ) ;
! 3.7 - Configuring Windows ! 3.7 - Configuring Windows
@ -178,25 +178,25 @@ C-STRUCT: XWindowChanges
{ "Window" "sibling" } { "Window" "sibling" }
{ "int" "stack_mode" } ; { "int" "stack_mode" } ;
FUNCTION: Status XConfigureWindow ( Display* display, Window w, uint value_mask, XWindowChanges* values ) ; X-FUNCTION: Status XConfigureWindow ( Display* display, Window w, uint value_mask, XWindowChanges* values ) ;
FUNCTION: Status XMoveWindow ( Display* display, Window w, int x, int y ) ; X-FUNCTION: Status XMoveWindow ( Display* display, Window w, int x, int y ) ;
FUNCTION: Status XResizeWindow ( Display* display, Window w, uint width, uint height ) ; X-FUNCTION: Status XResizeWindow ( Display* display, Window w, uint width, uint height ) ;
FUNCTION: Status XSetWindowBorderWidth ( Display* display, ulong w, uint width ) ; X-FUNCTION: Status XSetWindowBorderWidth ( Display* display, ulong w, uint width ) ;
! 3.8 Changing Window Stacking Order ! 3.8 Changing Window Stacking Order
FUNCTION: Status XRaiseWindow ( Display* display, Window w ) ; X-FUNCTION: Status XRaiseWindow ( Display* display, Window w ) ;
FUNCTION: Status XLowerWindow ( Display* display, Window w ) ; X-FUNCTION: Status XLowerWindow ( Display* display, Window w ) ;
! 3.9 - Changing Window Attributes ! 3.9 - Changing Window Attributes
FUNCTION: Status XChangeWindowAttributes ( X-FUNCTION: Status XChangeWindowAttributes (
Display* display, Window w, ulong valuemask, XSetWindowAttributes* attr ) ; Display* display, Window w, ulong valuemask, XSetWindowAttributes* attr ) ;
FUNCTION: Status XSetWindowBackground ( X-FUNCTION: Status XSetWindowBackground (
Display* display, Window w, ulong background_pixel ) ; Display* display, Window w, ulong background_pixel ) ;
FUNCTION: Status XDefineCursor ( Display* display, Window w, Cursor cursor ) ; X-FUNCTION: Status XDefineCursor ( Display* display, Window w, Cursor cursor ) ;
FUNCTION: Status XUndefineCursor ( Display* display, Window w ) ; X-FUNCTION: Status XUndefineCursor ( Display* display, Window w ) ;
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
! 4 - Window Information Functions ! 4 - Window Information Functions
@ -204,7 +204,7 @@ FUNCTION: Status XUndefineCursor ( Display* display, Window w ) ;
! 4.1 - Obtaining Window Information ! 4.1 - Obtaining Window Information
FUNCTION: Status XQueryTree ( X-FUNCTION: Status XQueryTree (
Display* display, Display* display,
Window w, Window w,
Window* root_return, Window* root_return,
@ -236,13 +236,13 @@ C-STRUCT: XWindowAttributes
{ "Bool" "override_redirect" } { "Bool" "override_redirect" }
{ "Screen*" "screen" } ; { "Screen*" "screen" } ;
FUNCTION: Status XGetWindowAttributes ( Display* display, Window w, XWindowAttributes* attr ) ; X-FUNCTION: Status XGetWindowAttributes ( Display* display, Window w, XWindowAttributes* attr ) ;
CONSTANT: IsUnmapped 0 CONSTANT: IsUnmapped 0
CONSTANT: IsUnviewable 1 CONSTANT: IsUnviewable 1
CONSTANT: IsViewable 2 CONSTANT: IsViewable 2
FUNCTION: Status XGetGeometry ( X-FUNCTION: Status XGetGeometry (
Display* display, Display* display,
Drawable d, Drawable d,
Window* root_return, Window* root_return,
@ -255,27 +255,27 @@ FUNCTION: Status XGetGeometry (
! 4.2 - Translating Screen Coordinates ! 4.2 - Translating Screen Coordinates
FUNCTION: Bool XQueryPointer ( Display* display, Window w, Window* root_return, Window* child_return, int* root_x_return, int* root_y_return, int* win_x_return, int* win_y_return, uint* mask_return ) ; X-FUNCTION: Bool XQueryPointer ( Display* display, Window w, Window* root_return, Window* child_return, int* root_x_return, int* root_y_return, int* win_x_return, int* win_y_return, uint* mask_return ) ;
! 4.3 - Properties and Atoms ! 4.3 - Properties and Atoms
FUNCTION: Atom XInternAtom ( Display* display, char* atom_name, Bool only_if_exists ) ; X-FUNCTION: Atom XInternAtom ( Display* display, char* atom_name, Bool only_if_exists ) ;
FUNCTION: char* XGetAtomName ( Display* display, Atom atom ) ; X-FUNCTION: char* XGetAtomName ( Display* display, Atom atom ) ;
! 4.4 - Obtaining and Changing Window Properties ! 4.4 - Obtaining and Changing Window Properties
FUNCTION: int XGetWindowProperty ( Display* display, Window w, Atom property, long long_offset, long long_length, Bool delete, Atom req_type, Atom* actual_type_return, int* actual_format_return, ulong* nitems_return, ulong* bytes_after_return, char** prop_return ) ; X-FUNCTION: int XGetWindowProperty ( Display* display, Window w, Atom property, long long_offset, long long_length, Bool delete, Atom req_type, Atom* actual_type_return, int* actual_format_return, ulong* nitems_return, ulong* bytes_after_return, char** prop_return ) ;
FUNCTION: int XChangeProperty ( Display* display, Window w, Atom property, Atom type, int format, int mode, void* data, int nelements ) ; X-FUNCTION: int XChangeProperty ( Display* display, Window w, Atom property, Atom type, int format, int mode, void* data, int nelements ) ;
! 4.5 Selections ! 4.5 Selections
FUNCTION: int XSetSelectionOwner ( Display* display, Atom selection, Window owner, Time time ) ; X-FUNCTION: int XSetSelectionOwner ( Display* display, Atom selection, Window owner, Time time ) ;
FUNCTION: Window XGetSelectionOwner ( Display* display, Atom selection ) ; X-FUNCTION: Window XGetSelectionOwner ( Display* display, Atom selection ) ;
FUNCTION: int XConvertSelection ( Display* display, Atom selection, Atom target, Atom property, Window requestor, Time time ) ; X-FUNCTION: int XConvertSelection ( Display* display, Atom selection, Atom target, Atom property, Window requestor, Time time ) ;
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
@ -284,8 +284,8 @@ FUNCTION: int XConvertSelection ( Display* display, Atom selection, Atom target,
! 5.1 - Creating and Freeing Pixmaps ! 5.1 - Creating and Freeing Pixmaps
FUNCTION: Pixmap XCreatePixmap ( Display* display, Drawable d, uint width, uint height, uint depth ) ; X-FUNCTION: Pixmap XCreatePixmap ( Display* display, Drawable d, uint width, uint height, uint depth ) ;
FUNCTION: int XFreePixmap ( Display* display, Pixmap pixmap ) ; X-FUNCTION: int XFreePixmap ( Display* display, Pixmap pixmap ) ;
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
@ -300,13 +300,13 @@ C-STRUCT: XColor
{ "char" "flags" } { "char" "flags" }
{ "char" "pad" } ; { "char" "pad" } ;
FUNCTION: Status XLookupColor ( Display* display, Colormap colormap, char* color_name, XColor* exact_def_return, XColor* screen_def_return ) ; X-FUNCTION: Status XLookupColor ( Display* display, Colormap colormap, char* color_name, XColor* exact_def_return, XColor* screen_def_return ) ;
FUNCTION: Status XAllocColor ( Display* display, Colormap colormap, XColor* screen_in_out ) ; X-FUNCTION: Status XAllocColor ( Display* display, Colormap colormap, XColor* screen_in_out ) ;
FUNCTION: Status XQueryColor ( Display* display, Colormap colormap, XColor* def_in_out ) ; X-FUNCTION: Status XQueryColor ( Display* display, Colormap colormap, XColor* def_in_out ) ;
! 6.4 Creating, Copying, and Destroying Colormaps ! 6.4 Creating, Copying, and Destroying Colormaps
FUNCTION: Colormap XCreateColormap ( Display* display, Window w, Visual* visual, int alloc ) ; X-FUNCTION: Colormap XCreateColormap ( Display* display, Window w, Visual* visual, int alloc ) ;
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
! 7 - Graphics Context Functions ! 7 - Graphics Context Functions
@ -378,27 +378,27 @@ C-STRUCT: XGCValues
{ "int" "dash_offset" } { "int" "dash_offset" }
{ "char" "dashes" } ; { "char" "dashes" } ;
FUNCTION: GC XCreateGC ( Display* display, Window d, ulong valuemask, XGCValues* values ) ; X-FUNCTION: GC XCreateGC ( Display* display, Window d, ulong valuemask, XGCValues* values ) ;
FUNCTION: int XChangeGC ( Display* display, GC gc, ulong valuemask, XGCValues* values ) ; X-FUNCTION: int XChangeGC ( Display* display, GC gc, ulong valuemask, XGCValues* values ) ;
FUNCTION: Status XGetGCValues ( Display* display, GC gc, ulong valuemask, XGCValues* values_return ) ; X-FUNCTION: Status XGetGCValues ( Display* display, GC gc, ulong valuemask, XGCValues* values_return ) ;
FUNCTION: Status XSetForeground ( Display* display, GC gc, ulong foreground ) ; X-FUNCTION: Status XSetForeground ( Display* display, GC gc, ulong foreground ) ;
FUNCTION: Status XSetBackground ( Display* display, GC gc, ulong background ) ; X-FUNCTION: Status XSetBackground ( Display* display, GC gc, ulong background ) ;
FUNCTION: Status XSetFunction ( Display* display, GC gc, int function ) ; X-FUNCTION: Status XSetFunction ( Display* display, GC gc, int function ) ;
FUNCTION: Status XSetSubwindowMode ( Display* display, GC gc, int subwindow_mode ) ; X-FUNCTION: Status XSetSubwindowMode ( Display* display, GC gc, int subwindow_mode ) ;
FUNCTION: GContext XGContextFromGC ( GC gc ) ; X-FUNCTION: GContext XGContextFromGC ( GC gc ) ;
FUNCTION: Status XSetFont ( Display* display, GC gc, Font font ) ; X-FUNCTION: Status XSetFont ( Display* display, GC gc, Font font ) ;
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
! 8 - Graphics Functions ! 8 - Graphics Functions
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
FUNCTION: Status XClearWindow ( Display* display, Window w ) ; X-FUNCTION: Status XClearWindow ( Display* display, Window w ) ;
FUNCTION: Status XDrawPoint ( Display* display, Drawable d, GC gc, int x, int y ) ; X-FUNCTION: Status XDrawPoint ( Display* display, Drawable d, GC gc, int x, int y ) ;
FUNCTION: Status XDrawLine ( Display* display, Drawable d, GC gc, int x1, int y1, int x2, int y2 ) ; X-FUNCTION: Status XDrawLine ( Display* display, Drawable d, GC gc, int x1, int y1, int x2, int y2 ) ;
FUNCTION: Status XDrawArc ( Display* display, Drawable d, GC gc, int x, int y, uint width, uint height, int angle1, int angle2 ) ; X-FUNCTION: Status XDrawArc ( Display* display, Drawable d, GC gc, int x, int y, uint width, uint height, int angle1, int angle2 ) ;
FUNCTION: Status XFillArc ( Display* display, Drawable d, GC gc, int x, int y, uint width, uint height, int angle1, int angle2 ) ; X-FUNCTION: Status XFillArc ( Display* display, Drawable d, GC gc, int x, int y, uint width, uint height, int angle1, int angle2 ) ;
! 8.5 - Font Metrics ! 8.5 - Font Metrics
@ -410,9 +410,9 @@ C-STRUCT: XCharStruct
{ "short" "descent" } { "short" "descent" }
{ "ushort" "attributes" } ; { "ushort" "attributes" } ;
FUNCTION: Font XLoadFont ( Display* display, char* name ) ; X-FUNCTION: Font XLoadFont ( Display* display, char* name ) ;
FUNCTION: XFontStruct* XQueryFont ( Display* display, XID font_ID ) ; X-FUNCTION: XFontStruct* XQueryFont ( Display* display, XID font_ID ) ;
FUNCTION: XFontStruct* XLoadQueryFont ( Display* display, char* name ) ; X-FUNCTION: XFontStruct* XLoadQueryFont ( Display* display, char* name ) ;
C-STRUCT: XFontStruct C-STRUCT: XFontStruct
{ "XExtData*" "ext_data" } { "XExtData*" "ext_data" }
@ -432,11 +432,11 @@ C-STRUCT: XFontStruct
{ "int" "ascent" } { "int" "ascent" }
{ "int" "descent" } ; { "int" "descent" } ;
FUNCTION: int XTextWidth ( XFontStruct* font_struct, char* string, int count ) ; X-FUNCTION: int XTextWidth ( XFontStruct* font_struct, char* string, int count ) ;
! 8.6 - Drawing Text ! 8.6 - Drawing Text
FUNCTION: Status XDrawString ( X-FUNCTION: Status XDrawString (
Display* display, Display* display,
Drawable d, Drawable d,
GC gc, GC gc,
@ -479,8 +479,8 @@ C-STRUCT: XImage
{ "XPointer" "obdata" } { "XPointer" "obdata" }
{ "XImage-funcs" "f" } ; { "XImage-funcs" "f" } ;
FUNCTION: XImage* XGetImage ( Display* display, Drawable d, int x, int y, uint width, uint height, ulong plane_mask, int format ) ; X-FUNCTION: XImage* XGetImage ( Display* display, Drawable d, int x, int y, uint width, uint height, ulong plane_mask, int format ) ;
FUNCTION: int XDestroyImage ( XImage *ximage ) ; X-FUNCTION: int XDestroyImage ( XImage *ximage ) ;
: XImage-size ( ximage -- size ) : XImage-size ( ximage -- size )
[ XImage-height ] [ XImage-bytes_per_line ] bi * ; [ XImage-height ] [ XImage-bytes_per_line ] bi * ;
@ -492,12 +492,12 @@ FUNCTION: int XDestroyImage ( XImage *ximage ) ;
! 9 - Window and Session Manager Functions ! 9 - Window and Session Manager Functions
! !
FUNCTION: Status XReparentWindow ( Display* display, Window w, Window parent, int x, int y ) ; X-FUNCTION: Status XReparentWindow ( Display* display, Window w, Window parent, int x, int y ) ;
FUNCTION: Status XAddToSaveSet ( Display* display, Window w ) ; X-FUNCTION: Status XAddToSaveSet ( Display* display, Window w ) ;
FUNCTION: Status XRemoveFromSaveSet ( Display* display, Window w ) ; X-FUNCTION: Status XRemoveFromSaveSet ( Display* display, Window w ) ;
FUNCTION: Status XGrabServer ( Display* display ) ; X-FUNCTION: Status XGrabServer ( Display* display ) ;
FUNCTION: Status XUngrabServer ( Display* display ) ; X-FUNCTION: Status XUngrabServer ( Display* display ) ;
FUNCTION: Status XKillClient ( Display* display, XID resource ) ; X-FUNCTION: Status XKillClient ( Display* display, XID resource ) ;
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
! 10 - Events ! 10 - Events
@ -1066,11 +1066,11 @@ C-UNION: XEvent
! 11 - Event Handling Functions ! 11 - Event Handling Functions
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
FUNCTION: Status XSelectInput ( Display* display, Window w, long event_mask ) ; X-FUNCTION: Status XSelectInput ( Display* display, Window w, long event_mask ) ;
FUNCTION: Status XFlush ( Display* display ) ; X-FUNCTION: Status XFlush ( Display* display ) ;
FUNCTION: Status XSync ( Display* display, int discard ) ; X-FUNCTION: Status XSync ( Display* display, int discard ) ;
FUNCTION: Status XNextEvent ( Display* display, XEvent* event ) ; X-FUNCTION: Status XNextEvent ( Display* display, XEvent* event ) ;
FUNCTION: Status XMaskEvent ( Display* display, long event_mask, XEvent* event_return ) ; X-FUNCTION: Status XMaskEvent ( Display* display, long event_mask, XEvent* event_return ) ;
! 11.3 - Event Queue Management ! 11.3 - Event Queue Management
@ -1078,16 +1078,16 @@ CONSTANT: QueuedAlready 0
CONSTANT: QueuedAfterReading 1 CONSTANT: QueuedAfterReading 1
CONSTANT: QueuedAfterFlush 2 CONSTANT: QueuedAfterFlush 2
FUNCTION: int XEventsQueued ( Display* display, int mode ) ; X-FUNCTION: int XEventsQueued ( Display* display, int mode ) ;
FUNCTION: int XPending ( Display* display ) ; X-FUNCTION: int XPending ( Display* display ) ;
! 11.6 - Sending Events to Other Applications ! 11.6 - Sending Events to Other Applications
FUNCTION: Status XSendEvent ( Display* display, Window w, Bool propagate, long event_mask, XEvent* event_send ) ; X-FUNCTION: Status XSendEvent ( Display* display, Window w, Bool propagate, long event_mask, XEvent* event_send ) ;
! 11.8 - Handling Protocol Errors ! 11.8 - Handling Protocol Errors
FUNCTION: int XSetErrorHandler ( void* handler ) ; X-FUNCTION: int XSetErrorHandler ( void* handler ) ;
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
! 12 - Input Device Functions ! 12 - Input Device Functions
@ -1095,7 +1095,7 @@ FUNCTION: int XSetErrorHandler ( void* handler ) ;
CONSTANT: None 0 CONSTANT: None 0
FUNCTION: int XGrabPointer ( X-FUNCTION: int XGrabPointer (
Display* display, Display* display,
Window grab_window, Window grab_window,
Bool owner_events, Bool owner_events,
@ -1106,16 +1106,16 @@ FUNCTION: int XGrabPointer (
Cursor cursor, Cursor cursor,
Time time ) ; Time time ) ;
FUNCTION: Status XUngrabPointer ( Display* display, Time time ) ; X-FUNCTION: Status XUngrabPointer ( Display* display, Time time ) ;
FUNCTION: Status XChangeActivePointerGrab ( Display* display, uint event_mask, Cursor cursor, Time time ) ; X-FUNCTION: Status XChangeActivePointerGrab ( Display* display, uint event_mask, Cursor cursor, Time time ) ;
FUNCTION: Status XGrabKey ( Display* display, int keycode, uint modifiers, Window grab_window, Bool owner_events, int pointer_mode, int keyboard_mode ) ; X-FUNCTION: Status XGrabKey ( Display* display, int keycode, uint modifiers, Window grab_window, Bool owner_events, int pointer_mode, int keyboard_mode ) ;
FUNCTION: Status XSetInputFocus ( Display* display, Window focus, int revert_to, Time time ) ; X-FUNCTION: Status XSetInputFocus ( Display* display, Window focus, int revert_to, Time time ) ;
FUNCTION: Status XGetInputFocus ( Display* display, X-FUNCTION: Status XGetInputFocus ( Display* display,
Window* focus_return, Window* focus_return,
int* revert_to_return ) ; int* revert_to_return ) ;
FUNCTION: Status XWarpPointer ( Display* display, Window src_w, Window dest_w, int src_x, int src_y, uint src_width, uint src_height, int dest_x, int dest_y ) ; X-FUNCTION: Status XWarpPointer ( Display* display, Window src_w, Window dest_w, int src_x, int src_y, uint src_width, uint src_height, int dest_x, int dest_y ) ;
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
! 14 - Inter-Client Communication Functions ! 14 - Inter-Client Communication Functions
@ -1123,15 +1123,15 @@ FUNCTION: Status XWarpPointer ( Display* display, Window src_w, Window dest_w, i
! 14.1 Client to Window Manager Communication ! 14.1 Client to Window Manager Communication
FUNCTION: Status XFetchName ( Display* display, Window w, char** window_name_return ) ; X-FUNCTION: Status XFetchName ( Display* display, Window w, char** window_name_return ) ;
FUNCTION: Status XGetTransientForHint ( Display* display, Window w, Window* prop_window_return ) ; X-FUNCTION: Status XGetTransientForHint ( Display* display, Window w, Window* prop_window_return ) ;
! 14.1.1. Manipulating Top-Level Windows ! 14.1.1. Manipulating Top-Level Windows
FUNCTION: Status XIconifyWindow ( X-FUNCTION: Status XIconifyWindow (
Display* display, Window w, int screen_number ) ; Display* display, Window w, int screen_number ) ;
FUNCTION: Status XWithdrawWindow ( X-FUNCTION: Status XWithdrawWindow (
Display* display, Window w, int screen_number ) ; Display* display, Window w, int screen_number ) ;
! 14.1.6 - Setting and Reading the WM_HINTS Property ! 14.1.6 - Setting and Reading the WM_HINTS Property
@ -1173,10 +1173,10 @@ C-STRUCT: XSizeHints
! 14.1.10. Setting and Reading the WM_PROTOCOLS Property ! 14.1.10. Setting and Reading the WM_PROTOCOLS Property
FUNCTION: Status XSetWMProtocols ( X-FUNCTION: Status XSetWMProtocols (
Display* display, Window w, Atom* protocols, int count ) ; Display* display, Window w, Atom* protocols, int count ) ;
FUNCTION: Status XGetWMProtocols ( X-FUNCTION: Status XGetWMProtocols (
Display* display, Display* display,
Window w, Window w,
Atom** protocols_return, Atom** protocols_return,
@ -1188,9 +1188,9 @@ FUNCTION: Status XGetWMProtocols (
! 16.1 Keyboard Utility Functions ! 16.1 Keyboard Utility Functions
FUNCTION: KeySym XLookupKeysym ( XKeyEvent* key_event, int index ) ; X-FUNCTION: KeySym XLookupKeysym ( XKeyEvent* key_event, int index ) ;
FUNCTION: int XLookupString ( X-FUNCTION: int XLookupString (
XKeyEvent* event_struct, XKeyEvent* event_struct,
void* buffer_return, void* buffer_return,
int bytes_buffer, int bytes_buffer,
@ -1227,7 +1227,7 @@ C-STRUCT: XVisualInfo
! Appendix D - Compatibility Functions ! Appendix D - Compatibility Functions
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
FUNCTION: Status XSetStandardProperties ( X-FUNCTION: Status XSetStandardProperties (
Display* display, Display* display,
Window w, Window w,
char* window_name, char* window_name,
@ -1314,10 +1314,10 @@ CONSTANT: XA_LAST_PREDEFINED 68
! The rest of the stuff is not from the book. ! The rest of the stuff is not from the book.
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
FUNCTION: void XFree ( void* data ) ; X-FUNCTION: void XFree ( void* data ) ;
FUNCTION: int XStoreName ( Display* display, Window w, char* window_name ) ; X-FUNCTION: int XStoreName ( Display* display, Window w, char* window_name ) ;
FUNCTION: void XSetWMNormalHints ( Display* display, Window w, XSizeHints* hints ) ; X-FUNCTION: void XSetWMNormalHints ( Display* display, Window w, XSizeHints* hints ) ;
FUNCTION: int XBell ( Display* display, int percent ) ; X-FUNCTION: int XBell ( Display* display, int percent ) ;
! !!! INPUT METHODS ! !!! INPUT METHODS
@ -1381,23 +1381,23 @@ CONSTANT: XLookupChars 2
CONSTANT: XLookupKeySym 3 CONSTANT: XLookupKeySym 3
CONSTANT: XLookupBoth 4 CONSTANT: XLookupBoth 4
FUNCTION: Bool XFilterEvent ( XEvent* event, Window w ) ; X-FUNCTION: Bool XFilterEvent ( XEvent* event, Window w ) ;
FUNCTION: XIM XOpenIM ( Display* dpy, void* rdb, char* res_name, char* res_class ) ; X-FUNCTION: XIM XOpenIM ( Display* dpy, void* rdb, char* res_name, char* res_class ) ;
FUNCTION: Status XCloseIM ( XIM im ) ; X-FUNCTION: Status XCloseIM ( XIM im ) ;
FUNCTION: XIC XCreateIC ( XIM im, char* key1, Window value1, char* key2, Window value2, char* key3, int value3, char* key4, char* value4, char* key5, char* value5, int key6 ) ; X-FUNCTION: XIC XCreateIC ( XIM im, char* key1, Window value1, char* key2, Window value2, char* key3, int value3, char* key4, char* value4, char* key5, char* value5, int key6 ) ;
FUNCTION: void XDestroyIC ( XIC ic ) ; X-FUNCTION: void XDestroyIC ( XIC ic ) ;
FUNCTION: void XSetICFocus ( XIC ic ) ; X-FUNCTION: void XSetICFocus ( XIC ic ) ;
FUNCTION: void XUnsetICFocus ( XIC ic ) ; X-FUNCTION: void XUnsetICFocus ( XIC ic ) ;
FUNCTION: int XwcLookupString ( XIC ic, XKeyPressedEvent* event, ulong* buffer_return, int bytes_buffer, KeySym* keysym_return, Status* status_return ) ; X-FUNCTION: int XwcLookupString ( XIC ic, XKeyPressedEvent* event, ulong* 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 ) ; X-FUNCTION: int Xutf8LookupString ( XIC ic, XKeyPressedEvent* event, char* buffer_return, int bytes_buffer, KeySym* keysym_return, Status* status_return ) ;
! !!! category of setlocale ! !!! category of setlocale
CONSTANT: LC_ALL 0 CONSTANT: LC_ALL 0
@ -1407,37 +1407,8 @@ CONSTANT: LC_MONETARY 3
CONSTANT: LC_NUMERIC 4 CONSTANT: LC_NUMERIC 4
CONSTANT: LC_TIME 5 CONSTANT: LC_TIME 5
FUNCTION: char* setlocale ( int category, char* name ) ; X-FUNCTION: char* setlocale ( int category, char* name ) ;
FUNCTION: Bool XSupportsLocale ( ) ; X-FUNCTION: Bool XSupportsLocale ( ) ;
FUNCTION: char* XSetLocaleModifiers ( char* modifier_list ) ; X-FUNCTION: char* XSetLocaleModifiers ( char* modifier_list ) ;
SYMBOL: dpy
SYMBOL: scr
SYMBOL: root
: init-locale ( -- )
LC_ALL "" setlocale [ "setlocale() failed" print flush ] unless
XSupportsLocale [ "XSupportsLocale() failed" print flush ] unless ;
: flush-dpy ( -- ) dpy get XFlush drop ;
: x-atom ( string -- atom ) dpy get swap 0 XInternAtom ;
: check-display ( alien -- alien' )
[
"Cannot connect to X server - check $DISPLAY" throw
] unless* ;
: initialize-x ( display-string -- )
init-locale
dup [ ascii string>alien ] when
XOpenDisplay check-display dpy set-global
dpy get XDefaultScreen scr set-global
dpy get scr get XRootWindow root set-global ;
: close-x ( -- ) dpy get XCloseDisplay drop ;
: with-x ( display-string quot -- )
[ initialize-x ] dip [ close-x ] [ ] cleanup ; inline