2018-09-14 18:03:43 +00:00
|
|
|
From 0680698be349b3619561c65eb072d9880e405fae Mon Sep 17 00:00:00 2001
|
2018-09-14 05:02:16 +00:00
|
|
|
From: Jeremy Apthorp <nornagon@nornagon.net>
|
2018-09-14 18:03:43 +00:00
|
|
|
Date: Fri, 14 Sep 2018 09:53:11 -0700
|
|
|
|
Subject: apply patch: mas-cgdisplayusesforcetogray
|
2018-09-14 05:02:16 +00:00
|
|
|
|
|
|
|
|
|
|
|
diff --git a/ui/display/mac/screen_mac.mm b/ui/display/mac/screen_mac.mm
|
2018-09-14 18:03:43 +00:00
|
|
|
index be4f343bcd44..84fd3ec23cfa 100644
|
2018-09-14 05:02:16 +00:00
|
|
|
--- a/ui/display/mac/screen_mac.mm
|
|
|
|
+++ b/ui/display/mac/screen_mac.mm
|
|
|
|
@@ -106,7 +106,17 @@ Display BuildDisplayForScreen(NSScreen* screen) {
|
|
|
|
|
|
|
|
display.set_color_depth(NSBitsPerPixelFromDepth([screen depth]));
|
|
|
|
display.set_depth_per_component(NSBitsPerSampleFromDepth([screen depth]));
|
|
|
|
+#ifdef MAS_BUILD
|
|
|
|
+ // 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
|
|
|
|
|
|
|
|
// CGDisplayRotation returns a double. Display::SetRotationAsDegree will
|
|
|
|
// handle the unexpected situations were the angle is not a multiple of 90.
|
|
|
|
--
|
|
|
|
2.17.0
|
|
|
|
|