Fullscreen SDL/OpenGL & CMD-TAB problem

Member
Posts: 47
Joined: 2004.07
Post: #1
Hi guys...

In GooBall, we're using SDL to change screen res & go fullscreen for our OpenGL rendering. However, once we've done this, our app just ignores CMD-TAB.

Any pointers on how to fix this?

TIA,
Nicholas

Nicholas Francis
http://www.otee.dk
Quote this message in a reply
Sage
Posts: 1,231
Joined: 2002.10
Post: #2
Are you sure you want to fix it? When you use a real fullscreen GL context, you are telling the system that you want total control of all VRAM and optimal hardware pageflipping. The window manager goes away at this point, so Cmd-Tab, Dock etc are inactive.

The alternative is to make a regular windowed context, hide the menu bar, and size the context to the screen. But in this case, the window manager is still eating X MB of framebuffer, and still composites your view into the display which eats some performance. Additionally, VBL sync doesn't work as well on some (ATI) systems.

IMHO it is better to just lose Cmd-Tab, and let the user switch to windowed mode with Esc or Cmd-F.
Quote this message in a reply
Member
Posts: 47
Joined: 2004.07
Post: #3
What we would want would be to have CMD-TAB just go to the desktop (Or Finder, or whatever). Then we hide our app completely. I'm cool with handling it ourselves, the question is just how to notice the CMD-TAB

Nicholas Francis
http://www.otee.dk
Quote this message in a reply
Luminary
Posts: 5,125
Joined: 2002.04
Post: #4
SDL will give you command and tab key press events won't it?
Quote this message in a reply
Sage
Posts: 1,231
Joined: 2002.10
Post: #5
In a Cocoa app, you can intercept Cmd and Tab as regular NSEvents if you override NSApp's sendEvent method:
Code:
-(void)sendEvent:(NSEvent *)event {
if (([event type] == NSKeyDown) &&
    ([event modifierFlags] & NSCommandKeyMask) &&
    ([[event characters] characterAtIndex:0] == '\t')) {
        NSLog(@"User pressed Cmd-Tab");
        if (fullscreen) [self toggleFull:nil];
        return;
    }
    [super sendEvent: event];
}
Can't help you with integrating that into SDL, though.
Quote this message in a reply
Member
Posts: 47
Joined: 2004.07
Post: #6
Thanks for the code - I always thought CMD-TAB got handled by the system before the app got it.

Integrating with SDL is not a prob - we're hacking it anyways to do R2T.

Nicholas Francis
http://www.otee.dk
Quote this message in a reply
Post Reply 

Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  OpenGL Alpha Channel Problem Moganza 1 1,409 Jan 19, 2013 08:25 AM
Last Post: sealfin
  Mac OSX fullscreen application problem e40pud 7 5,488 Mar 12, 2010 05:41 AM
Last Post: OneSadCookie
  Simple OpenGL ES problem soulstorm 3 3,339 May 14, 2009 03:53 PM
Last Post: AnotherJake
  SDL/OpenGL fullscreen text rendering StealthyCoin 2 5,355 Mar 26, 2009 09:47 AM
Last Post: StealthyCoin
  Opengl picking problem (zip file) papillon68 1 3,738 Mar 1, 2009 08:49 PM
Last Post: chronus