macOS: removed deprecated UpdateSystemActivity() call.
authorRyan C. Gordon <icculus@icculus.org>
Fri, 25 Nov 2016 00:13:13 -0500
changeset 10651f0065b8e6541
parent 10650 b6ec7005ca15
child 10652 c3fbfa229d71
macOS: removed deprecated UpdateSystemActivity() call.

The non-deprecated approach (IOPMAssertion) already exists in SDL, and is
available in Mac OS X 10.6 and later (although it was incorrectly listed as
10.7 and later in SDL). Since SDL now requires 10.6 or later, this is no
longer conditionally used.
src/video/cocoa/SDL_cocoaevents.m
src/video/cocoa/SDL_cocoavideo.h
src/video/cocoa/SDL_cocoavideo.m
     1.1 --- a/src/video/cocoa/SDL_cocoaevents.m	Thu Nov 24 21:41:09 2016 -0500
     1.2 +++ b/src/video/cocoa/SDL_cocoaevents.m	Fri Nov 25 00:13:13 2016 -0500
     1.3 @@ -394,17 +394,6 @@
     1.4  Cocoa_PumpEvents(_THIS)
     1.5  { @autoreleasepool
     1.6  {
     1.7 -    /* Update activity every 30 seconds to prevent screensaver */
     1.8 -    SDL_VideoData *data = (SDL_VideoData *)_this->driverdata;
     1.9 -    if (_this->suspend_screensaver && !data->screensaver_use_iopm) {
    1.10 -        Uint32 now = SDL_GetTicks();
    1.11 -        if (!data->screensaver_activity ||
    1.12 -            SDL_TICKS_PASSED(now, data->screensaver_activity + 30000)) {
    1.13 -            UpdateSystemActivity(UsrActivity);
    1.14 -            data->screensaver_activity = now;
    1.15 -        }
    1.16 -    }
    1.17 -
    1.18      for ( ; ; ) {
    1.19          NSEvent *event = [NSApp nextEventMatchingMask:NSAnyEventMask untilDate:[NSDate distantPast] inMode:NSDefaultRunLoopMode dequeue:YES ];
    1.20          if ( event == nil ) {
    1.21 @@ -426,10 +415,6 @@
    1.22  {
    1.23      SDL_VideoData *data = (SDL_VideoData *)_this->driverdata;
    1.24  
    1.25 -    if (!data->screensaver_use_iopm) {
    1.26 -        return;
    1.27 -    }
    1.28 -
    1.29      if (data->screensaver_assertion) {
    1.30          IOPMAssertionRelease(data->screensaver_assertion);
    1.31          data->screensaver_assertion = 0;
     2.1 --- a/src/video/cocoa/SDL_cocoavideo.h	Thu Nov 24 21:41:09 2016 -0500
     2.2 +++ b/src/video/cocoa/SDL_cocoavideo.h	Fri Nov 25 00:13:13 2016 -0500
     2.3 @@ -52,7 +52,6 @@
     2.4      SDLTranslatorResponder *fieldEdit;
     2.5      NSInteger clipboard_count;
     2.6      Uint32 screensaver_activity;
     2.7 -    BOOL screensaver_use_iopm;
     2.8      IOPMAssertionID screensaver_assertion;
     2.9  
    2.10  } SDL_VideoData;
     3.1 --- a/src/video/cocoa/SDL_cocoavideo.m	Thu Nov 24 21:41:09 2016 -0500
     3.2 +++ b/src/video/cocoa/SDL_cocoavideo.m	Fri Nov 25 00:13:13 2016 -0500
     3.3 @@ -152,9 +152,6 @@
     3.4  
     3.5      data->allow_spaces = ((floor(NSAppKitVersionNumber) > NSAppKitVersionNumber10_6) && SDL_GetHintBoolean(SDL_HINT_VIDEO_MAC_FULLSCREEN_SPACES, SDL_TRUE));
     3.6  
     3.7 -    /* The IOPM assertion API can disable the screensaver as of 10.7. */
     3.8 -    data->screensaver_use_iopm = floor(NSAppKitVersionNumber) > NSAppKitVersionNumber10_6;
     3.9 -
    3.10      return 0;
    3.11  }
    3.12