Retrieving Mac window reference

Hello,

I recently posted a question to the newsgroup regarding SDL_SysWMinfo and
Mac. The purpose was to determine what exactly is the data that
SDL_GetWMInfo returns in a Mac environment. The response was that the data
field does not represent anything in a Mac environment.

So, my question now is how does one get a reference to the window that SDL
creates? Is there a method/technique that I missed (probably) or does it
have to be done somehow through Mac calls?

Thanks,

Ryan

So, my question now is how does one get a reference to the window that SDL
creates? Is there a method/technique that I missed (probably) or does it
have to be done somehow through Mac calls?

I’ve retreived it using this code snippet:

NSWindow *getMainWindow() {
NSWindow *window = [NSApp mainWindow];
if (window)
return window;
NSArray *windows = [NSApp windows];
if ([windows count] > 0)
return [windows objectAtIndex: 0];
return nil;
}

// MartinOn Fri, 14 Jul 2006, Michael Ryan Bannon wrote:

Thanks for the code.
I really don’t know Ojb-C that well…in fact, not at all. And my project
is all in C++, so I’ll either have to find another solution or learn Obj-C.
Would it be a good idea to add a method that returns the window reference
associated with a surface?

Thanks,

Ryan

“Martin Storsj?” wrote in message
news:Pine.LNX.4.64.0607142016070.26398 at localhost.localdomain…> On Fri, 14 Jul 2006, Michael Ryan Bannon wrote:

So, my question now is how does one get a reference to the window that
SDL
creates? Is there a method/technique that I missed (probably) or does it
have to be done somehow through Mac calls?

I’ve retreived it using this code snippet:

NSWindow *getMainWindow() {
NSWindow *window = [NSApp mainWindow];
if (window)
return window;
NSArray *windows = [NSApp windows];
if ([windows count] > 0)
return [windows objectAtIndex: 0];
return nil;
}

// Martin

Thanks for the code.
I really don’t know Ojb-C that well…in fact, not at all. And my
project
is all in C++, so I’ll either have to find another solution or
learn Obj-C.
Would it be a good idea to add a method that returns the window
reference
associated with a surface?

What the heck are you trying to do with the window reference anyway?
SDL apps can’t have multiple windows, and only one surface has
anything to do with the window, so a function to get a window
reference for a surface sounds kinda silly.

-bobOn Jul 14, 2006, at 12:58 PM, Michael Ryan Bannon wrote:

I’m trying to activate the maximize button while using the SDL no resize
option. I don’t think that’s too silly.
See the thread “Showing zoom button on Mac non-resizable window”.

“Bob Ippolito” wrote in message
news:E890E390-8859-45ED-A6D9-7F89A55FE920 at redivi.com…> On Jul 14, 2006, at 12:58 PM, Michael Ryan Bannon wrote:

Thanks for the code.
I really don’t know Ojb-C that well…in fact, not at all. And my
project
is all in C++, so I’ll either have to find another solution or
learn Obj-C.
Would it be a good idea to add a method that returns the window
reference
associated with a surface?

What the heck are you trying to do with the window reference anyway?
SDL apps can’t have multiple windows, and only one surface has
anything to do with the window, so a function to get a window
reference for a surface sounds kinda silly.

-bob

SDL allows for at most one window. You can get a reference to that
window directly from either Cocoa or Carbon. You do not need to ask
SDL for a window reference.

What you still need to do is figure out how to implement the window
behavior you’re looking for, but that doesn’t have anything to do
with SDL.

-bobOn Jul 14, 2006, at 1:31 PM, Michael Ryan Bannon wrote:

I’m trying to activate the maximize button while using the SDL no
resize
option. I don’t think that’s too silly.
See the thread “Showing zoom button on Mac non-resizable window”.

“Bob Ippolito” <@Bob_Ippolito> wrote in message
news:E890E390-8859-45ED-A6D9-7F89A55FE920 at redivi.com

On Jul 14, 2006, at 12:58 PM, Michael Ryan Bannon wrote:

Thanks for the code.
I really don’t know Ojb-C that well…in fact, not at all. And my
project
is all in C++, so I’ll either have to find another solution or
learn Obj-C.
Would it be a good idea to add a method that returns the window
reference
associated with a surface?

What the heck are you trying to do with the window reference anyway?
SDL apps can’t have multiple windows, and only one surface has
anything to do with the window, so a function to get a window
reference for a surface sounds kinda silly.

-bob


SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl

“Bob Ippolito” wrote in message
news:286E5CCD-545B-46BF-9C95-29A9377A355C at redivi.com

SDL allows for at most one window. You can get a reference to that
window directly from either Cocoa or Carbon. You do not need to ask
SDL for a window reference.

I ascertained that from Martin’s post and the other thread I mentioned.
I’ll try to find the best way via Carbon (I’ve been having some trouble
finding out how, still being a Mac novice, which is why I wanted to
double-check with SDL.)

What you still need to do is figure out how to implement the window
behavior you’re looking for, but that doesn’t have anything to do
with SDL.

Yes, I know. This has been discussed in the other thread I mentioned. If I
create a solution I will post it.

Thanks,

Ryan> -bob

On Jul 14, 2006, at 1:31 PM, Michael Ryan Bannon wrote:

I’m trying to activate the maximize button while using the SDL no
resize
option. I don’t think that’s too silly.
See the thread “Showing zoom button on Mac non-resizable window”.

“Bob Ippolito” wrote in message
news:E890E390-8859-45ED-A6D9-7F89A55FE920 at redivi.com

On Jul 14, 2006, at 12:58 PM, Michael Ryan Bannon wrote:

Thanks for the code.
I really don’t know Ojb-C that well…in fact, not at all. And my
project
is all in C++, so I’ll either have to find another solution or
learn Obj-C.
Would it be a good idea to add a method that returns the window
reference
associated with a surface?

What the heck are you trying to do with the window reference anyway?
SDL apps can’t have multiple windows, and only one surface has
anything to do with the window, so a function to get a window
reference for a surface sounds kinda silly.

-bob


SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl