widget-tree sync eventloop - 2

This commit is contained in:
erana 2012-01-17 15:23:37 +09:00
parent 9b58a8ab89
commit 85fb2c868b
1 changed files with 10 additions and 5 deletions

View File

@ -31,7 +31,8 @@
;; for inits see scgame.scm
;; FIXME refactor and cleanup
;;
;; run (widget-tree-eventloop dpy win widget-tree)
;; widget tree
@ -223,18 +224,22 @@
(let ((e (receive channel)))
(cond
((motion-event? e)
(set! mousex (motion-event-x))
(set! mousey (motion-event-y)))
(set! mousex motion-event-x)
(set! mousey motion-event-y))
((map-event? e)
(map-window dpy win))
(map-window dpy map-event-window))
((unmap-event? e)
(unmap-window dpy win))
(unmap-window dpy unmap-event-window))
((button-event? e)
(let ((state button-event-state))
(let ((widget (widget-node-collide? widget-tree mousex mouse)))
(if state
((widget 'press!))
((widget 'release!))))))
((expose-event? e)
(expose-window dpy expose-event-window))
((destroy-widow-event? e)
(expose-window dpy destroy-window-event-window))
(else #f))))
(loop))))))