2018-10-24 18:24:11 +00:00
|
|
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
2018-09-14 05:02:16 +00:00
|
|
|
From: Jeremy Apthorp <nornagon@nornagon.net>
|
2018-09-21 00:30:26 +00:00
|
|
|
Date: Thu, 20 Sep 2018 17:49:24 -0700
|
2021-05-19 18:20:12 +00:00
|
|
|
Subject: mas: avoid usage of CGDisplayUsesForceToGray
|
2018-09-14 05:02:16 +00:00
|
|
|
|
2018-09-21 00:30:26 +00:00
|
|
|
Removes usage of the CGDisplayUsesForceToGray private API.
|
2018-09-14 05:02:16 +00:00
|
|
|
|
|
|
|
diff --git a/ui/display/mac/screen_mac.mm b/ui/display/mac/screen_mac.mm
|
2023-09-06 01:17:56 +00:00
|
|
|
index 18d1dbbc6d15ea7191f8c48c30e692a59875df37..8997858f873901a7cc7fb922f322c0150a1716f3 100644
|
2018-09-14 05:02:16 +00:00
|
|
|
--- a/ui/display/mac/screen_mac.mm
|
|
|
|
+++ b/ui/display/mac/screen_mac.mm
|
2023-08-15 15:49:41 +00:00
|
|
|
@@ -159,7 +159,17 @@ DisplayMac BuildDisplayForScreen(NSScreen* screen) {
|
2020-03-03 21:35:05 +00:00
|
|
|
display.set_color_depth(Display::kDefaultBitsPerPixel);
|
|
|
|
display.set_depth_per_component(Display::kDefaultBitsPerComponent);
|
|
|
|
}
|
2022-11-14 20:46:52 +00:00
|
|
|
+#if IS_MAS_BUILD()
|
2018-09-14 05:02:16 +00:00
|
|
|
+ // This is equivalent to the CGDisplayUsesForceToGray() API as at 2018-08-06,
|
|
|
|
+ // but avoids usage of the private API.
|
|
|
|
+ CFStringRef app = CFSTR("com.apple.CoreGraphics");
|
|
|
|
+ CFStringRef key = CFSTR("DisplayUseForcedGray");
|
|
|
|
+ Boolean key_valid = false;
|
|
|
|
+ display.set_is_monochrome(
|
|
|
|
+ CFPreferencesGetAppBooleanValue(key, app, &key_valid));
|
|
|
|
+#else
|
|
|
|
display.set_is_monochrome(CGDisplayUsesForceToGray());
|
|
|
|
+#endif
|
|
|
|
|
2023-06-22 08:51:15 +00:00
|
|
|
// Query the display's refresh rate.
|
2023-05-23 19:58:58 +00:00
|
|
|
{
|