Re: Current mouse screen?
Re: Current mouse screen?
- Subject: Re: Current mouse screen?
- From: John Randolph <email@hidden>
- Date: Mon, 19 Apr 2004 16:44:44 -0700
On Apr 18, 2004, at 2:42 AM, M. Uli Kusterer wrote:
At 10:51 Uhr -0700 17.04.2004, Shaun Wexler wrote:
On Apr 17, 2004, at 10:16 AM, Ondra Cada wrote:
Anybody knows how to find the screen the mouse is currently on? The
position is easy ([NSEvent mousePosition]), but I did not succeed to
find the screen...
NSPoint mouseLoc = [NSEvent mouseLocation];
NSEnumerator *screenEnum = [[NSScreen screens] objectEnumerator];
NSScreen screen;
while ((screen = [screenEnum nextObject]) && !NSMouseInRect(mouseLoc,
[screen frame], NO));
Usual disclaimers apply; written in Mail.app.
That should be NSPointInRect() instead of NSMouseInRect(), AFAIK.
Actually, NSMouseInRect() still exists.. It accounts for flipped
coordinate spaces, which NSPointInRect() doesn't.
-jcr
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.