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

SDLMain.m: replace CPS* stuff with activateIgnoringOtherApps #775

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

SDLMain.m: replace CPS* stuff with activateIgnoringOtherApps #775

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

Comments

@SDLBugzilla
Copy link
Collaborator

@SDLBugzilla SDLBugzilla commented Feb 10, 2021

This bug report was migrated from our old Bugzilla tracker.

These attachments are available in the static archive:

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

Comments on the original bug report:

On 2018-03-24 21:16:46 +0000, Ozkan Sezer wrote:

Created attachment 3212
osx_main.patch

CPS stuff are deprecated and emit warnings at runtime, e.g.:

warning: CPSGetCurrentProcess(): This call is deprecated and should not be called anymore
warning: CPSSetForegroundOperationState() (as above)
warning: capture_display; Captured mirror master 0x350000c1 (unit 1) on behalf of slave 0x042716c0 (unit 0)

http://lists.libsdl.org/pipermail/sdl-libsdl.org/2006-April/055749.html
suggests doing something like:

ProcessSerialNumber psn = { 0, kCurrentProcess};
TransformProcessType (&psn, kProcessTransformToForegroundApplication);
SetFrontProcess (&psn);

And SetFrontProcess() is deprecated in 10.9. Processes.h suggests
[[NSApplication sharedApplication] activateIgnoringOtherApps: YES]
to make one's own application frontmost.

So, the attached patch is what I came up with: Please review, and
apply if it's OK.

On 2018-06-22 08:58:47 +0000, Ozkan Sezer wrote:

Any comments on this?

On 2018-06-22 17:43:31 +0000, Sam Lantinga wrote:

This seems reasonable. Does it work? If so, go ahead and commit it.

On 2018-06-22 17:49:40 +0000, Ozkan Sezer wrote:

I've been using it in uhexen2 (uhexen2.sf.net) for quite some time,
no ill effects reported so far. Will push shortly.

On 2018-06-22 18:04:46 +0000, Ozkan Sezer wrote:

Pushed: http://hg.libsdl.org/SDL/rev/67f391c74aee

On 2019-11-12 19:43:39 +0000, Dominik Reichardt wrote:

A bit late to the party, but this change is badly affecting DOSBox and possibly other programs.
With this changeset, starting the DOSBox binary from terminal opens DOSBox in the background and even worse, every keyboard input is sent to the terminal but not to DOSBox.

BUT if you put the binary in an app bundle and open the app, all is fine.

On 2019-11-12 20:05:37 +0000, Ozkan Sezer wrote:

(In reply to Dominik Reichardt from comment # 5)

A bit late to the party, but this change is badly affecting DOSBox and
possibly other programs.
With this changeset, starting the DOSBox binary from terminal opens DOSBox
in the background and even worse, every keyboard input is sent to the
terminal but not to DOSBox.

BUT if you put the binary in an app bundle and open the app, all is fine.

  • Do you have a patch?
  • Does reverting this patch make things work, despite the
    deprecation warnings, especially on new macOS versions?

On 2019-11-12 20:23:58 +0000, Dominik Reichardt wrote:

sorry, I have no patch. I have no clue what it does, only that it took me a while to hunt down where the culprit was.

Reverting the patch makes it work correctly again. Compiled and run on macOS 10.14 and also run successfully on macOS 10.15 (though just a late beta of 10.15 not the actual release).

[[NSApplication sharedApplication] activateIgnoringOtherApps: YES];
or
[NSApplication sharedApplication];
makes no difference. Only the other stuff taken out makes it not work (or work when put back in).

On 2019-11-12 20:34:49 +0000, Ozkan Sezer wrote:

Sam, Ryan: Do you have a better fix, or should I just revert this?

On 2019-11-13 04:35:18 +0000, Sam Lantinga wrote:

Go ahead and revert it.

On 2019-11-13 07:00:35 +0000, Ozkan Sezer wrote:

Reverted it in all projects.

Keeping the bug report open because the issue still needs fixing.

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

Successfully merging a pull request may close this issue.

None yet
1 participant