Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Patch] Mac: update some internal code to use modern codepaths rather than deprecated functionality, when available #1750

Closed
SDLBugzilla opened this issue Feb 10, 2021 · 0 comments

Comments

@SDLBugzilla
Copy link
Collaborator

This bug report was migrated from our old Bugzilla tracker.

These attachments are available in the static archive:

Reported in version: HG 2.0
Reported for operating system, platform: Mac OS X (All), x86_64

Comments on the original bug report:

On 2015-01-27 18:56:11 +0000, Alex Szpakowski wrote:

Created attachment 2007
Patch to use some modern Mac APIs rather than deprecated ones, when available

SDL's Mac code for preventing the screensaver from activating and for making the app show up in the Dock is using long-deprecated APIs. I have attached a patch to use more modern APIs when available.

On 2015-01-27 20:44:17 +0000, Alex Szpakowski wrote:

Created attachment 2008
Patch to use some modern Mac APIs rather than deprecated ones, when available

On 2015-02-02 07:04:02 +0000, Ryan C. Gordon wrote:

(In reply to Alex Szpakowski from comment # 1)

Created attachment 2008 [details]
Patch to use some modern Mac APIs rather than deprecated ones, when available

Notes:

  • Cocoa_ShouldUseIdleIOPMAssertion() should just be checked once at init time and stored as a BOOL somewhere under _this. Not that it's a real expensive function or anything, of course.

  • Put a FIXME or something on this: CFSTR("SDL-based app running") ... eventually I'd like to add a simple app metadata API that lets an app describe some basic things about itself, since there are a few places on various platforms where we end up saying "SDL application" instead of "Super Mario Bros."

  • Does the legacy path not need to call SetFrontProcess()? That got removed in the patch.

--ryan.

On 2015-02-02 07:33:32 +0000, Alex Szpakowski wrote:

(In reply to Ryan C. Gordon from comment # 2)

  • Put a FIXME or something on this: CFSTR("SDL-based app running") ...
    eventually I'd like to add a simple app metadata API that lets an app
    describe some basic things about itself, since there are a few places on
    various platforms where we end up saying "SDL application" instead of "Super
    Mario Bros."

Should I just make it use the actual application name? SDL_cocoaevents.m already has a function to determine it, since it creates the menubar items programmatically.

(In reply to Ryan C. Gordon from comment # 2)

  • Does the legacy path not need to call SetFrontProcess()? That got removed
    in the patch.

--ryan.

The patch replaces the SetFrontProcess call with [NSApp activateIgnoringOtherApps:YES] (the Cocoa version of that Carbon function.)

On 2015-02-02 07:37:34 +0000, Alex Szpakowski wrote:

(In reply to Alex Szpakowski from comment # 3)

Should I just make it use the actual application name? SDL_cocoaevents.m
already has a function to determine it, since it creates the menubar items
programmatically.

Actually the Apple documentation says this, so I guess the app name isn't quite appropriate:

specify a CFString like "Checking mail" or "Compiling" that describes the task that this assertion protects.

On 2015-02-02 07:45:36 +0000, Alex Szpakowski wrote:

Created attachment 2013
Patch to prefer some modern Mac APIs over deprecated ones (v3)

On 2015-02-02 09:20:23 +0000, Alex Szpakowski wrote:

Created attachment 2014
Patch to prefer some modern Mac APIs over deprecated ones (v4)

I updated the name used in IOPMAssertionCreate to include the application name, and added a comment about it.

On 2015-02-19 05:22:19 +0000, Ryan C. Gordon wrote:

Marking a large number of bugs with the "triage-2.0.4" keyword at once. Sorry if you got a lot of email from this. This is to help me sort through some bugs in regards to a 2.0.4 release. We may or may not fix this bug for 2.0.4, though!

On 2015-02-20 01:06:43 +0000, Ryan C. Gordon wrote:

This looks good to me; it's now https://hg.libsdl.org/SDL/rev/ad9d35983de5, thanks!

--ryan.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant