Skip to content

Commit

Permalink
add as property instead of method
Browse files Browse the repository at this point in the history
  • Loading branch information
georgexu99 committed Aug 30, 2023
1 parent 8b68f32 commit f86cf55
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 11 deletions.
6 changes: 1 addition & 5 deletions docs/api/system-preferences.md
Original file line number Diff line number Diff line change
Expand Up @@ -415,15 +415,11 @@ Returns `Object`:

Returns an object with system animation settings.

### `systemPreferences.getAccessibilityDisplayShouldReduceTransparency()` _macOS_

Returns `boolean` - Returns whether the app avoids using semitransparent backgrounds. This maps to [NSWorkspace.accessibilityDisplayShouldReduceTransparency](https://developer.apple.com/documentation/appkit/nsworkspace/1533006-accessibilitydisplayshouldreduce)

## Properties

### `systemPreferences.accessibilityDisplayShouldReduceTransparency()` _macOS_

A `boolean` property. It determines whether the app avoids using semitransparent backgrounds. This maps to [NSWorkspace.accessibilityDisplayShouldReduceTransparency](https://developer.apple.com/documentation/appkit/nsworkspace/1533006-accessibilitydisplayshouldreduce)
A `boolean` property which determines whether the app avoids using semitransparent backgrounds. This maps to [NSWorkspace.accessibilityDisplayShouldReduceTransparency](https://developer.apple.com/documentation/appkit/nsworkspace/1533006-accessibilitydisplayshouldreduce)

### `systemPreferences.appLevelAppearance` _macOS_ _Deprecated_

Expand Down
5 changes: 1 addition & 4 deletions shell/browser/api/electron_api_system_preferences.cc
Original file line number Diff line number Diff line change
Expand Up @@ -99,12 +99,9 @@ gin::ObjectTemplateBuilder SystemPreferences::GetObjectTemplateBuilder(
.SetMethod("isTrustedAccessibilityClient",
&SystemPreferences::IsTrustedAccessibilityClient)
.SetMethod("askForMediaAccess", &SystemPreferences::AskForMediaAccess)
.SetMethod(
"getAccessibilityDisplayShouldReduceTransparency",
&SystemPreferences::getAccessibilityDisplayShouldReduceTransparency)
.SetProperty(
"accessibilityDisplayShouldReduceTransparency",
&SystemPreferences::getAccessibilityDisplayShouldReduceTransparency)
&SystemPreferences::GetAccessibilityDisplayShouldReduceTransparency)
#endif
.SetMethod("getAnimationSettings",
&SystemPreferences::GetAnimationSettings);
Expand Down
2 changes: 1 addition & 1 deletion shell/browser/api/electron_api_system_preferences.h
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ class SystemPreferences
gin::Arguments* args);
void RemoveUserDefault(const std::string& name);
bool IsSwipeTrackingFromScrollEventsEnabled();
bool AccessibilityDisplayShouldReduceTransparency();
bool GetAccessibilityDisplayShouldReduceTransparency();

std::string GetSystemColor(gin_helper::ErrorThrower thrower,
const std::string& color);
Expand Down
2 changes: 1 addition & 1 deletion shell/browser/api/electron_api_system_preferences_mac.mm
Original file line number Diff line number Diff line change
Expand Up @@ -620,7 +620,7 @@ AVMediaType ParseMediaType(const std::string& media_type) {
}
}

bool SystemPreferences::AccessibilityDisplayShouldReduceTransparency() {
bool SystemPreferences::GetAccessibilityDisplayShouldReduceTransparency() {
return [[NSWorkspace sharedWorkspace]
accessibilityDisplayShouldReduceTransparency];
}
Expand Down

0 comments on commit f86cf55

Please sign in to comment.