PageRenderTime 55ms CodeModel.GetById 20ms RepoModel.GetById 0ms app.codeStats 1ms

/src/events.sc

https://bitbucket.org/bunny351/ezd
Scala | 585 lines | 520 code | 65 blank | 0 comment | 7 complexity | 5ecf87cfec2fe647724b420427c1c4d9 MD5 | raw file
  1. ;;; ezd - easy drawing for X11 displays.
  2. ;;;
  3. ;;; Event handling.
  4. ;* Copyright 1990-1993 Digital Equipment Corporation
  5. ;* All Rights Reserved
  6. ;*
  7. ;* Permission to use, copy, and modify this software and its documentation is
  8. ;* hereby granted only under the following terms and conditions. Both the
  9. ;* above copyright notice and this permission notice must appear in all copies
  10. ;* of the software, derivative works or modified versions, and any portions
  11. ;* thereof, and both notices must appear in supporting documentation.
  12. ;*
  13. ;* Users of this software agree to the terms and conditions set forth herein,
  14. ;* and hereby grant back to Digital a non-exclusive, unrestricted, royalty-free
  15. ;* right and license under any changes, enhancements or extensions made to the
  16. ;* core functions of the software, including but not limited to those affording
  17. ;* compatibility with other hardware or software environments, but excluding
  18. ;* applications which incorporate this software. Users further agree to use
  19. ;* their best efforts to return to Digital any such changes, enhancements or
  20. ;* extensions that they make and inform Digital of noteworthy uses of this
  21. ;* software. Correspondence should be provided to Digital at:
  22. ;*
  23. ;* Director of Licensing
  24. ;* Western Research Laboratory
  25. ;* Digital Equipment Corporation
  26. ;* 250 University Avenue
  27. ;* Palo Alto, California 94301
  28. ;*
  29. ;* This software may be distributed (but not offered for sale or transferred
  30. ;* for compensation) to third parties, provided such third parties agree to
  31. ;* abide by the terms and conditions of this notice.
  32. ;*
  33. ;* THE SOFTWARE IS PROVIDED "AS IS" AND DIGITAL EQUIPMENT CORP. DISCLAIMS ALL
  34. ;* WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF
  35. ;* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL DIGITAL EQUIPMENT
  36. ;* CORPORATION BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
  37. ;* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
  38. ;* PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
  39. ;* ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
  40. ;* SOFTWARE.
  41. (module events)
  42. (include "struct.sch")
  43. (include "commands.sch")
  44. (include "display.sch")
  45. (include "window.sch")
  46. (include "view.sch")
  47. (include "drawing.sch")
  48. (include "graphic.sch")
  49. (include "xternal.sch")
  50. ;;; Pointing device motion and keyboard input are reported to ezd by events.
  51. ;;; Events are represented by event records of the following form. Lists of
  52. ;;; events are a part of each drawing and graphic.
  53. (define-structure EVENT
  54. type ;;; Symbolic event type.
  55. modifier-mask ;;; Button modifier bitmask.
  56. modifier-names ;;; Button modifier list of symbols.
  57. action) ;;; Action procedure.
  58. (define-in-line-structure-access EVENT
  59. type
  60. modifier-mask
  61. modifier-names
  62. action)
  63. ;;; Event handlers are defined by the "when" command that has the following
  64. ;;; syntax:
  65. ;;;
  66. ;;; (when <object> <event> <action>)
  67. ;;;
  68. ;;; <object> specifies the object name where the event is to be handled. The
  69. ;;; object name "*" indicates that the event handler is for any object that
  70. ;;; does not have an explicit event handler.
  71. ;;;
  72. ;;; <event> is one of the following event types:
  73. ;;;
  74. ;;; ENTER pointing device entered the object.
  75. ;;; EXIT pointing device exitied the object.
  76. ;;; MOTION pointing device moved within the object.
  77. ;;; BUTTONbUP button "b" up in the object.
  78. ;;; BUTTONbDOWN button "b" down in the object. A down button event
  79. ;;; may be preceeded by any combination of SHIFT, META,
  80. ;;; CTRL, and LOCK indicating that those keys must be down
  81. ;;; for the event to occur.
  82. ;;; KEYPRESS any keyboard key down in the object.
  83. ;;; KEYRELEASE any keyboard key up in the object.
  84. ;;;
  85. ;;; RESIZE window containing the drawing was resized.
  86. ;;; EXPOSE window containing the drawing was exposed.
  87. ;;; OVERLAY the drawing was overlayed or underlayed into a window.
  88. ;;; VISIBLE a portion of the drawing is now visible in some window.
  89. ;;;
  90. ;;; GET-ATTRIBUTES message to read attribute values.
  91. ;;; SET-ATTRIBUTES message to set attribute values.
  92. ;;;
  93. ;;; * only allowed with action equal to #f to delete all
  94. ;;; event handlers.
  95. ;;;
  96. ;;; <action> is either the procedure handling the event, or a Scheme expression
  97. ;;; to be evaluated when the event occurs. When the event occurs, the action
  98. ;;; is invoked, and the following information is available as top-level
  99. ;;; bindings:
  100. ;;;
  101. ;;; *USER-EVENT-WINDOW* window name
  102. ;;; *USER-EVENT-DRAWING* drawing name
  103. ;;; *USER-EVENT-OBJECT* object name or #f
  104. ;;; *USER-EVENT-X* mouse position in drawing coordinate system
  105. ;;; *USER-EVENT-Y*
  106. ;;; *USER-EVENT-TYPE* event type
  107. ;;; *USER-EVENT-XEVENT* X event structure or #f
  108. ;;; *USER-EVENT-MISC* event specific items
  109. ;;;
  110. ;;; When the event type is SEND, the *USER-EVENT-WINDOW*, *USER-EVENT-X*,
  111. ;;; and *USER-EVENT-Y* fields are not valid.
  112. (define (WHEN-EVENT name event action)
  113. (define (ENCODE-MODIFIER)
  114. (let loop ((mods (car event)) (mask 0))
  115. (if (pair? mods)
  116. (loop (cdr mods)
  117. (bit-or mask
  118. (cadr (assoc (car mods)
  119. `((shift ,shiftmask)
  120. (lock ,lockmask)
  121. (capslock ,lockmask)
  122. (control ,controlmask)
  123. (ctrl ,controlmask)
  124. (meta ,mod1mask)
  125. (compose ,mod1mask))))))
  126. mask)))
  127. (let ((modifier (if (symbol? event)
  128. 0
  129. (encode-modifier)))
  130. (type (if (symbol? event) event (cadr event)))
  131. (action (if (or (procedure? action) (eq? action #f))
  132. action
  133. (lambda () (eval action)))))
  134. (define (DELETE-EVENT evl)
  135. (if (pair? evl)
  136. (let ((e (car evl)))
  137. (if (and (equal? (event-type e) type)
  138. (equal? (event-modifier-mask e) modifier))
  139. (cdr evl)
  140. (cons (car evl) (delete-event (cdr evl)))))
  141. '()))
  142. (define (ADD-EVENT evl)
  143. (if action
  144. (append evl
  145. (list (make-event type modifier
  146. (if (zero? modifier) '() (car event))
  147. action)))
  148. evl))
  149. (cond ((eq? type '*)
  150. (cond ((not (eq? action #f))
  151. (ezd-error 'WHEN-EVENT
  152. "Event type * requires action #f"))
  153. ((not (eq? name '*))
  154. (graphic-events! (name->graphic name) '())
  155. (drawing-window-watch! *current-drawing*
  156. (remq name
  157. (drawing-window-watch *current-drawing*))))
  158. (else (drawing-events! *current-drawing* '()))))
  159. ((not (eq? name '*))
  160. (let ((g (name->graphic name)))
  161. (if (and (memq type '(expose overlay resize visible))
  162. (not (memq name (drawing-window-watch
  163. *current-drawing*))))
  164. (drawing-window-watch! *current-drawing*
  165. (cons name
  166. (drawing-window-watch *current-drawing*))))
  167. (graphic-events! g
  168. (add-event (delete-event (graphic-events g))))))
  169. (else (drawing-events! *current-drawing*
  170. (add-event (delete-event (drawing-events
  171. *current-drawing*))))))))
  172. (define (BUTTON-MODIFIER? x)
  173. (memq x '(shift meta control ctrl lock capslock hyper super)))
  174. (define (BUTTON-DOWN? x)
  175. (memq x '(button1down button2down button3down button4down button5down)))
  176. (define (WHEN-EVENT? x)
  177. (memq x '(button1down button2down button3down button4down button5down
  178. button1up button2up button3up button4up button5up
  179. enter exit motion keypress keyrelease resize expose overlay
  180. visible get-attributes set-attributes *)))
  181. (define-ezd-command
  182. `(when ,symbol?
  183. (or ((repeat ,button-modifier?) ,button-down?)
  184. (,when-event?))
  185. ,any?)
  186. "(when <object-name> <event> ... <action>)"
  187. when-event)
  188. ;;; A specific event is looked up in an event list by the following procedure.
  189. ;;; It returns the event or #f.
  190. (define (FIND-WHEN-EVENT events type modifier)
  191. (let loop ((events events))
  192. (if (pair? events)
  193. (let ((event (car events)))
  194. (if (and (eq? (event-type event) type)
  195. (eq? (event-modifier-mask event) modifier))
  196. event
  197. (loop (cdr events))))
  198. #f)))
  199. ;;; When a window is resized or exposed, all drawings expecting the event are
  200. ;;; notified by the following procedure.
  201. (define (HANDLE-WINDOW-EVENTS window event-type event args)
  202. (for-each
  203. (lambda (view)
  204. (handle-view-events view event-type event args)
  205. (if (eq? event-type 'resize) (handle-visible-events view)))
  206. (window-views window)))
  207. ;;; When a window related event happens to a specific view, the following
  208. ;;; procedure is called to invoke the event handlers. The general event
  209. ;;; handler (object = *) is called before any specific object event handlers.
  210. (define (HANDLE-VIEW-EVENTS view event-type event args)
  211. (let ((save-current-drawing *current-drawing*))
  212. (set! *current-drawing* (view-drawing view))
  213. (set-view view '())
  214. (user-action (find-when-event (drawing-events (view-drawing view))
  215. event-type 0) view #f event-type event args)
  216. (for-each
  217. (lambda (graphic-name)
  218. (let ((graphic (name-of-graphic? graphic-name)))
  219. (if graphic
  220. (user-action
  221. (find-when-event (graphic-events graphic)
  222. event-type 0)
  223. view graphic event-type event args))))
  224. (drawing-window-watch (view-drawing view)))
  225. (set! *current-drawing* save-current-drawing)))
  226. ;;; When an attribute message is sent to an object, the following procedure
  227. ;;; finds the event handler and calls it. If the event handler does not exist,
  228. ;;; then the message is ignored.
  229. (define (HANDLE-ATTRIBUTE-EVENTS drawing object event-type arguments)
  230. (let ((user-event (find-when-event
  231. (append (drawing-events (name->drawing drawing))
  232. (graphic-events (getprop object drawing)))
  233. event-type 0)))
  234. (if user-event
  235. (let ((save-current-drawing *current-drawing*))
  236. (set-drawing drawing)
  237. (set! *user-event-window* #f)
  238. (set! *user-event-drawing* drawing)
  239. (set! *user-event-object* object)
  240. (set! *user-event-x* #f)
  241. (set! *user-event-y* #f)
  242. (set! *user-event-type* event-type)
  243. (set! *user-event-xevent* #f)
  244. (set! *user-event-misc* arguments)
  245. (let ((result ((event-action user-event))))
  246. (set! *current-drawing* save-current-drawing)
  247. result))
  248. #f)))
  249. ;;; The following global variables maintain the current mouse state
  250. ;;; They are automatically updated when each X event is processed, or when
  251. ;;; changes are made to drawings displayed in the window containing the
  252. ;;; mouse.
  253. (define *MOUSE-X* 0)
  254. (define *MOUSE-Y* 0)
  255. (define *MOUSE-XWINDOW* #f)
  256. (define *MOUSE-WINDOW* #f)
  257. (define *MOUSE-WINDOW-X* 0)
  258. (define *MOUSE-WINDOW-Y* 0)
  259. (define *MOUSE-VIEW* #f)
  260. (define *MOUSE-OBJECT* #f)
  261. (define *MOUSE-BUTTON1* #f)
  262. (define *MOUSE-BUTTON2* #f)
  263. (define *MOUSE-BUTTON3* #f)
  264. (define *MOUSE-BUTTON4* #f)
  265. (define *MOUSE-BUTTON5* #f)
  266. ;;; Mouse state is maintained by the following procedure.
  267. (define (UPDATE-MOUSE event)
  268. (let ((event-type (xevent-type event)))
  269. (cond ((or (eq? event-type buttonpress)
  270. (eq? event-type buttonrelease))
  271. (set! *mouse-x* (xevent-xbutton-x_root event))
  272. (set! *mouse-y* (xevent-xbutton-y_root event))
  273. (set! *mouse-xwindow* (xevent-xbutton-window event))
  274. (if (eq? event-type buttonpress)
  275. (case (xevent-xbutton-button event)
  276. ((1) (set! *mouse-button1* #t))
  277. ((2) (set! *mouse-button2* #t))
  278. ((3) (set! *mouse-button3* #t))
  279. ((4) (set! *mouse-button4* #t))
  280. ((5) (set! *mouse-button5* #t)))
  281. (case (xevent-xbutton-button event)
  282. ((1) (set! *mouse-button1* #f))
  283. ((2) (set! *mouse-button2* #f))
  284. ((3) (set! *mouse-button3* #f))
  285. ((4) (set! *mouse-button4* #f))
  286. ((5) (set! *mouse-button5* #f)))))
  287. ((eq? event-type enternotify)
  288. (set! *mouse-x* (xevent-xcrossing-x_root event))
  289. (set! *mouse-y* (xevent-xcrossing-y_root event))
  290. (set! *mouse-xwindow* (xevent-xcrossing-window event))
  291. (set! *mouse-object* ""))
  292. ((eq? event-type leavenotify)
  293. (set! *mouse-x* (xevent-xcrossing-x_root event))
  294. (set! *mouse-y* (xevent-xcrossing-y_root event))
  295. (set! *mouse-window* #f)
  296. (set! *mouse-xwindow* #f)
  297. (set! *mouse-object* ""))
  298. ((eq? event-type motionnotify)
  299. (set! *mouse-x* (xevent-xmotion-x_root event))
  300. (set! *mouse-y* (xevent-xmotion-y_root event))
  301. (set! *mouse-xwindow* (xevent-xmotion-window event))))
  302. (if *trace-events*
  303. (format *trace-events* "~s (~s,~s) ~s~s~s~s~s ==> "
  304. (if *mouse-xwindow*
  305. (window-name
  306. (xwindow->window *mouse-xwindow*))
  307. #f)
  308. *mouse-x* *mouse-y* *mouse-button1* *mouse-button2*
  309. *mouse-button3* *mouse-button4* *mouse-button5*))))
  310. ;;; X event code to event name conversion.
  311. (define (EVENT->NAME code)
  312. (cond ((eq? code motionnotify) 'motionnotify)
  313. ((eq? code buttonpress) 'buttonpress)
  314. ((eq? code buttonrelease) 'buttonrelease)
  315. ((eq? code enternotify) 'enternotify)
  316. ((eq? code leavenotify) 'leavenotify)
  317. ((eq? code expose) 'expose)
  318. ((eq? code keypress) 'keypress)
  319. ((eq? code keyrelease) 'keyrelease)
  320. (else code)))
  321. ;;; Translate X button events to button symbol.
  322. (define (BUTTON-DOWN-SYMBOL event)
  323. (case (xevent-xbutton-button event)
  324. ((1) 'button1down)
  325. ((2) 'button2down)
  326. ((3) 'button3down)
  327. ((4) 'button4down)
  328. ((5) 'button5down)))
  329. (define (BUTTON-UP-SYMBOL event)
  330. (case (xevent-xbutton-button event)
  331. ((1) 'button1up)
  332. ((2) 'button2up)
  333. ((3) 'button3up)
  334. ((4) 'button4up)
  335. ((5) 'button5up)))
  336. ;;; Object entry, exit, and motion events are generated by the following
  337. ;;; procedure. Each time the mouse has moved, it is called with a window and
  338. ;;; position in window.
  339. (define (EXIT-ENTER event window x y)
  340. (let ((was-in *mouse-object*)
  341. (was-in-view *mouse-view*)
  342. (was-x *mouse-window-x*)
  343. (was-y *mouse-window-y*)
  344. (was-in-exit (find-when-event (is-in-events) 'exit 0)))
  345. (set! *mouse-window* window)
  346. (set! *mouse-window-x* x)
  347. (set! *mouse-window-y* y)
  348. (let loop ((views (reverse (window-views window))))
  349. (if (pair? views)
  350. (let* ((view (car views))
  351. (object (and (or (not (view-clip-minx view))
  352. (and (<= (view-clip-minx view)
  353. *mouse-window-x*
  354. (view-clip-maxx view))
  355. (<= (view-clip-miny view)
  356. *mouse-window-y*
  357. (view-clip-maxy view))))
  358. (bbgraphics-really-intersect view
  359. (- x 1) (- y 1) (+ x 1) (+ y 1)))))
  360. (if object
  361. (begin (set! *mouse-view* view)
  362. (set! *mouse-object* object))
  363. (loop (cdr views))))
  364. (begin (set! *mouse-view* #f)
  365. (set! *mouse-object* #f))))
  366. (if (eq? was-in *mouse-object*)
  367. (if (and (isa-graphic? *mouse-object*)
  368. (or (not (= was-x *mouse-window-x*))
  369. (not (= was-y *mouse-window-y*))))
  370. (user-action (find-when-event (is-in-events) 'motion 0)
  371. *mouse-view* *mouse-object* 'motion event '()))
  372. (begin (user-action was-in-exit was-in-view was-in 'exit event
  373. (if *mouse-view*
  374. `(,(window-name (view-window *mouse-view*))
  375. ,(drawing-name (view-drawing *mouse-view*))
  376. ,(graphic-name *mouse-object*))
  377. '(#f #f #f)))
  378. (if (isa-graphic? *mouse-object*)
  379. (user-action
  380. (find-when-event (is-in-events) 'enter 0)
  381. *mouse-view* *mouse-object* 'enter event '()))))))
  382. ;;; Return a list of possible events for a given window and the current mouse
  383. ;;; object.
  384. (define (IS-IN-EVENTS)
  385. (if (isa-graphic? *mouse-object*)
  386. (append (graphic-events *mouse-object*)
  387. (drawing-events (view-drawing *mouse-view*)))
  388. '()))
  389. ;;; Signal a possible user event. Once the user event has been run, the mouse
  390. ;;; position is recomputed if there was anything drawn in the mouse window.
  391. (define *CLEAN-MOUSE-WINDOW* #f)
  392. (define *USER-EVENT-WINDOW* #f)
  393. (define *USER-EVENT-DRAWING* #f)
  394. (define *USER-EVENT-OBJECT* #f)
  395. (define *USER-EVENT-X* #f)
  396. (define *USER-EVENT-Y* #f)
  397. (define *USER-EVENT-TYPE* #f)
  398. (define *USER-EVENT-XEVENT* #f)
  399. (define *USER-EVENT-MISC* #f)
  400. (define (USER-ACTION user-event view object user-event-type event misc)
  401. (when user-event
  402. (if *trace-events* (format *trace-events* "~s " user-event-type))
  403. (if object
  404. (begin (if (pair? (view-new-transform view))
  405. (display-event-handler *display*))
  406. (set! *user-event-object* (graphic-name object))
  407. (set! *user-event-x*
  408. ((view-x->user view) *mouse-window-x*))
  409. (set! *user-event-y*
  410. ((view-y->user view) *mouse-window-y*)))
  411. (begin (set! *user-event-object* '*)
  412. (set! *user-event-x* 0)
  413. (set! *user-event-y* 0)))
  414. (set! *clean-mouse-window* *mouse-window*)
  415. (set! *user-event-window* (window-name (view-window view)))
  416. (set! *user-event-drawing* (drawing-name (view-drawing view)))
  417. (set! *user-event-type* user-event-type)
  418. (set! *user-event-xevent* event)
  419. (set! *user-event-misc* misc)
  420. (set-drawing *user-event-drawing*)
  421. ((event-action user-event))
  422. (when (or (and (eq? user-event-type 'visible)
  423. (eq? *clean-mouse-window* (view-window view)))
  424. (and (not *clean-mouse-window*) *mouse-window*))
  425. (set! *clean-mouse-window* #f)
  426. (exit-enter #f *mouse-window* *mouse-window-x*
  427. *mouse-window-y*))
  428. (set! *clean-mouse-window* #f)))
  429. ;;; When an event occurs in a window, the window's views are examined from top
  430. ;;; to bottom until an object in which the event occurred is found. Before
  431. ;;; that object's event handler is called with the appropriate event, EXIT and
  432. ;;; ENTER events are generated as needed.
  433. (define *TRACE-EVENTS* #f)
  434. (define (HANDLE-WHEN-EVENTS window event)
  435. (let ((event-type (xevent-type event)))
  436. (if *trace-events*
  437. (format *trace-events* "X: ~s ~s ==> " (window-name window)
  438. (event->name event-type)))
  439. (cond ((eq? event-type buttonpress)
  440. (update-mouse event)
  441. (exit-enter event window
  442. (xevent-xbutton-x event) (xevent-xbutton-y event))
  443. (let ((user-event (find-when-event (is-in-events)
  444. (button-down-symbol event)
  445. (xevent-xbutton-state event))))
  446. (if user-event
  447. (user-action user-event *mouse-view* *mouse-object*
  448. (button-down-symbol event) event
  449. (event-modifier-names user-event)))))
  450. ((eq? event-type buttonrelease)
  451. (update-mouse event)
  452. (exit-enter event window
  453. (xevent-xbutton-x event) (xevent-xbutton-y event))
  454. (user-action
  455. (find-when-event (is-in-events)
  456. (button-up-symbol event) 0)
  457. *mouse-view* *mouse-object* (button-up-symbol event)
  458. event '()))
  459. ((eq? event-type enternotify)
  460. (update-mouse event)
  461. (exit-enter event window (xevent-xcrossing-x event)
  462. (xevent-xcrossing-y event)))
  463. ((eq? event-type leavenotify)
  464. (let ((was-in *mouse-object*)
  465. (was-in-view *mouse-view*)
  466. (was-in-exit (find-when-event (is-in-events) 'exit 0)))
  467. (update-mouse event)
  468. (user-action was-in-exit was-in-view was-in
  469. 'exit event '(#f #f #f))))
  470. ((eq? event-type keypress)
  471. (user-action
  472. (find-when-event (is-in-events) 'keypress 0)
  473. *mouse-view* *mouse-object* 'keypress event
  474. (ylookupstring event #t)))
  475. ((eq? event-type keyrelease)
  476. (user-action
  477. (find-when-event (is-in-events) 'keyrelease 0)
  478. *mouse-view* *mouse-object* 'keyrelease event
  479. (ylookupstring event #t)))
  480. ((eq? event-type motionnotify)
  481. (let loop ((event event))
  482. (if (and (> (xeventsqueued *dpy* queuedafterreading) 0)
  483. (eq? (xevent-type (xpeekevent *dpy*))
  484. motionnotify))
  485. (loop (xnextevent *dpy*))
  486. (when (and (< -1 (xevent-xmotion-x event)
  487. (window-width window))
  488. (< -1 (xevent-xmotion-y event)
  489. (window-height window)))
  490. (update-mouse event)
  491. (exit-enter event window
  492. (xevent-xmotion-x event)
  493. (xevent-xmotion-y event))))))
  494. ((eq? event-type expose)
  495. (handle-window-events window 'expose event '())))
  496. (if *trace-events* (format *trace-events* "~%"))))
  497. ;;; Module reset/initialization
  498. (define (EVENTS-MODULE-INIT)
  499. (set! *mouse-x* 0)
  500. (set! *mouse-y* 0)
  501. (set! *mouse-xwindow* #f)
  502. (set! *mouse-window* #f)
  503. (set! *mouse-window-x* 0)
  504. (set! *mouse-window-y* 0)
  505. (set! *mouse-view* #f)
  506. (set! *mouse-object* #f)
  507. (set! *mouse-button1* #f)
  508. (set! *mouse-button2* #f)
  509. (set! *mouse-button3* #f)
  510. (set! *mouse-button4* #f)
  511. (set! *mouse-button5* #f)
  512. (set! *clean-mouse-window* #f)
  513. (set! *user-event-window* #f)
  514. (set! *user-event-drawing* #f)
  515. (set! *user-event-object* #f)
  516. (set! *user-event-x* #f)
  517. (set! *user-event-y* #f)
  518. (set! *user-event-type* #f)
  519. (set! *user-event-xevent* #f)
  520. #t)