libsdl-org / SDL

Simple Directmedia Layer
https://libsdl.org
zlib License
10.12k stars 1.85k forks source link

NSRequiresAquaSystemAppearance makes some applications blurry on macOS Retina display #3637

Closed SDLBugzilla closed 1 year ago

SDLBugzilla commented 3 years ago

This bug report was migrated from our old Bugzilla tracker.

These attachments are available in the static archive:

Reported in version: 2.0.12 Reported for operating system, platform: macOS 10.14, x86_64

Comments on the original bug report:

On 2020-04-13 15:55:23 +0000, Donovan Watteau wrote:

Created attachment 4304 Sharp text on the left (ScummVM 2.1.0-beta), blurrier text on the right (ScummVM 2.1.2 exploiting Dark mode with NSRequiresAquaSystemAppearance)

Hi,

Running macOS Mojave 10.14.6 (18G4032) on a Retina 5K, 27-inch, 2017 iMac. Default Retina DPI.

I'm running ScummVM 2.1.2, which was built against SDL2-2.0.10 on Sierra (I still see the same bug when doing my own build with SDL2-2.0.12 on Mojave): https://www.scummvm.org/frs/scummvm/2.1.2/scummvm-2.1.2-macosx.dmg

Upstream recently added NSRequiresAquaSystemAppearance in its Info.plist file: https://github.com/scummvm/scummvm/commit/485e8bee

Since then, I see that the UI got slightly blurrier. The attached screenshot shows a comparison between this and an earlier release.

You can easily and quickly notice it if you have a Retina display, without requiring any game, by going to Options > Misc > Theme > Classic Theme (Builtin Version). Options > Graphics > Graphics Mode > 3x can also make it even more evident.

The strange thing is that I can revert this blur effect by editing /Applications/ScummVM.app/Contents/Info.plist and removing this:

NSRequiresAquaSystemAppearance

I can't find a lot of information about this particular behaviour, online. What I do remember, though, is that VMWare Fusion enabled Dark Mode in 11.5 as well, and got blurrier content as well:

https://communities.vmware.com/thread/618831

but since it's closed-source, we don't know how they fixed/worked around that.

I'm not sure if the bug is the app I'm using, in SDL2 or in macOS (as maybe hinted in https://twitter.com/icculus/status/1047922666324353029). But I can test patches and such if this helps!

Thanks.

On 2020-04-14 15:11:28 +0000, Sam Lantinga wrote:

Alex, any ideas on this?

On 2020-04-14 15:51:40 +0000, Alex Szpakowski wrote:

I'm guessing VMWare removed the NSRequiresAquaSystemAppearance key and built using the 10.14+ SDK instead. ScummVM should probably do the same, I guess.

On 2020-04-15 06:58:55 +0000, Donovan Watteau wrote:

Upstream likes to provide a good amount of backward compatibility for older macOS releases, so I'm not sure they will chose to use the 10.14+ SDK. Maybe this will be worked around by removing NSRequiresAquaSystemAppearance and missing Dark mode for now, instead.

Anyway, I see that a similar Radar was reported to Apple, back in early Mojave betas: https://openradar.appspot.com/45895864

And it looks like VLC was hit by a similar problems, but they had another way of working around it, it seems: https://code.videolan.org/videolan/VLCKit/issues/82#note_30971

I don't know if this can be worked around in SDL2 code as well, or if I should try to open a new Radar (I doubt Apple will care), or if NSRequiresAquaSystemAppearance should be documented as buggy.

On 2020-04-15 11:12:48 +0000, Alex Szpakowski wrote:

(In reply to Donovan Watteau from comment # 3)

Upstream likes to provide a good amount of backward compatibility for older macOS releases, so I'm not sure they will chose to use the 10.14+ SDK. Maybe this will be worked around by removing NSRequiresAquaSystemAppearance and missing Dark mode for now, instead.

Compiling with a newer SDK doesn't prevent an app from running on older operating systems - there's a separate minimum OS target setting from the current SDK being used, so for example I compile my apps with the 10.15 SDK and set their minimum deployment target to 10.7, and they'll run on every OS version between 10.7 and 10.15 (and on newer operating systems when they're released - just not with every new feature of that new OS version).

The layer backed NSOpenGLView stuff is pretty fragile so I'm not sure I'd recommend changing how that works for an issue like this, but maybe someone could find a robust workaround there with some time invested. To me it feels like a much less ideal solution than just using a newer SDK though.

On 2020-04-16 08:40:30 +0000, Donovan Watteau wrote:

(In reply to Alex Szpakowski from comment # 4)

(In reply to Donovan Watteau from comment # 3)

Upstream likes to provide a good amount of backward compatibility for older macOS releases, so I'm not sure they will chose to use the 10.14+ SDK. Maybe this will be worked around by removing NSRequiresAquaSystemAppearance and missing Dark mode for now, instead.

Compiling with a newer SDK doesn't prevent an app from running on older operating systems - there's a separate minimum OS target setting from the current SDK being used, so for example I compile my apps with the 10.15 SDK and set their minimum deployment target to 10.7, and they'll run on every OS version between 10.7 and 10.15 (and on newer operating systems when they're released - just not with every new feature of that new OS version).

The layer backed NSOpenGLView stuff is pretty fragile so I'm not sure I'd recommend changing how that works for an issue like this, but maybe someone could find a robust workaround there with some time invested. To me it feels like a much less ideal solution than just using a newer SDK though.

Yes, sorry, I forgot that.

Unfortunately, after removing any NSRequiresAquaSystemAppearance mention, and building ScummVM 2.2.0git with the 10.14 SDK and targeting either a 10.9 or 10.14 compatibility (the instructions about building it with Xcode are on their Wiki), the app still remains blurry by default on Mojave.

So it looks like the only workaround is to build with a pre-10.14 SDK, and NOT to use NSRequiresAquaSystemAppearance. Otherwise, you get the blurring issues. So this macOS bug looks more problematic.

(I wish I could provide you a simpler use case to reproduce this on 10.14+, but I'm just a ScummVM user, and finding the smallest snippet of code reproducing this issue is above my SDL programming knowledge...)

On 2020-04-27 20:01:21 +0000, Donovan Watteau wrote:

Hi,

To keep you informed: criezy from the ScummVM team found that you can also work around the blurring issue on 10.14+ SDKs by building with a SDK value set to n/a: https://bugs.scummvm.org/ticket/11430

This comes from LibreOffice, which had a similar issue: https://bugs.documentfoundation.org/show_bug.cgi?id=122218

I've reported the bug to Apple, but I'm not sure they're going to do something about this.

I don't know if something can be worked around by default in SDL2 in itself, but hopefully this bug report might help documenting this macOS bug.

slouken commented 1 year ago

SDL 2.0 is now in maintenance mode, and all inactive issues are being closed. If this issue is impacting you, please feel free to reopen it with additional information.