From abf8b26c0ff2e62137fbaced222c747609ecb578 Mon Sep 17 00:00:00 2001 From: Ozkan Sezer Date: Wed, 13 Nov 2019 08:11:10 +0300 Subject: [PATCH] Revert changeset 67f391c74aee after the breakage report See: http://bugzilla.libsdl.org/show_bug.cgi?id=4114#c5 Also revert the change from Xcode project templates and adjust the changelogs. --- WhatsNew | 2 -- .../SDL Application/SDLMain.m | 30 ++++++++++++++++++- .../SDL OpenGL Application/SDLMain.m | 30 ++++++++++++++++++- .../SDL Application/SDLMain.m | 30 ++++++++++++++++++- .../SDL Cocoa Application/SDLMain.m | 30 ++++++++++++++++++- .../SDL OpenGL Application/SDLMain.m | 30 ++++++++++++++++++- .../SDL Application/SDLMain.m | 30 ++++++++++++++++++- .../SDL Cocoa Application/SDLMain.m | 30 ++++++++++++++++++- .../SDL OpenGL Application/SDLMain.m | 30 ++++++++++++++++++- docs.html | 4 --- src/main/macosx/SDLMain.m | 30 ++++++++++++++++++- 11 files changed, 261 insertions(+), 15 deletions(-) diff --git a/WhatsNew b/WhatsNew index 7bf504d2b..e1a1e07e8 100644 --- a/WhatsNew +++ b/WhatsNew @@ -55,8 +55,6 @@ Changes include: - Mac OS X, joystick: update to support Saitek p2500 gamepad (bug 2025) - Mac OS X, main: updates for -psn_XXX command line arg for Finder launches in new macOS versions. -- Mac OS X, main: replace deprecated CPS apis in new OSX versions - (bug 4114.) - Windows, video: fix other window positions/sizes when exiting fullscreen (bug 3315.) - Windows, keyboard: reset deadkeys upon SDL_EnableUNICODE() or upon diff --git a/Xcode/TemplatesForXcodeLeopard/SDL Application/SDLMain.m b/Xcode/TemplatesForXcodeLeopard/SDL Application/SDLMain.m index 6948979df..07d392eef 100644 --- a/Xcode/TemplatesForXcodeLeopard/SDL Application/SDLMain.m +++ b/Xcode/TemplatesForXcodeLeopard/SDL Application/SDLMain.m @@ -20,6 +20,22 @@ - (void)setAppleMenu:(NSMenu *)menu; /* Use this flag to determine whether we use SDLMain.nib or not */ #define SDL_USE_NIB_FILE 0 +/* Use this flag to determine whether we use CPS (docking) or not */ +#define SDL_USE_CPS 1 +#ifdef SDL_USE_CPS +/* Portions of CPS.h */ +typedef struct CPSProcessSerNum +{ + UInt32 lo; + UInt32 hi; +} CPSProcessSerNum; + +extern OSErr CPSGetCurrentProcess( CPSProcessSerNum *psn); +extern OSErr CPSEnableForegroundOperation( CPSProcessSerNum *psn, UInt32 _arg2, UInt32 _arg3, UInt32 _arg4, UInt32 _arg5); +extern OSErr CPSSetFrontProcess( CPSProcessSerNum *psn); + +#endif /* SDL_USE_CPS */ + static int gArgc; static char **gArgv; static BOOL gFinderLaunch; @@ -185,7 +201,18 @@ static void CustomApplicationMain (int argc, char **argv) SDLMain *sdlMain; /* Ensure the application object is initialised */ - [[NSApplication sharedApplication] activateIgnoringOtherApps: YES]; + [NSApplication sharedApplication]; + +#ifdef SDL_USE_CPS + { + CPSProcessSerNum PSN; + /* Tell the dock about us */ + if (!CPSGetCurrentProcess(&PSN)) + if (!CPSEnableForegroundOperation(&PSN,0x03,0x3C,0x2C,0x1103)) + if (!CPSSetFrontProcess(&PSN)) + [NSApplication sharedApplication]; + } +#endif /* SDL_USE_CPS */ /* Set up the menubar */ [NSApp setMainMenu:[[NSMenu alloc] init]]; @@ -318,6 +345,7 @@ - (NSString *)stringByReplacingRange:(NSRange)aRange with:(NSString *)aString @end + #ifdef main # undef main #endif diff --git a/Xcode/TemplatesForXcodeLeopard/SDL OpenGL Application/SDLMain.m b/Xcode/TemplatesForXcodeLeopard/SDL OpenGL Application/SDLMain.m index 6948979df..07d392eef 100644 --- a/Xcode/TemplatesForXcodeLeopard/SDL OpenGL Application/SDLMain.m +++ b/Xcode/TemplatesForXcodeLeopard/SDL OpenGL Application/SDLMain.m @@ -20,6 +20,22 @@ - (void)setAppleMenu:(NSMenu *)menu; /* Use this flag to determine whether we use SDLMain.nib or not */ #define SDL_USE_NIB_FILE 0 +/* Use this flag to determine whether we use CPS (docking) or not */ +#define SDL_USE_CPS 1 +#ifdef SDL_USE_CPS +/* Portions of CPS.h */ +typedef struct CPSProcessSerNum +{ + UInt32 lo; + UInt32 hi; +} CPSProcessSerNum; + +extern OSErr CPSGetCurrentProcess( CPSProcessSerNum *psn); +extern OSErr CPSEnableForegroundOperation( CPSProcessSerNum *psn, UInt32 _arg2, UInt32 _arg3, UInt32 _arg4, UInt32 _arg5); +extern OSErr CPSSetFrontProcess( CPSProcessSerNum *psn); + +#endif /* SDL_USE_CPS */ + static int gArgc; static char **gArgv; static BOOL gFinderLaunch; @@ -185,7 +201,18 @@ static void CustomApplicationMain (int argc, char **argv) SDLMain *sdlMain; /* Ensure the application object is initialised */ - [[NSApplication sharedApplication] activateIgnoringOtherApps: YES]; + [NSApplication sharedApplication]; + +#ifdef SDL_USE_CPS + { + CPSProcessSerNum PSN; + /* Tell the dock about us */ + if (!CPSGetCurrentProcess(&PSN)) + if (!CPSEnableForegroundOperation(&PSN,0x03,0x3C,0x2C,0x1103)) + if (!CPSSetFrontProcess(&PSN)) + [NSApplication sharedApplication]; + } +#endif /* SDL_USE_CPS */ /* Set up the menubar */ [NSApp setMainMenu:[[NSMenu alloc] init]]; @@ -318,6 +345,7 @@ - (NSString *)stringByReplacingRange:(NSRange)aRange with:(NSString *)aString @end + #ifdef main # undef main #endif diff --git a/Xcode/TemplatesForXcodeSnowLeopard/SDL Application/SDLMain.m b/Xcode/TemplatesForXcodeSnowLeopard/SDL Application/SDLMain.m index 6948979df..07d392eef 100644 --- a/Xcode/TemplatesForXcodeSnowLeopard/SDL Application/SDLMain.m +++ b/Xcode/TemplatesForXcodeSnowLeopard/SDL Application/SDLMain.m @@ -20,6 +20,22 @@ - (void)setAppleMenu:(NSMenu *)menu; /* Use this flag to determine whether we use SDLMain.nib or not */ #define SDL_USE_NIB_FILE 0 +/* Use this flag to determine whether we use CPS (docking) or not */ +#define SDL_USE_CPS 1 +#ifdef SDL_USE_CPS +/* Portions of CPS.h */ +typedef struct CPSProcessSerNum +{ + UInt32 lo; + UInt32 hi; +} CPSProcessSerNum; + +extern OSErr CPSGetCurrentProcess( CPSProcessSerNum *psn); +extern OSErr CPSEnableForegroundOperation( CPSProcessSerNum *psn, UInt32 _arg2, UInt32 _arg3, UInt32 _arg4, UInt32 _arg5); +extern OSErr CPSSetFrontProcess( CPSProcessSerNum *psn); + +#endif /* SDL_USE_CPS */ + static int gArgc; static char **gArgv; static BOOL gFinderLaunch; @@ -185,7 +201,18 @@ static void CustomApplicationMain (int argc, char **argv) SDLMain *sdlMain; /* Ensure the application object is initialised */ - [[NSApplication sharedApplication] activateIgnoringOtherApps: YES]; + [NSApplication sharedApplication]; + +#ifdef SDL_USE_CPS + { + CPSProcessSerNum PSN; + /* Tell the dock about us */ + if (!CPSGetCurrentProcess(&PSN)) + if (!CPSEnableForegroundOperation(&PSN,0x03,0x3C,0x2C,0x1103)) + if (!CPSSetFrontProcess(&PSN)) + [NSApplication sharedApplication]; + } +#endif /* SDL_USE_CPS */ /* Set up the menubar */ [NSApp setMainMenu:[[NSMenu alloc] init]]; @@ -318,6 +345,7 @@ - (NSString *)stringByReplacingRange:(NSRange)aRange with:(NSString *)aString @end + #ifdef main # undef main #endif diff --git a/Xcode/TemplatesForXcodeSnowLeopard/SDL Cocoa Application/SDLMain.m b/Xcode/TemplatesForXcodeSnowLeopard/SDL Cocoa Application/SDLMain.m index 6948979df..07d392eef 100644 --- a/Xcode/TemplatesForXcodeSnowLeopard/SDL Cocoa Application/SDLMain.m +++ b/Xcode/TemplatesForXcodeSnowLeopard/SDL Cocoa Application/SDLMain.m @@ -20,6 +20,22 @@ - (void)setAppleMenu:(NSMenu *)menu; /* Use this flag to determine whether we use SDLMain.nib or not */ #define SDL_USE_NIB_FILE 0 +/* Use this flag to determine whether we use CPS (docking) or not */ +#define SDL_USE_CPS 1 +#ifdef SDL_USE_CPS +/* Portions of CPS.h */ +typedef struct CPSProcessSerNum +{ + UInt32 lo; + UInt32 hi; +} CPSProcessSerNum; + +extern OSErr CPSGetCurrentProcess( CPSProcessSerNum *psn); +extern OSErr CPSEnableForegroundOperation( CPSProcessSerNum *psn, UInt32 _arg2, UInt32 _arg3, UInt32 _arg4, UInt32 _arg5); +extern OSErr CPSSetFrontProcess( CPSProcessSerNum *psn); + +#endif /* SDL_USE_CPS */ + static int gArgc; static char **gArgv; static BOOL gFinderLaunch; @@ -185,7 +201,18 @@ static void CustomApplicationMain (int argc, char **argv) SDLMain *sdlMain; /* Ensure the application object is initialised */ - [[NSApplication sharedApplication] activateIgnoringOtherApps: YES]; + [NSApplication sharedApplication]; + +#ifdef SDL_USE_CPS + { + CPSProcessSerNum PSN; + /* Tell the dock about us */ + if (!CPSGetCurrentProcess(&PSN)) + if (!CPSEnableForegroundOperation(&PSN,0x03,0x3C,0x2C,0x1103)) + if (!CPSSetFrontProcess(&PSN)) + [NSApplication sharedApplication]; + } +#endif /* SDL_USE_CPS */ /* Set up the menubar */ [NSApp setMainMenu:[[NSMenu alloc] init]]; @@ -318,6 +345,7 @@ - (NSString *)stringByReplacingRange:(NSRange)aRange with:(NSString *)aString @end + #ifdef main # undef main #endif diff --git a/Xcode/TemplatesForXcodeSnowLeopard/SDL OpenGL Application/SDLMain.m b/Xcode/TemplatesForXcodeSnowLeopard/SDL OpenGL Application/SDLMain.m index 6948979df..07d392eef 100644 --- a/Xcode/TemplatesForXcodeSnowLeopard/SDL OpenGL Application/SDLMain.m +++ b/Xcode/TemplatesForXcodeSnowLeopard/SDL OpenGL Application/SDLMain.m @@ -20,6 +20,22 @@ - (void)setAppleMenu:(NSMenu *)menu; /* Use this flag to determine whether we use SDLMain.nib or not */ #define SDL_USE_NIB_FILE 0 +/* Use this flag to determine whether we use CPS (docking) or not */ +#define SDL_USE_CPS 1 +#ifdef SDL_USE_CPS +/* Portions of CPS.h */ +typedef struct CPSProcessSerNum +{ + UInt32 lo; + UInt32 hi; +} CPSProcessSerNum; + +extern OSErr CPSGetCurrentProcess( CPSProcessSerNum *psn); +extern OSErr CPSEnableForegroundOperation( CPSProcessSerNum *psn, UInt32 _arg2, UInt32 _arg3, UInt32 _arg4, UInt32 _arg5); +extern OSErr CPSSetFrontProcess( CPSProcessSerNum *psn); + +#endif /* SDL_USE_CPS */ + static int gArgc; static char **gArgv; static BOOL gFinderLaunch; @@ -185,7 +201,18 @@ static void CustomApplicationMain (int argc, char **argv) SDLMain *sdlMain; /* Ensure the application object is initialised */ - [[NSApplication sharedApplication] activateIgnoringOtherApps: YES]; + [NSApplication sharedApplication]; + +#ifdef SDL_USE_CPS + { + CPSProcessSerNum PSN; + /* Tell the dock about us */ + if (!CPSGetCurrentProcess(&PSN)) + if (!CPSEnableForegroundOperation(&PSN,0x03,0x3C,0x2C,0x1103)) + if (!CPSSetFrontProcess(&PSN)) + [NSApplication sharedApplication]; + } +#endif /* SDL_USE_CPS */ /* Set up the menubar */ [NSApp setMainMenu:[[NSMenu alloc] init]]; @@ -318,6 +345,7 @@ - (NSString *)stringByReplacingRange:(NSRange)aRange with:(NSString *)aString @end + #ifdef main # undef main #endif diff --git a/Xcode/TemplatesForXcodeTiger/SDL Application/SDLMain.m b/Xcode/TemplatesForXcodeTiger/SDL Application/SDLMain.m index 6948979df..07d392eef 100644 --- a/Xcode/TemplatesForXcodeTiger/SDL Application/SDLMain.m +++ b/Xcode/TemplatesForXcodeTiger/SDL Application/SDLMain.m @@ -20,6 +20,22 @@ - (void)setAppleMenu:(NSMenu *)menu; /* Use this flag to determine whether we use SDLMain.nib or not */ #define SDL_USE_NIB_FILE 0 +/* Use this flag to determine whether we use CPS (docking) or not */ +#define SDL_USE_CPS 1 +#ifdef SDL_USE_CPS +/* Portions of CPS.h */ +typedef struct CPSProcessSerNum +{ + UInt32 lo; + UInt32 hi; +} CPSProcessSerNum; + +extern OSErr CPSGetCurrentProcess( CPSProcessSerNum *psn); +extern OSErr CPSEnableForegroundOperation( CPSProcessSerNum *psn, UInt32 _arg2, UInt32 _arg3, UInt32 _arg4, UInt32 _arg5); +extern OSErr CPSSetFrontProcess( CPSProcessSerNum *psn); + +#endif /* SDL_USE_CPS */ + static int gArgc; static char **gArgv; static BOOL gFinderLaunch; @@ -185,7 +201,18 @@ static void CustomApplicationMain (int argc, char **argv) SDLMain *sdlMain; /* Ensure the application object is initialised */ - [[NSApplication sharedApplication] activateIgnoringOtherApps: YES]; + [NSApplication sharedApplication]; + +#ifdef SDL_USE_CPS + { + CPSProcessSerNum PSN; + /* Tell the dock about us */ + if (!CPSGetCurrentProcess(&PSN)) + if (!CPSEnableForegroundOperation(&PSN,0x03,0x3C,0x2C,0x1103)) + if (!CPSSetFrontProcess(&PSN)) + [NSApplication sharedApplication]; + } +#endif /* SDL_USE_CPS */ /* Set up the menubar */ [NSApp setMainMenu:[[NSMenu alloc] init]]; @@ -318,6 +345,7 @@ - (NSString *)stringByReplacingRange:(NSRange)aRange with:(NSString *)aString @end + #ifdef main # undef main #endif diff --git a/Xcode/TemplatesForXcodeTiger/SDL Cocoa Application/SDLMain.m b/Xcode/TemplatesForXcodeTiger/SDL Cocoa Application/SDLMain.m index 6948979df..07d392eef 100644 --- a/Xcode/TemplatesForXcodeTiger/SDL Cocoa Application/SDLMain.m +++ b/Xcode/TemplatesForXcodeTiger/SDL Cocoa Application/SDLMain.m @@ -20,6 +20,22 @@ - (void)setAppleMenu:(NSMenu *)menu; /* Use this flag to determine whether we use SDLMain.nib or not */ #define SDL_USE_NIB_FILE 0 +/* Use this flag to determine whether we use CPS (docking) or not */ +#define SDL_USE_CPS 1 +#ifdef SDL_USE_CPS +/* Portions of CPS.h */ +typedef struct CPSProcessSerNum +{ + UInt32 lo; + UInt32 hi; +} CPSProcessSerNum; + +extern OSErr CPSGetCurrentProcess( CPSProcessSerNum *psn); +extern OSErr CPSEnableForegroundOperation( CPSProcessSerNum *psn, UInt32 _arg2, UInt32 _arg3, UInt32 _arg4, UInt32 _arg5); +extern OSErr CPSSetFrontProcess( CPSProcessSerNum *psn); + +#endif /* SDL_USE_CPS */ + static int gArgc; static char **gArgv; static BOOL gFinderLaunch; @@ -185,7 +201,18 @@ static void CustomApplicationMain (int argc, char **argv) SDLMain *sdlMain; /* Ensure the application object is initialised */ - [[NSApplication sharedApplication] activateIgnoringOtherApps: YES]; + [NSApplication sharedApplication]; + +#ifdef SDL_USE_CPS + { + CPSProcessSerNum PSN; + /* Tell the dock about us */ + if (!CPSGetCurrentProcess(&PSN)) + if (!CPSEnableForegroundOperation(&PSN,0x03,0x3C,0x2C,0x1103)) + if (!CPSSetFrontProcess(&PSN)) + [NSApplication sharedApplication]; + } +#endif /* SDL_USE_CPS */ /* Set up the menubar */ [NSApp setMainMenu:[[NSMenu alloc] init]]; @@ -318,6 +345,7 @@ - (NSString *)stringByReplacingRange:(NSRange)aRange with:(NSString *)aString @end + #ifdef main # undef main #endif diff --git a/Xcode/TemplatesForXcodeTiger/SDL OpenGL Application/SDLMain.m b/Xcode/TemplatesForXcodeTiger/SDL OpenGL Application/SDLMain.m index 6948979df..07d392eef 100644 --- a/Xcode/TemplatesForXcodeTiger/SDL OpenGL Application/SDLMain.m +++ b/Xcode/TemplatesForXcodeTiger/SDL OpenGL Application/SDLMain.m @@ -20,6 +20,22 @@ - (void)setAppleMenu:(NSMenu *)menu; /* Use this flag to determine whether we use SDLMain.nib or not */ #define SDL_USE_NIB_FILE 0 +/* Use this flag to determine whether we use CPS (docking) or not */ +#define SDL_USE_CPS 1 +#ifdef SDL_USE_CPS +/* Portions of CPS.h */ +typedef struct CPSProcessSerNum +{ + UInt32 lo; + UInt32 hi; +} CPSProcessSerNum; + +extern OSErr CPSGetCurrentProcess( CPSProcessSerNum *psn); +extern OSErr CPSEnableForegroundOperation( CPSProcessSerNum *psn, UInt32 _arg2, UInt32 _arg3, UInt32 _arg4, UInt32 _arg5); +extern OSErr CPSSetFrontProcess( CPSProcessSerNum *psn); + +#endif /* SDL_USE_CPS */ + static int gArgc; static char **gArgv; static BOOL gFinderLaunch; @@ -185,7 +201,18 @@ static void CustomApplicationMain (int argc, char **argv) SDLMain *sdlMain; /* Ensure the application object is initialised */ - [[NSApplication sharedApplication] activateIgnoringOtherApps: YES]; + [NSApplication sharedApplication]; + +#ifdef SDL_USE_CPS + { + CPSProcessSerNum PSN; + /* Tell the dock about us */ + if (!CPSGetCurrentProcess(&PSN)) + if (!CPSEnableForegroundOperation(&PSN,0x03,0x3C,0x2C,0x1103)) + if (!CPSSetFrontProcess(&PSN)) + [NSApplication sharedApplication]; + } +#endif /* SDL_USE_CPS */ /* Set up the menubar */ [NSApp setMainMenu:[[NSMenu alloc] init]]; @@ -318,6 +345,7 @@ - (NSString *)stringByReplacingRange:(NSRange)aRange with:(NSString *)aString @end + #ifdef main # undef main #endif diff --git a/docs.html b/docs.html index f1a6d805f..1fbea3e63 100644 --- a/docs.html +++ b/docs.html @@ -133,10 +133,6 @@

