[SDL] Showing zoom button on Mac non-resizable window

Michael Ryan Bannon mrbannon at swen.uwaterloo.ca
Tue Jul 18 13:39:34 PDT 2006


Hi,

Well, I finally got around to trying a couple things.
Right after the SDL_SetVideoMode call, I did the following:

NSWindow* window = [NSApp mainWindow];
NSButton* button = [window standardWindowButton:NSWindowZoomButton];
[window setShowsResizeIndicator:YES];  // I don't really want the resize 
indicator...I'm just doing this to see what happens.
[button display];

Unfortunately, these calls didn't change anything.
How exactly does SDL turn off things in the first place?

Thanks,

Ryan

"E. Wing" <ewmailing at gmail.com> wrote in message 
news:3c7e3c8a0606211542j6788d3fcj91e5dcb5e698f482 at mail.gmail.com...
> There is probably a way to do this, but you are probably going to be
> side stepping SDL to achieve this.
>
> In general (outside of SDL), what you describe seems possible. The
> Calculator.app behaves kind of like this. You can't resize it, but the
> green button transforms the calculator between Basic, Scientific, and
> Programmer modes.
>
> I sadly don't have time to actually try implementing any of this, but
> I suspect you might start defining SDL_RESIZABLE and then try turning
> things off.
>
> A quick search through the NSWindow documentation shows this method:
>
> - (void)setShowsResizeIndicator:(BOOL)showResizeIndicator
> Specifies whether the receiver's resize indicator is visible
>
> I'm hoping this will just turn off the resize indicator in the
> bottom-right corner. But if not, or if you need to start with
> SDL_RESIZABLE off, it looks like there are masks for this stuff.
> NSWindowZoomButton (part of NSWindowButton enum) and
> NSResizableWindowMask turn up. You'll need to track down the API calls
> that work with this.
>
> Finally, to control what happens on 'Zoom', I don't think SDL offers
> anything here either (maybe I'm wrong). So you'll need to define what
> to do. It looks like NSWindow responds to the following delegate on
> zoom:
> - (NSRect)windowWillUseStandardFrame:(NSWindow *)sender
> defaultFrame:(NSRect)defaultFrame
> Invoked by the zoom: method while determining a frame the sender may
> be zoomed to.
>
> So you'll want to define this delegate and prepare for your fullscreen
> switch. However, it looks like this delegate is actually just part 1
> of a 6 part chain of events. And it looks like this method was
> designed to return a new size for your window, not necessarily switch
> to fullscreen.
>
> So if you can't switch to fullscreen directly from here, then you
> might need to set a NSNotification or push a custom event into the
> SDL_Event loop so you know to switch to fullscreen later.
>
> I suspect a convenient place to drop all this code is in the SDLMain.m 
> file.
>
> If you get all this working, I would certainly like to see your code.
> Maybe we can add it to the list of Xcode project templates we provide
> (some of which demonstrate tighter Cocoa integration like this).
>
> Good luck,
> Eric 







More information about the SDL mailing list