iDevGames Forums
22 pixel dead spot in fullscreen - Printable Version

+- iDevGames Forums (http://www.idevgames.com/forums)
+-- Forum: Development Zone (/forum-3.html)
+--- Forum: Game Programming Fundamentals (/forum-7.html)
+--- Thread: 22 pixel dead spot in fullscreen (/thread-3254.html)



22 pixel dead spot in fullscreen - GaJai - Jun 8, 2007 09:47 PM

This game uses apples opengl fullscreen example as a starting point. It uses the standard cocoa event mechanism. It runs in both windowed and full screen mode. In full screen mode the upper 22 pixels of the screen do not register mouse down events. Mouse moved events are registered. The screen is set for 1024 x 768. Moused moved events occur right up to pixel 768, while no mouse down events occur above pixel 746. I’ve switched the resolution to 800 x 600, and as I expected the same 22 pixel dead spot occurs. Has anyone experienced this before? Does it have something to do with the event architecture expecting the menu bar at the top of the screen?

code snippet (probably not of much value but included anyway)

in the handle full screen routine
- (IBAction) goFullScreen:(id)sender
{...
while (stayInFullScreenMode) {
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];

NSEvent *event;
while (event = [NSApp nextEventMatchingMask:NSAnyEventMask untilDate: [NSDate distantPast] inMode:NSDefaultRunLoopMode dequeue:YES]) {

switch ([event type]) {
case NSLeftMouseDown:
[self mouseDown:event];
break;
case NSMouseMoved:
[self mouseDown:event];
break;
...}

- (void)mouseDown:(NSEvent *)theEvent
{...
currentMouse = [openGLView convertPoint:(NSPoint)[ theEvent locationInWindow ] fromView:(NSView *)nil];
if (stayInFullScreenMode) currentMouse.y += FULLSCREEN_OFFSET_Y;

switch ([theEvent type]) {

case NSMouseMoved:
[[[theInfoScreen theFakeWindow] myNumber1] setFloatValue:currentMouse.y ]; //768 highest number
break;

case NSLeftMouseDown:
[[[theInfoScreen theFakeWindow] myNumber2] setFloatValue:currentMouse.y ]; // 746 highest number

... }


22 pixel dead spot in fullscreen - AnotherJake - Jun 8, 2007 10:05 PM

I don't remember their example, but I do know that you have to specifically hide the menu bar in full screen or the mouse events will pass through to the menus, even if you've captured displays. I think the call is [NSMenu setMenuBarVisible:NO], but I'm not on my dev computer right now so I can't confirm that. You should remember to make it visible again when coming back out of full screen.

BTW, if you're really good while you're in full screen you can actually click on the screen where the menus are and run them. Like if you click on where the app menu is and then move down to where quit would be it'll quit the app. I don't know if it's a bug or what, but it's dumb. Hiding the menu bar will disable that behavior.


22 pixel dead spot in fullscreen - Fenris - Jun 9, 2007 12:38 AM

Yes, this is what causes your problem –Â*I had the same before.


22 pixel dead spot in fullscreen - OneSadCookie - Jun 9, 2007 02:05 AM

You'll also find there's a slow area at the bottom of your screen where the dock is. Hiding the menu bar hides the dock and fixes that too Smile


22 pixel dead spot in fullscreen - GaJai - Jun 12, 2007 07:50 PM

Thanks guys the command was:

[NSMenu setMenuBarVisible:NO];

It's fairly straight forward. For the record I played around a little and was able to launch the system preferences from an invisible apple menu. The dock didn't seem to slow the app noticeable though. All in all a little wierd.

For anyone that comes after you need to disappear the menu before you go into full screen and reappear it before you go to window mode, otherwise you get odd behavior.