SDL 1.2.16 Release Notes

Mac OS X, main: updates for -psn_XXX command line arg for Finder launches in new macOS versions.

-

- Mac OS X, main: replace deprecated CPS apis in new OSX versions - (bug 4114.) -

Windows, video: fix other window positions/sizes when exiting fullscreen (bug 3315.) diff --git a/src/main/macosx/SDLMain.m b/src/main/macosx/SDLMain.m index 6948979df..07d392eef 100644 --- a/src/main/macosx/SDLMain.m +++ b/src/main/macosx/SDLMain.m @@ -20,6 +20,22 @@ - (void)setAppleMenu:(NSMenu *)menu; /* Use this flag to determine whether we use SDLMain.nib or not */ #define SDL_USE_NIB_FILE 0 +/* Use this flag to determine whether we use CPS (docking) or not */ +#define SDL_USE_CPS 1 +#ifdef SDL_USE_CPS +/* Portions of CPS.h */ +typedef struct CPSProcessSerNum +{ + UInt32 lo; + UInt32 hi; +} CPSProcessSerNum; + +extern OSErr CPSGetCurrentProcess( CPSProcessSerNum *psn); +extern OSErr CPSEnableForegroundOperation( CPSProcessSerNum *psn, UInt32 _arg2, UInt32 _arg3, UInt32 _arg4, UInt32 _arg5); +extern OSErr CPSSetFrontProcess( CPSProcessSerNum *psn); + +#endif /* SDL_USE_CPS */ + static int gArgc; static char **gArgv; static BOOL gFinderLaunch; @@ -185,7 +201,18 @@ static void CustomApplicationMain (int argc, char **argv) SDLMain *sdlMain; /* Ensure the application object is initialised */ - [[NSApplication sharedApplication] activateIgnoringOtherApps: YES]; + [NSApplication sharedApplication]; + +#ifdef SDL_USE_CPS + { + CPSProcessSerNum PSN; + /* Tell the dock about us */ + if (!CPSGetCurrentProcess(&PSN)) + if (!CPSEnableForegroundOperation(&PSN,0x03,0x3C,0x2C,0x1103)) + if (!CPSSetFrontProcess(&PSN)) + [NSApplication sharedApplication]; + } +#endif /* SDL_USE_CPS */ /* Set up the menubar */ [NSApp setMainMenu:[[NSMenu alloc] init]]; @@ -318,6 +345,7 @@ - (NSString *)stringByReplacingRange:(NSRange)aRange with:(NSString *)aString @end + #ifdef main # undef main #endif