Cleanup things

This commit is contained in:
Shadowfacts 2021-09-01 23:33:58 -04:00
parent f6b02d6f79
commit 4403fb8eca
2 changed files with 5 additions and 9 deletions

View File

@ -14,14 +14,8 @@ class AppDelegate: NSObject, NSApplicationDelegate {
// things that need to be retained to keep them from disappearing
private var prefPanesSupport: Bundle!
private var item: NSStatusItem!
private var observation: NSKeyValueObservation?
func applicationDidFinishLaunching(_ aNotification: Notification) {
// this is where _setSwipeScrollDirection is defined
prefPanesSupport = Bundle(path: "/System/Library/PrivateFrameworks/PreferencePanesSupport.framework")
try! prefPanesSupport!.loadAndReturnError()
item = NSStatusBar.system.statusItem(withLength: NSStatusItem.squareLength)
item.button!.target = self
item.button!.action = #selector(menuItemClicked)
@ -84,7 +78,7 @@ class AppDelegate: NSObject, NSApplicationDelegate {
// makes system preferences update
DistributedNotificationCenter.default().postNotificationName(.swipeScrollDirectionDidChangeNotification, object: nil, userInfo: nil, deliverImmediately: false)
// make the actual input behavior update
setSwipeScrollDirection(Int32(new.rawValue))
setSwipeScrollDirection(new == .natural)
}
}
@ -96,7 +90,7 @@ extension AppDelegate: NSMenuDelegate {
}
}
enum Direction: Int, Equatable {
enum Direction: Equatable {
case normal, natural
static var current: Direction {

View File

@ -8,6 +8,8 @@
#ifndef ScrollSwitcher_Bridging_Header_h
#define ScrollSwitcher_Bridging_Header_h
void setSwipeScrollDirection(int arg0);
#import <CoreFoundation/CoreFoundation.h>
void setSwipeScrollDirection(BOOL natural);
#endif /* ScrollSwitcher_Bridging_Header_h */