Merge pull request #6686 from darkdh/swipe_prefs
Swipe back/forward should respect system preferences
This commit is contained in:
commit
322fb97d8d
4 changed files with 17 additions and 0 deletions
|
@ -59,6 +59,8 @@ void SystemPreferences::BuildPrototype(
|
||||||
.SetMethod("unsubscribeLocalNotification",
|
.SetMethod("unsubscribeLocalNotification",
|
||||||
&SystemPreferences::UnsubscribeLocalNotification)
|
&SystemPreferences::UnsubscribeLocalNotification)
|
||||||
.SetMethod("getUserDefault", &SystemPreferences::GetUserDefault)
|
.SetMethod("getUserDefault", &SystemPreferences::GetUserDefault)
|
||||||
|
.SetMethod("isSwipeTrackingFromScrollEventsEnabled",
|
||||||
|
&SystemPreferences::IsSwipeTrackingFromScrollEventsEnabled)
|
||||||
#endif
|
#endif
|
||||||
.SetMethod("isDarkMode", &SystemPreferences::IsDarkMode);
|
.SetMethod("isDarkMode", &SystemPreferences::IsDarkMode);
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,6 +40,10 @@ class SystemPreferences : public mate::EventEmitter<SystemPreferences> {
|
||||||
void UnsubscribeLocalNotification(int request_id);
|
void UnsubscribeLocalNotification(int request_id);
|
||||||
v8::Local<v8::Value> GetUserDefault(const std::string& name,
|
v8::Local<v8::Value> GetUserDefault(const std::string& name,
|
||||||
const std::string& type);
|
const std::string& type);
|
||||||
|
// On 10.7+, back and forward swipe gestures can be triggered using a scroll
|
||||||
|
// gesture, if enabled in System Preferences. This function returns true if
|
||||||
|
// the feature is supported and enabled, and false otherwise.
|
||||||
|
bool IsSwipeTrackingFromScrollEventsEnabled();
|
||||||
#endif
|
#endif
|
||||||
bool IsDarkMode();
|
bool IsDarkMode();
|
||||||
|
|
||||||
|
|
|
@ -11,6 +11,7 @@
|
||||||
#include "atom/browser/mac/dict_util.h"
|
#include "atom/browser/mac/dict_util.h"
|
||||||
#include "atom/common/native_mate_converters/value_converter.h"
|
#include "atom/common/native_mate_converters/value_converter.h"
|
||||||
#include "atom/common/native_mate_converters/gurl_converter.h"
|
#include "atom/common/native_mate_converters/gurl_converter.h"
|
||||||
|
#import "base/mac/sdk_forward_declarations.h"
|
||||||
#include "base/strings/sys_string_conversions.h"
|
#include "base/strings/sys_string_conversions.h"
|
||||||
#include "base/values.h"
|
#include "base/values.h"
|
||||||
#include "net/base/mac/url_conversions.h"
|
#include "net/base/mac/url_conversions.h"
|
||||||
|
@ -122,6 +123,12 @@ bool SystemPreferences::IsDarkMode() {
|
||||||
return [mode isEqualToString:@"Dark"];
|
return [mode isEqualToString:@"Dark"];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool SystemPreferences::IsSwipeTrackingFromScrollEventsEnabled() {
|
||||||
|
SEL selector = @selector(isSwipeTrackingFromScrollEventsEnabled);
|
||||||
|
return [NSEvent respondsToSelector:selector]
|
||||||
|
&& [NSEvent performSelector:selector];
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace api
|
} // namespace api
|
||||||
|
|
||||||
} // namespace atom
|
} // namespace atom
|
||||||
|
|
|
@ -13,6 +13,10 @@ console.log(systemPreferences.isDarkMode())
|
||||||
|
|
||||||
This method returns `true` if the system is in Dark Mode, and `false` otherwise.
|
This method returns `true` if the system is in Dark Mode, and `false` otherwise.
|
||||||
|
|
||||||
|
### `systemPreferences.isSwipeTrackingFromScrollEventsEnabled()` _macOS_
|
||||||
|
|
||||||
|
This method returns `true` if the Swipe between pages setting is on, and `false` otherwise.
|
||||||
|
|
||||||
### `systemPreferences.subscribeNotification(event, callback)` _macOS_
|
### `systemPreferences.subscribeNotification(event, callback)` _macOS_
|
||||||
|
|
||||||
* `event` String
|
* `event` String
|
||||||
|
|
Loading…
Reference in a new issue