[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

grabbing `system' events

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

Looking through Inside Macintosh I think these are called system
events, but I didn't see how to suppress the system behavior of these

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.

    (ccl::%stack-block ((where 4))
      (let ((ccl::*eventhook* #'ignore-mouse-down-events))
        ;; Wait for a click.
          (when (ccl:mouse-down-p)
  	  (#_GetMouse :ptr where)
  	  (return t)))
        ;; Make sure we gobble the click
        ;; 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)))

Kevin Gallagher
Blackboard Technology Group