Skip to content
This repository has been archived by the owner on Feb 11, 2021. It is now read-only.

Commit

Permalink
Fixed bug 1303 - SDL_CreateFromWindow duplicates window (Cocoa only)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
slouken committed Jan 8, 2012
1 parent 91dfe95 commit 81102e2
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/video/cocoa/SDL_cocoawindow.m
Expand Up @@ -526,9 +526,13 @@ - (void)rightMouseDown:(NSEvent *)theEvent
/* 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;
Expand Down

0 comments on commit 81102e2

Please sign in to comment.