I have an event handler for mouse down events in the content region of a
window (under Carbon). To set up the handler, I have used the following
code:
EventTypeSpec mdEvent = { kEventClassWindow, kEventWindowClickContentRgn };
InstallEventHandler (GetWindowEventTarget (theWind),
NewEventHandlerUPP (theHandler), 1, &mdEvent, NULL, NULL);
Within theHandler(), I have code similar to the following:
GetPort (&prevPort);
SetPortWindowPort (theWind);
GetEventParameter (event, kEventParamWindowMouseLocation, typeQDPoint, NULL,
sizeof (where), NULL, &where);
if (PtInRect (where, &theRect))
...
I thought kEventParamWindowMouseLocation would return coordinates in
screen relative terms. This seems to be generally true, though the
vertical coordinates apprear to NOT take into account the top window
frame. [This is a standard document window with the three buttons in the
top left corner.]
Under older Mac OS versions I would grab the global coordinates of the
mouseDown and perform a GlobalToLocal() conversion. This worked correctly
and did take the window frame into account.
I am very new to OS X programming. Am I doing this incorrectly? What is
the right way?
Thanks,
John
--
John A. Dundas III
Director, Information Technology Services, Caltech
Mail Code: 014-81, Pasadena, CA 91125-8100
Phone: 626.395.3392 FAX: 626.449.6973
>> Stay informed about: Help locating click in OS X