d56617e5d0
* chore: avoid appending git version to the exported patches * fix no-eol at end of v8 patch
29 lines
1.3 KiB
Diff
29 lines
1.3 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Jeremy Apthorp <nornagon@nornagon.net>
|
|
Date: Thu, 20 Sep 2018 17:49:24 -0700
|
|
Subject: mas-cgdisplayusesforcetogray.patch
|
|
|
|
Removes usage of the CGDisplayUsesForceToGray private API.
|
|
|
|
diff --git a/ui/display/mac/screen_mac.mm b/ui/display/mac/screen_mac.mm
|
|
index 99a128511250d594cdac79ebf9b291823db18962..7200a5df74e168b817f7e7598b7fce8b41c6515c 100644
|
|
--- 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.
|