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

Commit

Permalink
Fixed bug 1496 - SDLView not created for a Cocoa window, resulting in…
Browse files Browse the repository at this point in the history
… missing right mouse clicks

When you create an nswindow it automatically gets a default view, so we'll just create an SDLView if we're creating the window.
  • Loading branch information
slouken committed Sep 28, 2012
1 parent 49e5ff4 commit f1c0b89
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions src/video/cocoa/SDL_cocoawindow.m
Expand Up @@ -530,14 +530,6 @@ - (void)rightMouseDown:(NSEvent *)theEvent
/* Fill in the SDL window with the window data */
{
NSRect rect = [nswindow contentRectForFrameRect:[nswindow frame]];
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;
window->y = (int)rect.origin.y;
Expand Down Expand Up @@ -627,6 +619,12 @@ - (void)rightMouseDown:(NSEvent *)theEvent
}
nswindow = [[SDLWindow alloc] initWithContentRect:rect styleMask:style backing:NSBackingStoreBuffered defer:YES screen:screen];

// Create a default view for this window
rect = [nswindow contentRectForFrameRect:[nswindow frame]];
NSView *contentView = [[SDLView alloc] initWithFrame:rect];
[nswindow setContentView: contentView];
[contentView release];

[pool release];

if (SetupWindowData(_this, window, nswindow, SDL_TRUE) < 0) {
Expand Down

0 comments on commit f1c0b89

Please sign in to comment.