Fixed bug: No right mouse button events during FullScreen Mac OS
authorSam Lantinga <slouken@libsdl.org>
Mon, 21 Mar 2011 16:36:17 -0700
changeset 5502ed5f117c949d
parent 5501 f48c1e0ca9ae
child 5503 be88d105e91c
Fixed bug: No right mouse button events during FullScreen Mac OS

Something inside setStyleMask mucks with the view responder chain, which prevents the listener from hearing the right mouse down events. We just reset the listener after changing the style to fix this.
src/video/cocoa/SDL_cocoawindow.m
     1.1 --- a/src/video/cocoa/SDL_cocoawindow.m	Mon Mar 21 13:33:53 2011 -0700
     1.2 +++ b/src/video/cocoa/SDL_cocoawindow.m	Mon Mar 21 16:36:17 2011 -0700
     1.3 @@ -792,6 +792,11 @@
     1.4      NSWindow *nswindow = data->nswindow;
     1.5      NSRect rect;
     1.6  
     1.7 +    /* The view responder chain gets messed with during setStyleMask */
     1.8 +    if ([[nswindow contentView] nextResponder] == data->listener) {
     1.9 +        [[nswindow contentView] setNextResponder:nil];
    1.10 +    }
    1.11 +
    1.12      if (fullscreen) {
    1.13          SDL_Rect bounds;
    1.14  
    1.15 @@ -827,6 +832,11 @@
    1.16          }
    1.17      }
    1.18  
    1.19 +    /* The view responder chain gets messed with during setStyleMask */
    1.20 +    if ([[nswindow contentView] nextResponder] != data->listener) {
    1.21 +        [[nswindow contentView] setNextResponder:data->listener];
    1.22 +    }
    1.23 +
    1.24      s_moveHack = 0;
    1.25      [nswindow setFrameOrigin:rect.origin];
    1.26      [nswindow setContentSize:rect.size];