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.
This commit is contained in:
parent
0093511f82
commit
d344b8d4a2
1 changed files with 7 additions and 3 deletions
|
@ -526,9 +526,13 @@ SetupWindowData(_THIS, SDL_Window * window, NSWindow *nswindow, SDL_bool created
|
|||
/* Fill in the SDL window with the window data */
|
||||
{
|
||||
NSRect rect = [nswindow contentRectForFrameRect:[nswindow frame]];
|
||||
NSView *contentView = [[SDLView alloc] initWithFrame:rect];
|
||||
[nswindow setContentView: contentView];
|
||||
[contentView release];
|
||||
NSView *contentView = [ nswindow contentView ];
|
||||
/* Create view if not already exists */
|
||||
if (!contentView) {
|
||||
contentView = [[SDLView alloc] initWithFrame:rect];
|
||||
[nswindow setContentView: contentView];
|
||||
[contentView release];
|
||||
}
|
||||
|
||||
ConvertNSRect(&rect);
|
||||
window->x = (int)rect.origin.x;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue