Skip to content

Commit

Permalink
Merge pull request #521 from Caldis/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
Caldis committed Sep 12, 2022
2 parents f0a1779 + 3467d86 commit 59ea9db
Show file tree
Hide file tree
Showing 14 changed files with 299 additions and 166 deletions.
8 changes: 4 additions & 4 deletions Mos.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
0BB0F1C020F3A05D00909B7D /* WelcomeViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0BB0F1BF20F3A05D00909B7D /* WelcomeViewController.swift */; };
0BC2AD2F20F3BA090084416B /* PreferencesContributorsViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0BC2AD2E20F3BA090084416B /* PreferencesContributorsViewController.swift */; };
0BD39F68204EFC6C000CCC42 /* StatusItemManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0BD39F67204EFC6C000CCC42 /* StatusItemManager.swift */; };
0BE4C93B20617C6E0001EA0E /* ScrollFiller.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0BE4C93A20617C6E0001EA0E /* ScrollFiller.swift */; };
0BE4C93B20617C6E0001EA0E /* ScrollFilter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0BE4C93A20617C6E0001EA0E /* ScrollFilter.swift */; };
0BE5A292253A1168006D61C0 /* LoginServiceKit in Frameworks */ = {isa = PBXBuildFile; productRef = 0BE5A291253A1168006D61C0 /* LoginServiceKit */; };
0BE5A296253A119C006D61C0 /* Charts in Frameworks */ = {isa = PBXBuildFile; productRef = 0BE5A295253A119C006D61C0 /* Charts */; };
22003C6E1E8555F0001220BC /* Utils.swift in Sources */ = {isa = PBXBuildFile; fileRef = 22003C6D1E8555F0001220BC /* Utils.swift */; };
Expand Down Expand Up @@ -90,7 +90,7 @@
0BB0F1BF20F3A05D00909B7D /* WelcomeViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WelcomeViewController.swift; sourceTree = "<group>"; };
0BC2AD2E20F3BA090084416B /* PreferencesContributorsViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PreferencesContributorsViewController.swift; sourceTree = "<group>"; };
0BD39F67204EFC6C000CCC42 /* StatusItemManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StatusItemManager.swift; sourceTree = "<group>"; };
0BE4C93A20617C6E0001EA0E /* ScrollFiller.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ScrollFiller.swift; sourceTree = "<group>"; };
0BE4C93A20617C6E0001EA0E /* ScrollFilter.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ScrollFilter.swift; sourceTree = "<group>"; };
22003C6D1E8555F0001220BC /* Utils.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Utils.swift; sourceTree = "<group>"; };
22142DA01E25344E00E4BFBF /* Mos.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Mos.app; sourceTree = BUILT_PRODUCTS_DIR; };
22142DA31E25344E00E4BFBF /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -145,7 +145,7 @@
children = (
2291A8A21E2A5400004181B8 /* ScrollCore.swift */,
0B12EF1C203ADD230058B169 /* ScrollUtils.swift */,
0BE4C93A20617C6E0001EA0E /* ScrollFiller.swift */,
0BE4C93A20617C6E0001EA0E /* ScrollFilter.swift */,
0B6D3B692041C348004CC064 /* ScrollEvent.swift */,
0B474328258E12A200A5F8A3 /* ScrollPhase.swift */,
0B99C5FB2577FC9200021578 /* ScrollPoster.swift */,
Expand Down Expand Up @@ -444,7 +444,7 @@
23E9673F23613D1100E652F6 /* PreferencesExceptionInputViewController.swift in Sources */,
232E50A7236B372100265C58 /* PreferencesAdvanceWithApplicationViewController.swift in Sources */,
22A32B331E334B2E00A5CF38 /* PreferencesAboutViewController.swift in Sources */,
0BE4C93B20617C6E0001EA0E /* ScrollFiller.swift in Sources */,
0BE4C93B20617C6E0001EA0E /* ScrollFilter.swift in Sources */,
0B6D3B682041A790004CC064 /* WindowManager.swift in Sources */,
0B12EF1A203AD9C80058B169 /* Options.swift in Sources */,
228093501E2B5DA90061A00F /* PreferencesGeneralViewController.swift in Sources */,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,23 +1,25 @@
{
"pins" : [
{
"identity" : "charts",
"kind" : "remoteSourceControl",
"location" : "https://github.com/danielgindi/Charts",
"state" : {
"revision" : "66546404a6739173b8e436ab6bc1f2897cd08594",
"version" : "3.6.0"
"object": {
"pins": [
{
"package": "Charts",
"repositoryURL": "https://github.com/danielgindi/Charts",
"state": {
"branch": null,
"revision": "66546404a6739173b8e436ab6bc1f2897cd08594",
"version": "3.6.0"
}
},
{
"package": "LoginServiceKit",
"repositoryURL": "https://github.com/Clipy/LoginServiceKit",
"state": {
"branch": null,
"revision": "5af9098805ff603830aec65754071c6514bbcacd",
"version": "2.4.0"
}
}
},
{
"identity" : "loginservicekit",
"kind" : "remoteSourceControl",
"location" : "https://github.com/Clipy/LoginServiceKit",
"state" : {
"revision" : "5af9098805ff603830aec65754071c6514bbcacd",
"version" : "2.4.0"
}
}
],
"version" : 2
]
},
"version": 1
}
135 changes: 135 additions & 0 deletions Mos.xcodeproj/xcshareddata/xcschemes/Debug.xcscheme
Original file line number Diff line number Diff line change
@@ -0,0 +1,135 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1340"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "22142D9F1E25344E00E4BFBF"
BuildableName = "Mos.app"
BlueprintName = "Mos"
ReferencedContainer = "container:Mos.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES"
enableAddressSanitizer = "YES"
enableASanStackUseAfterReturn = "YES">
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "22142D9F1E25344E00E4BFBF"
BuildableName = "Mos.app"
BlueprintName = "Mos"
ReferencedContainer = "container:Mos.xcodeproj">
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
<AdditionalOption
key = "NSZombieEnabled"
value = "YES"
isEnabled = "YES">
</AdditionalOption>
<AdditionalOption
key = "MallocScribble"
value = ""
isEnabled = "YES">
</AdditionalOption>
</AdditionalOptions>
<Testables>
</Testables>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
enableASanStackUseAfterReturn = "YES"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
enableGPUValidationMode = "1"
allowLocationSimulation = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "22142D9F1E25344E00E4BFBF"
BuildableName = "Mos.app"
BlueprintName = "Mos"
ReferencedContainer = "container:Mos.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
<AdditionalOptions>
<AdditionalOption
key = "MallocStackLogging"
value = ""
isEnabled = "YES">
</AdditionalOption>
<AdditionalOption
key = "DYLD_INSERT_LIBRARIES"
value = "/usr/lib/libgmalloc.dylib"
isEnabled = "YES">
</AdditionalOption>
<AdditionalOption
key = "PrefersMallocStackLoggingLite"
value = ""
isEnabled = "YES">
</AdditionalOption>
<AdditionalOption
key = "NSZombieEnabled"
value = "YES"
isEnabled = "YES">
</AdditionalOption>
<AdditionalOption
key = "MallocGuardEdges"
value = ""
isEnabled = "YES">
</AdditionalOption>
<AdditionalOption
key = "MallocScribble"
value = ""
isEnabled = "YES">
</AdditionalOption>
</AdditionalOptions>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "22142D9F1E25344E00E4BFBF"
BuildableName = "Mos.app"
BlueprintName = "Mos"
ReferencedContainer = "container:Mos.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1340"
LastUpgradeVersion = "1300"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand All @@ -27,22 +27,13 @@
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES">
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "22142D9F1E25344E00E4BFBF"
BuildableName = "Mos.app"
BlueprintName = "Mos"
ReferencedContainer = "container:Mos.xcodeproj">
</BuildableReference>
</MacroExpansion>
<Testables>
</Testables>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = ""
selectedLauncherIdentifier = "Xcode.IDEFoundation.Launcher.PosixSpawn"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,18 @@
uuid = "32EA6F78-F020-42D7-AE40-730D164E821A"
type = "1"
version = "2.0">
<Breakpoints>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.ExceptionBreakpoint">
<BreakpointContent
uuid = "737FF52F-5223-411B-8F37-5CE0D46FACB4"
shouldBeEnabled = "Yes"
ignoreCount = "0"
continueAfterRunningActions = "No"
breakpointStackSelectionBehavior = "1"
scope = "1"
stopOnStyle = "0">
</BreakpointContent>
</BreakpointProxy>
</Breakpoints>
</Bucket>
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<dict>
<key>SchemeUserState</key>
<dict>
<key>Mos.xcscheme</key>
<key>Debug.xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
<integer>0</integer>
Expand Down Expand Up @@ -51,6 +51,11 @@
<key>orderHint</key>
<integer>1</integer>
</dict>
<key>Profile.xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
<integer>4</integer>
</dict>
</dict>
<key>SuppressBuildableAutocreation</key>
<dict>
Expand Down
2 changes: 1 addition & 1 deletion Mos/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

import Cocoa

@NSApplicationMain
@main
class AppDelegate: NSObject, NSApplicationDelegate {

// 运行前预处理
Expand Down
21 changes: 13 additions & 8 deletions Mos/Managers/StatusItemManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,16 @@ class StatusItemManager: NSMenu, NSMenuDelegate {
// 状态栏类型
let TYPE = STATUS_ITEM_TYPE.menu


// 单例
static let shared = StatusItemManager()

// 状态栏引用
static let statusItem = NSStatusBar.system.statusItem(withLength: NSStatusItem.variableLength)
let item = StatusItemManager.statusItem
let item = NSStatusBar.system.statusItem(withLength: NSStatusItem.variableLength)

// 初始化
override func awakeFromNib() {
NSLog("Module initialized: StatusItemManager")
// 设置图标
item.image = #imageLiteral(resourceName: "AppStatusBarIcon")
// 设置事件响应
Expand Down Expand Up @@ -135,19 +140,19 @@ extension StatusItemManager {
**/
extension StatusItemManager {
// 显示状态栏图标
class func showStatusItem() {
func showStatusItem() {
if #available(OSX 10.12, *) {
self.statusItem.isVisible = true
item.isVisible = true
} else {
self.statusItem.length = NSStatusItem.variableLength
item.length = NSStatusItem.variableLength
}
}
// 隐藏状态栏图标
class func hideStatusItem() {
func hideStatusItem() {
if #available(OSX 10.12, *) {
self.statusItem.isVisible = false
item.isVisible = false
} else {
self.statusItem.length = 0.0
item.length = 0.0
}
}
}
6 changes: 3 additions & 3 deletions Mos/ScrollCore/ScrollCore.swift
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ class ScrollCore {
x: scrollEvent.X.usableValue,
speed: speed,
amplification: ScrollCore.shared.dashAmplification
).enable()
).tryStart()
}
// 返回事件对象
if returnOriginalEvent {
Expand Down Expand Up @@ -238,7 +238,7 @@ class ScrollCore {
// MARK: - 鼠标事件处理
let mouseLeftEventCallBack: CGEventTapCallBack = { (proxy, type, event, refcon) in
// 如果点击左键则停止滚动
ScrollPoster.shared.disableManual()
ScrollPoster.shared.stop()
return nil
}

Expand Down Expand Up @@ -279,7 +279,7 @@ class ScrollCore {
if !isActive {return}
isActive = false
// 停止滚动事件发送器
ScrollPoster.shared.disableAuto()
ScrollPoster.shared.stop()
// 停止截取事件
scrollEventInterceptor?.stop()
hotkeyEventInterceptor?.stop()
Expand Down
Loading

0 comments on commit 59ea9db

Please sign in to comment.