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

Pointing at a window.

I'd like to be able to choose (not select) a window by pointing at it
with the mouse.  I'm using _GetMouse to get the location of the mouse
click and _FindWindow to then determine which window (if any) is under
the mouse.  However, no matter where I click _FindWindow returns 0
(meaning on the desktop) and WHICH-WINDOW is not a pointer to a window.
The _GetMouse call seems to work fine, because the point I get back is

Can anybody tell me what I'm doing wrong? 

(in-package 'user)

(require :records)
(require :traps)

(defun point-at-a-window ()
  (ccl:%stack-block ((where 4))
    (ccl:%put-word where 0 0)
    (ccl:%put-word where 0 2)
    (do () ((ccl:mouse-down-p) t))
    (ccl:_GetMouse :long where)
    (ccl:rlet ((which-window :window))
      (let ((result (ccl:_FindWindow :long where :ptr which-window :word)))
        (print-db (ccl:point-string (ccl:%get-long where))
                  (ccl:%ptr-to-int which-window)
                  (ccl:rref which-window :window.windowkind)
                  (ccl:pointerp which-window)
                  (ccl:zone-pointerp which-window)
                  (ccl:handlep which-window))))))

Next question: Is there any way to click in an unselected window without
causing that window to become the selected window?  I have an
application that displays stuff in several windows.  The user can
interact with the displayed stuff using the mouse to point at things,
mark regions, etc.  However, there's no reason to ever make the window
clicked on be the selected window.  It just causes confusion.

This is a problem with my point-at-a-window function above.  Clicking
on the window to choose it, also selects it.

Thanks for your help,

Kevin Gallagher