22 pixel dead spot in fullscreen

GaJai
Unregistered
 
Post: #1
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

... }
Quote this message in a reply
Moderator
Posts: 3,570
Joined: 2003.06
Post: #2
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.
Quote this message in a reply
Oldtimer
Posts: 834
Joined: 2002.09
Post: #3
Yes, this is what causes your problem –Â*I had the same before.
Quote this message in a reply
Luminary
Posts: 5,143
Joined: 2002.04
Post: #4
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
Quote this message in a reply
GaJai
Unregistered
 
Post: #5
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.
Quote this message in a reply
Post Reply