• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
(Solved, sort of) Converting mouse coordinates in fullscreen context?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

(Solved, sort of) Converting mouse coordinates in fullscreen context?


  • Subject: (Solved, sort of) Converting mouse coordinates in fullscreen context?
  • From: arekkusu <email@hidden>
  • Date: Wed, 26 Feb 2003 03:54:56 -0800

Thanks to those who replied.

The iDevGames thread:
http://www.idevgames.com/forum/showthread.php?s=&threadid=1461
mentions that this is a known bug between CG and NSScreen.

So, I had to split my mouse code into two paths, but now it works fine
via:

- (void) mouseDown:(NSEvent*)event {
NSPoint loc;
if (!fullscreen) {
loc = [self convertPoint:[event locationInWindow] fromView:nil];
}
else {
loc = [NSEvent mouseLocation]; // global screen coords
loc.y -= (screendim.size.height); // screendim set to [[win
screen] frame] when entering fullscreen
loc.y *= -1; // flipped coord system
}
....
}



On Monday, February 24, 2003, at 09:59 PM, arekkusu wrote:
> Here's my problem: in windowed mode I am getting sensible mouse
> coordinates via:
>
> - (void) mouseDown:(NSEvent*)event{
> NSPoint loc = [viewport convertPoint:[event locationInWindow]
> fromView:nil];
> NSLog(@"mouse down (%@): (%f, %f)", event, loc.x, loc.y);
> }
>
> e.g. from (0,0) to (639,399) in a 640x400 window (although the resize
> widget obscures one corner, as expected.)
>
> But, in a fullscreen context, 896x600 for example, the same function
> reports mouse coordinates from (0, -454) to (895, 145).
> The vertical coordinates change depending on how big the (windowed
> mode) window is, but they always include some negative values.
_______________________________________________
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.

References: 
 >Re: Converting mouse coordinates in fullscreen context? (From: publiclook <email@hidden>)

  • Prev by Date: connect() issues
  • Next by Date: Adding your app to the Login Items?
  • Previous by thread: Re: Converting mouse coordinates in fullscreen context?
  • Next by thread: SIGPIPE while printing after ~10 minutes
  • Index(es):
    • Date
    • Thread