Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Add functionality to Xlib interface in Xlib-simple example.

  • Loading branch information...
commit 4404899383d59ea1db67a4c589d8c7bcd3a0b29d 1 parent 3243481
@feeley authored
View
291 examples/Xlib-simple/Xlib#.scm
@@ -1,146 +1,209 @@
;;;============================================================================
-;;; File: "Xlib#.scm", Time-stamp: <2011-01-17 15:19:38 feeley>
+;;; File: "Xlib#.scm"
-;;; Copyright (c) 2005-2011 by Marc Feeley, All Rights Reserved.
+;;; Copyright (c) 2005-2012 by Marc Feeley, All Rights Reserved.
;;;============================================================================
(##namespace ("Xlib#"
; procedures and variables
+XOpenDisplay
+XCloseDisplay
+XDefaultScreen
+XScreenOfDisplay
+XDefaultColormapOfScreen
+XClearWindow
+XConnectionNumber
+XRootWindow
+XDefaultRootWindow
+XRootWindowOfScreen
+XDefaultVisual
+XDefaultVisualOfScreen
+XDefaultGC
+XDefaultGCOfScreen
+XBlackPixel
+XWhitePixel
+XCreateSimpleWindow
+XMapWindow
+XResizeWindow
+XFlush
+XCreateGC
+XFreeGC
+XFillRectangle
+XFillArc
+XDrawString
+XTextWidth
+XParseColor
+XAllocColor
+make-XColor-box
+XColor-pixel
+XColor-pixel-set!
+XColor-red
+XColor-red-set!
+XColor-green
+XColor-green-set!
+XColor-blue
+XColor-blue-set!
+make-XGCValues-box
+XGCValues-foreground
+XGCValues-foreground-set!
+XGCValues-background
+XGCValues-background-set!
+XGCValues-font
+XGCValues-font-set!
+GCFunction
+GCPlaneMask
+GCForeground
+GCBackground
+GCLineWidth
+GCLineStyle
+GCCapStyle
+GCJoinStyle
+GCFillStyle
+GCFillRule
+GCTile
+GCStipple
+GCTileStipXOrigin
+GCTileStipYOrigin
+GCFont
+GCSubwindowMode
+GCGraphicsExposures
+GCClipXOrigin
+GCClipYOrigin
+GCClipMask
+GCDashOffset
+GCDashList
+GCArcMode
+XChangeGC
+XGetGCValues
+XQueryFont
+XFreeFontInfo
+XLoadFont
+XUnloadFont
+XLoadQueryFont
+XFreeFont
+XFontStruct-fid
+XFontStruct-ascent
+XFontStruct-descent
+NoEventMask
+KeyPressMask
+KeyReleaseMask
+ButtonPressMask
+ButtonReleaseMask
+EnterWindowMask
+LeaveWindowMask
+PointerMotionMask
+PointerMotionHintMask
Button1MotionMask
Button2MotionMask
Button3MotionMask
Button4MotionMask
Button5MotionMask
ButtonMotionMask
-ButtonPressMask
-ButtonReleaseMask
-CirculateNotify
-CirculateRequest
-ClientMessage
-ColormapChangeMask
-ColormapNotify
-ConfigureNotify
-ConfigureRequest
-CreateNotify
-DestroyNotify
-EnterWindowMask
-Expose
+KeymapStateMask
ExposureMask
+VisibilityChangeMask
+StructureNotifyMask
+ResizeRedirectMask
+SubstructureNotifyMask
+SubstructureRedirectMask
FocusChangeMask
+PropertyChangeMask
+ColormapChangeMask
+OwnerGrabButtonMask
+KeyPress
+KeyRelease
+ButtonPress
+ButtonRelease
+MotionNotify
+EnterNotify
+LeaveNotify
FocusIn
FocusOut
-GCArcMode
-GCBackground
-GCCapStyle
-GCClipMask
-GCClipXOrigin
-GCClipYOrigin
-GCDashList
-GCDashOffset
-GCFillRule
-GCFillStyle
-GCFont
-GCForeground
-GCFunction
-GCGraphicsExposures
-GCJoinStyle
-GCLineStyle
-GCLineWidth
-GCPlaneMask
-GCStipple
-GCSubwindowMode
-GCTile
-GCTileStipXOrigin
-GCTileStipYOrigin
-GraphicsExpose
-GravityNotify
-KeyPressMask
-KeyReleaseMask
KeymapNotify
-KeymapStateMask
-LeaveWindowMask
+Expose
+GraphicsExpose
+NoExpose
+VisibilityNotify
+CreateNotify
+DestroyNotify
+UnmapNotify
MapNotify
MapRequest
-MappingNotify
-NoEventMask
-NoExpose
-OwnerGrabButtonMask
-PointerMotionHintMask
-PointerMotionMask
-PropertyChangeMask
-PropertyNotify
ReparentNotify
-ResizeRedirectMask
+ConfigureNotify
+ConfigureRequest
+GravityNotify
ResizeRequest
+CirculateNotify
+CirculateRequest
+PropertyNotify
SelectionClear
-SelectionNotify
SelectionRequest
-StructureNotifyMask
-SubstructureNotifyMask
-SubstructureRedirectMask
-UnmapNotify
-VisibilityChangeMask
-VisibilityNotify
-XAllocColor
-XBlackPixel
-XChangeGC
+SelectionNotify
+ColormapNotify
+ClientMessage
+MappingNotify
XCheckMaskEvent
-XClearWindow
-XCloseDisplay
-XColor-blue
-XColor-blue-set!
-XColor-green
-XColor-green-set!
-XColor-pixel
-XColor-pixel-set!
-XColor-red
-XColor-red-set!
-XConnectionNumber
-XCreateGC
-XCreateSimpleWindow
-XDefaultColormapOfScreen
-XDefaultGC
-XDefaultGCOfScreen
-XDefaultRootWindow
-XDefaultScreen
-XDefaultVisual
-XDefaultVisualOfScreen
-XDrawString
-XFillArc
-XFillRectangle
-XFlush
-XFontStruct-ascent
-XFontStruct-descent
-XFontStruct-fid
-XFreeGC
-XFreeFont
-XFreeFontInfo
-XGCValues-background
-XGCValues-background-set!
-XGCValues-font
-XGCValues-font-set!
-XGCValues-foreground
-XGCValues-foreground-set!
-XGetGCValues
-XLoadFont
-XLoadQueryFont
-XMapWindow
-XOpenDisplay
-XParseColor
-XQueryFont
-XRootWindow
-XRootWindowOfScreen
-XScreenOfDisplay
XSelectInput
-XTextWidth
-XUnloadFont
-XWhitePixel
+XAnyEvent-type
+XAnyEvent-serial
+XAnyEvent-send-event
+XAnyEvent-display
+XAnyEvent-window
+XKeyEvent-root
+XKeyEvent-subwindow
+XKeyEvent-time
+XKeyEvent-x
+XKeyEvent-y
+XKeyEvent-x-root
+XKeyEvent-y-root
+XKeyEvent-state
+XKeyEvent-keycode
+XKeyEvent-same-screen
+XButtonEvent-root
+XButtonEvent-subwindow
+XButtonEvent-time
+XButtonEvent-x
+XButtonEvent-y
+XButtonEvent-x-root
+XButtonEvent-y-root
+XButtonEvent-state
+XButtonEvent-button
+XButtonEvent-same-screen
+XMotionEvent-root
+XMotionEvent-subwindow
+XMotionEvent-time
+XMotionEvent-x
+XMotionEvent-y
+XMotionEvent-x-root
+XMotionEvent-y-root
+XMotionEvent-state
+XMotionEvent-is-hint
+XMotionEvent-same-screen
+XCrossingEvent-root
+XCrossingEvent-subwindow
+XCrossingEvent-time
+XCrossingEvent-x
+XCrossingEvent-y
+XCrossingEvent-x-root
+XCrossingEvent-y-root
+XCrossingEvent-mode
+XCrossingEvent-detail
+XCrossingEvent-same-screen
+XCrossingEvent-focus
+XCrossingEvent-state
+XConfigureEvent-x
+XConfigureEvent-y
+XConfigureEvent-width
+XConfigureEvent-height
+XConfigureEvent-border-width
+XResizeRequestEvent-width
+XResizeRequestEvent-height
+XLookupString
convert-XEvent
-make-XColor-box
-make-XGCValues-box
))
View
78 examples/Xlib-simple/Xlib.scm
@@ -1,8 +1,8 @@
;;;============================================================================
-;;; File: "Xlib.scm", Time-stamp: <2011-01-17 15:19:20 feeley>
+;;; File: "Xlib.scm"
-;;; Copyright (c) 2006-2011 by Marc Feeley, All Rights Reserved.
+;;; Copyright (c) 2006-2012 by Marc Feeley, All Rights Reserved.
;;; A simple interface to the X Window System Xlib library.
@@ -242,6 +242,14 @@ end-of-c-declare
int
"XMapWindow"))
+(define XResizeWindow
+ (c-lambda (Display* ;; display
+ Window ;; w
+ unsigned-int ;; width
+ unsigned-int) ;; height
+ int
+ "XResizeWindow"))
+
(define XFlush
(c-lambda (Display*) ;; display
int
@@ -979,6 +987,41 @@ end-of-c-lambda
unsigned-int
"___result = ___arg1->xcrossing.state;"))
+(define XConfigureEvent-x
+ (c-lambda (XEvent*) ;; XEvent box
+ int
+ "___result = ___arg1->xconfigure.x;"))
+
+(define XConfigureEvent-y
+ (c-lambda (XEvent*) ;; XEvent box
+ int
+ "___result = ___arg1->xconfigure.y;"))
+
+(define XConfigureEvent-width
+ (c-lambda (XEvent*) ;; XEvent box
+ int
+ "___result = ___arg1->xconfigure.width;"))
+
+(define XConfigureEvent-height
+ (c-lambda (XEvent*) ;; XEvent box
+ int
+ "___result = ___arg1->xconfigure.height;"))
+
+(define XConfigureEvent-border-width
+ (c-lambda (XEvent*) ;; XEvent box
+ int
+ "___result = ___arg1->xconfigure.border_width;"))
+
+(define XResizeRequestEvent-width
+ (c-lambda (XEvent*) ;; XEvent box
+ int
+ "___result = ___arg1->xresizerequest.width;"))
+
+(define XResizeRequestEvent-height
+ (c-lambda (XEvent*) ;; XEvent box
+ int
+ "___result = ___arg1->xresizerequest.height;"))
+
(define XLookupString
(c-lambda (XEvent*) ;; event_struct (XKeyEvent)
KeySym
@@ -998,6 +1041,7 @@ end-of-c-lambda
(define (convert-XEvent ev)
(and ev
(let ((type (XAnyEvent-type ev)))
+
(cond ((or (##fixnum.= type KeyPress)
(##fixnum.= type KeyRelease))
(##list
@@ -1020,6 +1064,7 @@ end-of-c-lambda
(XKeyEvent-keycode ev)
(XKeyEvent-same-screen ev)
(XLookupString ev)))
+
((or (##fixnum.= type ButtonPress)
(##fixnum.= type ButtonRelease))
(##list
@@ -1041,13 +1086,13 @@ end-of-c-lambda
(XButtonEvent-state ev)
(XButtonEvent-button ev)
(XButtonEvent-same-screen ev)))
+
((##fixnum.= type MotionNotify)
(##list
'XPointerMovedEvent
type
(XAnyEvent-serial ev)
(XAnyEvent-send-event ev)
-'
(XAnyEvent-display ev)
(XAnyEvent-window ev)
(XMotionEvent-root ev)
@@ -1060,6 +1105,7 @@ end-of-c-lambda
(XMotionEvent-state ev)
(XMotionEvent-is-hint ev)
(XMotionEvent-same-screen ev)))
+
((or (##fixnum.= type EnterNotify)
(##fixnum.= type LeaveNotify))
(##list
@@ -1083,6 +1129,32 @@ end-of-c-lambda
(XCrossingEvent-same-screen ev)
(XCrossingEvent-focus ev)
(XCrossingEvent-state ev)))
+
+ ((##fixnum.= type ConfigureNotify)
+ (##list
+ 'XConfigureEvent
+ type
+ (XAnyEvent-serial ev)
+ (XAnyEvent-send-event ev)
+ (XAnyEvent-display ev)
+ (XAnyEvent-window ev)
+ (XConfigureEvent-x ev)
+ (XConfigureEvent-y ev)
+ (XConfigureEvent-width ev)
+ (XConfigureEvent-height ev)
+ (XConfigureEvent-border-width ev)))
+
+ ((##fixnum.= type ResizeRequest)
+ (##list
+ 'XResizeRequestEvent
+ type
+ (XAnyEvent-serial ev)
+ (XAnyEvent-send-event ev)
+ (XAnyEvent-display ev)
+ (XAnyEvent-window ev)
+ (XResizeRequestEvent-width ev)
+ (XResizeRequestEvent-height ev)))
+
(else
#f)))))
View
2  include/stamp.h
@@ -3,4 +3,4 @@
*/
#define ___STAMP_YMD 20120128
-#define ___STAMP_HMS 3604
+#define ___STAMP_HMS 14203
Please sign in to comment.
Something went wrong with that request. Please try again.