We are currently migrating Bugzilla to GitHub issues.
Any changes made to the bug tracker now will be lost, so please do not post new bugs or make changes to them.
When we're done, all bug URLs will redirect to their equivalent location on the new bug tracker.

Bug 5087

Summary: NSRequiresAquaSystemAppearance makes some applications blurry on macOS Retina display
Product: SDL Reporter: Donovan Watteau <contrib>
Component: renderAssignee: Alex Szpakowski <amaranth72>
Status: ASSIGNED --- QA Contact: Sam Lantinga <slouken>
Severity: normal    
Priority: P2    
Version: 2.0.12   
Hardware: x86_64   
OS: macOS 10.14   
Attachments: Sharp text on the left (ScummVM 2.1.0-beta), blurrier text on the right (ScummVM 2.1.2 exploiting Dark mode with NSRequiresAquaSystemAppearance)

Description Donovan Watteau 2020-04-13 15:55:23 UTC
Created attachment 4304 [details]
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:

  <key>NSRequiresAquaSystemAppearance</key>
  <false/>

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.
Comment 1 Sam Lantinga 2020-04-14 15:11:28 UTC
Alex, any ideas on this?
Comment 2 Alex Szpakowski 2020-04-14 15:51:40 UTC
I'm guessing VMWare removed the NSRequiresAquaSystemAppearance key and built using the 10.14+ SDK instead. ScummVM should probably do the same, I guess.
Comment 3 Donovan Watteau 2020-04-15 06:58:55 UTC
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.
Comment 4 Alex Szpakowski 2020-04-15 11:12:48 UTC
(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.
Comment 5 Donovan Watteau 2020-04-16 08:40:30 UTC
(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...)
Comment 6 Donovan Watteau 2020-04-27 20:01:21 UTC
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.