[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
grabbing `system' events
- To: info-mcl@cambridge.apple.com
- Subject: grabbing `system' events
- From: kevin@freya.cs.umass.edu
- Date: Mon, 20 Jun 94 14:50:31 -0400
- Reply-to: gallagher@cs.umass.edu
Normally, when you're running an application if you click on the
desktop or on a window belonging to another application, the finder or
the other application is brought to the front. I would like to be
able to temporarily supress this behavior. I would like to allow the
user to click anywhere on the screen and still leave MCL as the active
application.
Looking through Inside Macintosh I think these are called system
events, but I didn't see how to suppress the system behavior of these
events.
The following function does what I want if the click happens to be in
an MCL window. But, if the click is on the desktop or another window,
the position is reported correctly but the other application is also
brought to the front.
(defun GET-SCREEN-POSITION-FROM-USER ()
(ccl::%stack-block ((where 4))
(let ((ccl::*eventhook* #'ignore-mouse-down-events))
;; Wait for a click.
(loop
(when (ccl:mouse-down-p)
(#_GetMouse :ptr where)
(return t)))
;; Make sure we gobble the click
(ccl::event-dispatch)
;; GetMouse returns values in the coordinate system of the
;; current GrafPort. We want global coordinates.
(#_LocalToGlobal :ptr where))
(values (ccl:point-h (ccl::%get-long where))
(ccl:point-v (ccl::%get-long where)))))
(defun ignore-mouse-down-events ()
(=& #$MouseDown (ccl:rref ccl:*current-event* :EventRecord.What)))
Thanks,
Kevin Gallagher
Blackboard Technology Group