Commit d344b8d4 authored by Sam Lantinga's avatar Sam Lantinga

Fixed bug 1303 - SDL_CreateFromWindow duplicates window (Cocoa only)

Jens Köhler 2011-09-09 04:47:40 PDT

When calling SDL_CreateWindowFrom with a NSWindow which already contains a
NSView, the window will be duplicated because another NSView is added. I
attached a possible fix that prevents the creation of a second NSView.
parent 0093511f
...@@ -526,9 +526,13 @@ SetupWindowData(_THIS, SDL_Window * window, NSWindow *nswindow, SDL_bool created ...@@ -526,9 +526,13 @@ SetupWindowData(_THIS, SDL_Window * window, NSWindow *nswindow, SDL_bool created
/* Fill in the SDL window with the window data */ /* Fill in the SDL window with the window data */
{ {
NSRect rect = [nswindow contentRectForFrameRect:[nswindow frame]]; NSRect rect = [nswindow contentRectForFrameRect:[nswindow frame]];
NSView *contentView = [[SDLView alloc] initWithFrame:rect]; NSView *contentView = [ nswindow contentView ];
[nswindow setContentView: contentView]; /* Create view if not already exists */
[contentView release]; if (!contentView) {
contentView = [[SDLView alloc] initWithFrame:rect];
[nswindow setContentView: contentView];
[contentView release];
}
ConvertNSRect(&rect); ConvertNSRect(&rect);
window->x = (int)rect.origin.x; window->x = (int)rect.origin.x;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment