src/video/cocoa/SDL_cocoawindow.m
changeset 9623 b381999d8944
parent 9619 b94b6d0bff0f
child 9628 065e4ddc8753
     1.1 --- a/src/video/cocoa/SDL_cocoawindow.m	Tue May 26 09:55:41 2015 -0400
     1.2 +++ b/src/video/cocoa/SDL_cocoawindow.m	Tue May 26 11:01:19 2015 -0400
     1.3 @@ -962,14 +962,29 @@
     1.4  
     1.5  @end
     1.6  
     1.7 -@interface SDLView : NSView
     1.8 +@interface SDLView : NSView {
     1.9 +    SDL_Window *_sdlWindow;
    1.10 +}
    1.11 +
    1.12 +- (void)setSDLWindow:(SDL_Window*)window;
    1.13  
    1.14  /* The default implementation doesn't pass rightMouseDown to responder chain */
    1.15  - (void)rightMouseDown:(NSEvent *)theEvent;
    1.16  - (BOOL)mouseDownCanMoveWindow;
    1.17 +- (void)drawRect:(NSRect)dirtyRect;
    1.18  @end
    1.19  
    1.20  @implementation SDLView
    1.21 +- (void)setSDLWindow:(SDL_Window*)window
    1.22 +{
    1.23 +    _sdlWindow = window;
    1.24 +}
    1.25 +
    1.26 +- (void)drawRect:(NSRect)dirtyRect
    1.27 +{
    1.28 +    SDL_SendWindowEvent(_sdlWindow, SDL_WINDOWEVENT_EXPOSED, 0, 0);
    1.29 +}
    1.30 +
    1.31  - (void)rightMouseDown:(NSEvent *)theEvent
    1.32  {
    1.33      [[self nextResponder] rightMouseDown:theEvent];
    1.34 @@ -1136,7 +1151,8 @@
    1.35  
    1.36      /* Create a default view for this window */
    1.37      rect = [nswindow contentRectForFrameRect:[nswindow frame]];
    1.38 -    NSView *contentView = [[SDLView alloc] initWithFrame:rect];
    1.39 +    SDLView *contentView = [[SDLView alloc] initWithFrame:rect];
    1.40 +    [contentView setSDLWindow:window];
    1.41  
    1.42      if (window->flags & SDL_WINDOW_ALLOW_HIGHDPI) {
    1.43          if ([contentView respondsToSelector:@selector(setWantsBestResolutionOpenGLSurface:)]) {