Fixes for setting custom cursor in quartz target. SDL-1.2
authorRyan C. Gordon
Fri, 30 Dec 2011 03:18:26 -0500
branchSDL-1.2
changeset 6121e6fcc5368210
parent 6118 adbed7ec5704
child 6122 7ba8d4c1b11d
Fixes for setting custom cursor in quartz target.

This fixes a logic error, and allows setting the cursor from off the main
thread, which isn't strictly a good idea, but previous versions of SDL on
Mac OS X apparently allowed it, so we'll make the effort here.

Fixes Bugzilla #1355.

Thanks to Alexei Svitkine for the patch!
src/video/quartz/SDL_QuartzWM.m
     1.1 --- a/src/video/quartz/SDL_QuartzWM.m	Thu Dec 29 12:21:49 2011 -0500
     1.2 +++ b/src/video/quartz/SDL_QuartzWM.m	Fri Dec 30 03:18:26 2011 -0500
     1.3 @@ -124,16 +124,14 @@
     1.4          QZ_UpdateCursor(this);
     1.5      }
     1.6      else {
     1.7 -        if (qz_window ==nil || (mode_flags & SDL_FULLSCREEN)) {
     1.8 -            [ cursor->nscursor set ];
     1.9 -        }
    1.10 -        else {
    1.11 +        if ( qz_window != nil && !(mode_flags & SDL_FULLSCREEN) ) {
    1.12              [ qz_window invalidateCursorRectsForView: [ qz_window contentView ] ];
    1.13          }
    1.14          if ( ! cursor_should_be_visible ) {
    1.15              cursor_should_be_visible = YES;
    1.16              QZ_ChangeGrabState (this, QZ_SHOWCURSOR);
    1.17          }
    1.18 +        [ cursor->nscursor performSelectorOnMainThread:@selector(set) withObject:nil waitUntilDone:NO ];
    1.19          QZ_UpdateCursor(this);
    1.20      }
    1.21