Added synchronous interface to X events.

This commit is contained in:
mainzelm 2002-04-17 14:55:10 +00:00
parent cccb9ef8ff
commit 04812d3f7a
4 changed files with 398 additions and 338 deletions

View File

@ -1,7 +1,7 @@
### update this to fit your system ### update this to fit your system
SCSH_PREFIX = /usr/local SCSH_PREFIX = /afs/wsi/i386_fbsd43/scsh-0.6.1/
X11_PATH = /usr/X11R6 X11_PATH = /usr/X11R6
LIB_DL = -ldl LIB_DL =
### the following does not have to be changed (hopefully) ### the following does not have to be changed (hopefully)
SCHEME_INCLUDE = $(SCSH_PREFIX)/include SCHEME_INCLUDE = $(SCSH_PREFIX)/include
@ -53,6 +53,7 @@ SCM_FILES = scheme/xlib/types.scm \
scheme/xlib/text.scm scheme/xlib/utility.scm \ scheme/xlib/text.scm scheme/xlib/utility.scm \
scheme/xlib/visual-type.scm scheme/xlib/visual.scm \ scheme/xlib/visual-type.scm scheme/xlib/visual.scm \
scheme/xlib/window-type.scm scheme/xlib/window.scm \ scheme/xlib/window-type.scm scheme/xlib/window.scm \
scheme/xlib/sync-event.scm \
scheme/xlib/wm.scm \ scheme/xlib/wm.scm \
scheme/libs/xpm.scm scheme/libs/xpm.scm
@ -100,3 +101,6 @@ $(SCX): $(SCX_IMAGE) main.o $(OBJECTS)
clean: clean:
rm -f $(SCX_VM) $(SCX) $(SCX_IMAGE) *.o c/*.o c/xlib/*.o c/libs/*.o rm -f $(SCX_VM) $(SCX) $(SCX_IMAGE) *.o c/*.o c/xlib/*.o c/libs/*.o
tags:
find . -name "*.c" -or -name "*.h" -or -name "*.scm" | etags -

View File

@ -0,0 +1,36 @@
(define-record-type sync-x-event :sync-x-event
(really-make-sync-x-event event next)
sync-x-event?
(event sync-x-event-event)
(next really-next-sync-x-event really-set-next-sync-x-event))
(define (make-sync-x-event event)
(really-make-sync-x-event event (make-placeholder)))
(define (next-sync-x-event sync-x-event)
(placeholder-value (really-make-sync-x-event sync-x-event)))
(define (set-next-sync-x-event! sync-x-event next-sync-x-event)
(placeholder-set!
(really-next-sync-x-event sync-x-event)
next-sync-x-event))
(define (advance-most-recent-sync-x-event!)
(set! *most-recent-sync-x-event*
(next-sync-x-event *most-recent-sync-x-event*)))
(define *most-recent-sync-x-event* (make-sync-x-event 'no-event))
(define (most-recent-sync-x-event)
*most-recent-sync-x-event*)
(define (with-sync-x-events dpy thunk)
(spawn (lambda ()
(let lp ()
(let ((next (wait-event dpy)))
(set-next-sync-x-event! *most-recent-sync-x-event*
(make-sync-x-event next))
(advance-most-recent-sync-x-event!)))))
(thunk))

View File

@ -287,373 +287,382 @@
special-pixmap:none special-pixmap:copy-from-parent special-pixmap:none special-pixmap:copy-from-parent
special-pixmap:parent-relative)) special-pixmap:parent-relative))
(define-interface xlib-event-interface (define-interface xlib-event-internal-interface
(export event-ready? (export next-event
peek-event
event-ready?
events-pending events-pending
events-queued events-queued
((queued-mode) :syntax) ((queued-mode) :syntax)))
next-event
peek-event (define-interface xlib-sync-x-events-interface
wait-event (export sync-x-event-event
send-event most-recent-sync-x-event
with-sync-x-events
next-sync-x-event))
(define-interface xlib-event-interface
(export
wait-event
send-event
((event-type) :syntax) ((event-type) :syntax)
any-event-type any-event-type
any-event-serial any-event-serial
any-event-send-event? any-event-send-event?
any-event-display any-event-display
any-event-window any-event-window
create-key-event create-key-event
key-event? key-event?
key-event-type key-event-type
key-event-serial key-event-serial
key-event-send-event? key-event-send-event?
key-event-display key-event-display
key-event-window key-event-window
key-event-root key-event-root
key-event-subwindow key-event-subwindow
key-event-time key-event-time
key-event-x key-event-x
key-event-y key-event-y
key-event-x-root key-event-x-root
key-event-y-root key-event-y-root
key-event-state key-event-state
key-event-keycode key-event-keycode
key-event-same-screen? key-event-same-screen?
create-button-event create-button-event
button-event? button-event?
button-event-type button-event-type
button-event-serial button-event-serial
button-event-send-event? button-event-send-event?
button-event-display button-event-display
button-event-window button-event-window
button-event-root button-event-root
button-event-subwindow button-event-subwindow
button-event-time button-event-time
button-event-x button-event-x
button-event-y button-event-y
button-event-x-root button-event-x-root
button-event-y-root button-event-y-root
button-event-state button-event-state
button-event-button button-event-button
button-event-same-screen? button-event-same-screen?
create-motion-event create-motion-event
motion-event? motion-event?
motion-event-type motion-event-type
motion-event-serial motion-event-serial
motion-event-send-event? motion-event-send-event?
motion-event-display motion-event-display
motion-event-window motion-event-window
motion-event-root motion-event-root
motion-event-subwindow motion-event-subwindow
motion-event-time motion-event-time
motion-event-x motion-event-x
motion-event-y motion-event-y
motion-event-x-root motion-event-x-root
motion-event-y-root motion-event-y-root
motion-event-state motion-event-state
motion-event-is-hint? motion-event-is-hint?
motion-event-same-screen? motion-event-same-screen?
create-crossing-event create-crossing-event
crossing-event? crossing-event?
crossing-event-type crossing-event-type
crossing-event-serial crossing-event-serial
crossing-event-send-event? crossing-event-send-event?
crossing-event-display crossing-event-display
crossing-event-window crossing-event-window
crossing-event-root crossing-event-root
crossing-event-subwindow crossing-event-subwindow
crossing-event-time crossing-event-time
crossing-event-x crossing-event-x
crossing-event-y crossing-event-y
crossing-event-x-root crossing-event-x-root
crossing-event-y-root crossing-event-y-root
crossing-event-mode crossing-event-mode
crossing-event-detail crossing-event-detail
crossing-event-same-screen? crossing-event-same-screen?
crossing-event-focus? crossing-event-focus?
crossing-event-state crossing-event-state
create-focus-change-event create-focus-change-event
focus-change-event? focus-change-event?
focus-change-event-type focus-change-event-type
focus-change-event-serial focus-change-event-serial
focus-change-event-send-event? focus-change-event-send-event?
focus-change-event-display focus-change-event-display
focus-change-event-window focus-change-event-window
focus-change-event-mode focus-change-event-mode
focus-change-event-detail focus-change-event-detail
create-expose-event create-expose-event
expose-event? expose-event?
expose-event-type expose-event-type
expose-event-serial expose-event-serial
expose-event-send-event? expose-event-send-event?
expose-event-display expose-event-display
expose-event-window expose-event-window
expose-event-x expose-event-x
expose-event-y expose-event-y
expose-event-width expose-event-width
expose-event-height expose-event-height
expose-event-count expose-event-count
create-graphics-expose-event create-graphics-expose-event
graphics-expose-event? graphics-expose-event?
graphics-expose-event-type graphics-expose-event-type
graphics-expose-event-serial graphics-expose-event-serial
graphics-expose-event-send-event? graphics-expose-event-send-event?
graphics-expose-event-display graphics-expose-event-display
graphics-expose-event-drawable graphics-expose-event-drawable
graphics-expose-event-x graphics-expose-event-x
graphics-expose-event-y graphics-expose-event-y
graphics-expose-event-width graphics-expose-event-width
graphics-expose-event-height graphics-expose-event-height
graphics-expose-event-major-code graphics-expose-event-major-code
graphics-expose-event-minor-code graphics-expose-event-minor-code
create-no-expose-event create-no-expose-event
no-expose-event? no-expose-event?
no-expose-event-type no-expose-event-type
no-expose-event-serial no-expose-event-serial
no-expose-event-send-event? no-expose-event-send-event?
no-expose-event-display no-expose-event-display
no-expose-event-drawable no-expose-event-drawable
no-expose-event-major-code no-expose-event-major-code
no-expose-event-minor-code no-expose-event-minor-code
create-visibility-event create-visibility-event
visibility-event? visibility-event?
visibility-event-type visibility-event-type
visibility-event-serial visibility-event-serial
visibility-event-send-event? visibility-event-send-event?
visibility-event-display visibility-event-display
visibility-event-window visibility-event-window
visibility-event-state visibility-event-state
create-create-window-event create-create-window-event
create-window-event? create-window-event?
create-window-event-type create-window-event-type
create-window-event-serial create-window-event-serial
create-window-event-send-event? create-window-event-send-event?
create-window-event-display create-window-event-display
create-window-event-parent create-window-event-parent
create-window-event-window create-window-event-window
create-window-event-x create-window-event-x
create-window-event-y create-window-event-y
create-window-event-width create-window-event-width
create-window-event-height create-window-event-height
create-window-event-border-width create-window-event-border-width
create-window-event-override-redirect? create-window-event-override-redirect?
create-destroy-window-event create-destroy-window-event
destroy-window-event? destroy-window-event?
destroy-window-event-type destroy-window-event-type
destroy-window-event-serial destroy-window-event-serial
destroy-window-event-send-event? destroy-window-event-send-event?
destroy-window-event-display destroy-window-event-display
destroy-window-event-event destroy-window-event-event
destroy-window-event-window destroy-window-event-window
create-unmap-event create-unmap-event
unmap-event? unmap-event?
unmap-event-type unmap-event-type
unmap-event-serial unmap-event-serial
unmap-event-send-event? unmap-event-send-event?
unmap-event-display unmap-event-display
unmap-event-event unmap-event-event
unmap-event-window unmap-event-window
unmap-event-from-configure? unmap-event-from-configure?
create-map-event create-map-event
map-event? map-event?
map-event-type map-event-type
map-event-serial map-event-serial
map-event-send-event? map-event-send-event?
map-event-display map-event-display
map-event-event map-event-event
map-event-window map-event-window
map-event-override-redirect? map-event-override-redirect?
create-map-request-event create-map-request-event
map-request-event? map-request-event?
map-request-event-type map-request-event-type
map-request-event-serial map-request-event-serial
map-request-event-send-event? map-request-event-send-event?
map-request-event-display map-request-event-display
map-request-event-parent map-request-event-parent
map-request-event-window map-request-event-window
create-reparent-event create-reparent-event
reparent-event? reparent-event?
reparent-event-type reparent-event-type
reparent-event-serial reparent-event-serial
reparent-event-send-event? reparent-event-send-event?
reparent-event-display reparent-event-display
reparent-event-event reparent-event-event
reparent-event-window reparent-event-window
reparent-event-parent reparent-event-parent
reparent-event-x reparent-event-x
reparent-event-y reparent-event-y
reparent-event-override-redirect? reparent-event-override-redirect?
create-configure-event create-configure-event
configure-event? configure-event?
configure-event-type configure-event-type
configure-event-serial configure-event-serial
configure-event-send-event? configure-event-send-event?
configure-event-display configure-event-display
configure-event-event configure-event-event
configure-event-window configure-event-window
configure-event-x configure-event-x
configure-event-y configure-event-y
configure-event-width configure-event-width
configure-event-height configure-event-height
configure-event-border-width configure-event-border-width
configure-event-above configure-event-above
configure-event-override-redirect? configure-event-override-redirect?
create-gravity-event create-gravity-event
gravity-event? gravity-event?
gravity-event-type gravity-event-type
gravity-event-serial gravity-event-serial
gravity-event-send-event? gravity-event-send-event?
gravity-event-display gravity-event-display
gravity-event-event gravity-event-event
gravity-event-window gravity-event-window
gravity-event-x gravity-event-x
gravity-event-y gravity-event-y
create-resize-request-event create-resize-request-event
resize-request-event? resize-request-event?
resize-request-event-type resize-request-event-type
resize-request-event-serial resize-request-event-serial
resize-request-event-send-event? resize-request-event-send-event?
resize-request-event-display resize-request-event-display
resize-request-event-window resize-request-event-window
resize-request-event-width resize-request-event-width
resize-request-event-height resize-request-event-height
create-configure-request-event create-configure-request-event
configure-request-event? configure-request-event?
configure-request-event-type configure-request-event-type
configure-request-event-serial configure-request-event-serial
configure-request-event-send-event? configure-request-event-send-event?
configure-request-event-display configure-request-event-display
configure-request-event-parent configure-request-event-parent
configure-request-event-window configure-request-event-window
configure-request-event-window-change-alist configure-request-event-window-change-alist
create-circulate-event create-circulate-event
circulate-event? circulate-event?
circulate-event-type circulate-event-type
circulate-event-serial circulate-event-serial
circulate-event-send-event? circulate-event-send-event?
circulate-event-display circulate-event-display
circulate-event-event circulate-event-event
circulate-event-window circulate-event-window
circulate-event-place circulate-event-place
create-circulate-request-event create-circulate-request-event
circulate-request-event? circulate-request-event?
circulate-request-event-type circulate-request-event-type
circulate-request-event-serial circulate-request-event-serial
circulate-request-event-send-event? circulate-request-event-send-event?
circulate-request-event-display circulate-request-event-display
circulate-request-event-parent circulate-request-event-parent
circulate-request-event-window circulate-request-event-window
circulate-request-event-place circulate-request-event-place
create-property-event create-property-event
property-event? property-event?
property-event-type property-event-type
property-event-serial property-event-serial
property-event-send-event? property-event-send-event?
property-event-display property-event-display
property-event-window property-event-window
property-event-atom property-event-atom
property-event-time property-event-time
property-event-state property-event-state
create-selection-clear-event create-selection-clear-event
selection-clear-event? selection-clear-event?
selection-clear-event-type selection-clear-event-type
selection-clear-event-serial selection-clear-event-serial
selection-clear-event-send-event? selection-clear-event-send-event?
selection-clear-event-display selection-clear-event-display
selection-clear-event-window selection-clear-event-window
selection-clear-event-selection selection-clear-event-selection
selection-clear-event-time selection-clear-event-time
create-selection-request-event create-selection-request-event
selection-request-event? selection-request-event?
selection-request-event-type selection-request-event-type
selection-request-event-serial selection-request-event-serial
selection-request-event-send-event? selection-request-event-send-event?
selection-request-event-display selection-request-event-display
selection-request-event-owner selection-request-event-owner
selection-request-event-requestor selection-request-event-requestor
selection-request-event-selection selection-request-event-selection
selection-request-event-target selection-request-event-target
selection-request-event-property selection-request-event-property
selection-request-event-time selection-request-event-time
create-selection-event create-selection-event
selection-event? selection-event?
selection-event-type selection-event-type
selection-event-serial selection-event-serial
selection-event-send-event? selection-event-send-event?
selection-event-display selection-event-display
selection-event-requestor selection-event-requestor
selection-event-selection selection-event-selection
selection-event-target selection-event-target
selection-event-property selection-event-property
selection-event-time selection-event-time
create-colormap-event create-colormap-event
colormap-event? colormap-event?
colormap-event-type colormap-event-type
colormap-event-serial colormap-event-serial
colormap-event-send-event? colormap-event-send-event?
colormap-event-display colormap-event-display
colormap-event-window colormap-event-window
colormap-event-colormap colormap-event-colormap
colormap-event-new? colormap-event-new?
colormap-event-state colormap-event-state
create-client-message-event create-client-message-event
client-message-event? client-message-event?
client-message-event-type client-message-event-type
client-message-event-serial client-message-event-serial
client-message-event-send-event? client-message-event-send-event?
client-message-event-display client-message-event-display
client-message-event-window client-message-event-window
client-message-event-message-type client-message-event-message-type
client-message-event-format client-message-event-format
client-message-event-data client-message-event-data
create-mapping-event create-mapping-event
mapping-event? mapping-event?
mapping-event-type mapping-event-type
mapping-event-serial mapping-event-serial
mapping-event-send-event? mapping-event-send-event?
mapping-event-display mapping-event-display
mapping-event-window mapping-event-window
mapping-event-request mapping-event-request
mapping-event-first-keycode mapping-event-first-keycode
mapping-event-count mapping-event-count
create-keymap-event create-keymap-event
keymap-event? keymap-event?
keymap-event-type keymap-event-type
keymap-event-serial keymap-event-serial
keymap-event-send-event? keymap-event-send-event?
keymap-event-display keymap-event-display
keymap-event-bit-vector keymap-event-bit-vector
)) ))
(define-interface xlib-text-interface (define-interface xlib-text-interface
(export text-width (export text-width
@ -909,4 +918,5 @@
xlib-grab-interface xlib-grab-interface
xlib-visual-interface xlib-visual-interface
xlib-region-interface xlib-region-interface
xlib-sync-x-events-interface
)) ))

View File

@ -79,7 +79,8 @@
finite-types) finite-types)
(files graphics)) (files graphics))
(define-structure xlib-event xlib-event-interface (define-structures ((xlib-event xlib-event-interface)
(xlib-event-internal xlib-event-internal-interface))
(open scsh-level-0 ;; for port->channel (open scsh-level-0 ;; for port->channel
scheme scheme
external-calls external-calls
@ -91,6 +92,14 @@
xlib-internal-types) xlib-internal-types)
(files event event-types)) (files event event-types))
(define-structure xlib-sync-x-events xlib-sync-x-events-interface
(open scheme
placeholders
define-record-types
threads
xlib-event)
(files sync-event))
(define-structure xlib-font xlib-font-interface (define-structure xlib-font xlib-font-interface
(open scheme (open scheme
signals ;; for error signals ;; for error
@ -231,5 +240,6 @@
xlib-grab xlib-grab
xlib-visual xlib-visual
xlib-region xlib-region
xlib-sync-x-events
) )
(optimize auto-integrate)) (optimize auto-integrate))