From b5e06e61d09c9cad3d44181b2ae6e1ef3822a415 Mon Sep 17 00:00:00 2001 From: Kengo Yokoyama Date: Sun, 15 Jul 2018 17:34:33 +0900 Subject: [PATCH 1/5] :fire: Remove unused code --- Fuwari/AppDelegate.swift | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Fuwari/AppDelegate.swift b/Fuwari/AppDelegate.swift index 6e43cae..64771ad 100644 --- a/Fuwari/AppDelegate.swift +++ b/Fuwari/AppDelegate.swift @@ -16,8 +16,7 @@ import Sparkle @NSApplicationMain class AppDelegate: NSObject, NSApplicationDelegate { - - private var eventMonitor: Any? + private let defaults = UserDefaults.standard private var screenshotManager: ScreenshotManager? From 8a692f4c8d334041b799a2f1dbe684dd61e4738a Mon Sep 17 00:00:00 2001 From: Kengo Yokoyama Date: Sun, 15 Jul 2018 17:36:45 +0900 Subject: [PATCH 2/5] :bug: Fix app crash when close window multi times --- Fuwari/ViewController.swift | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Fuwari/ViewController.swift b/Fuwari/ViewController.swift index d5f9dca..c81e85d 100644 --- a/Fuwari/ViewController.swift +++ b/Fuwari/ViewController.swift @@ -58,7 +58,9 @@ extension ViewController: FloatDelegate { if !isCancelled { if windowControllers.filter({ $0 === floatWindow }).first != nil { floatWindow.fadeWindow(isIn: false) { - floatWindow.close() + guard let index = self.windowControllers.index(where: {$0 === floatWindow}) else { return } + self.windowControllers.remove(at: index) + self.windowControllers.last?.makeKey() } } } From bdd2bdf1d5b15e0efa1fc872e41b315789296329 Mon Sep 17 00:00:00 2001 From: Kengo Yokoyama Date: Sun, 15 Jul 2018 19:15:50 +0900 Subject: [PATCH 3/5] :bug: Fix shortcuts notation of capture --- Fuwari/MenuManager.swift | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Fuwari/MenuManager.swift b/Fuwari/MenuManager.swift index a5eed66..55dcc5a 100644 --- a/Fuwari/MenuManager.swift +++ b/Fuwari/MenuManager.swift @@ -41,7 +41,7 @@ class MenuManager: NSObject { } func udpateCpatureMenuItem() { - statusItem.menu?.items[2].keyEquivalent = HotKeyManager.shared.captureKeyCombo.characters.lowercased() - statusItem.menu?.items[2].keyEquivalentModifierMask = KeyTransformer.cocoaFlags(from: HotKeyManager.shared.captureKeyCombo.modifiers) + captureItem.keyEquivalent = HotKeyManager.shared.captureKeyCombo.characters.lowercased() + captureItem.keyEquivalentModifierMask = KeyTransformer.cocoaFlags(from: HotKeyManager.shared.captureKeyCombo.modifiers) } } From 066526a22bf7c023f04711a95875e554e28e31a7 Mon Sep 17 00:00:00 2001 From: Kengo Yokoyama Date: Sun, 15 Jul 2018 19:45:11 +0900 Subject: [PATCH 4/5] :bug: Fix problem that window alpha does not become valid with first click --- Fuwari.xcodeproj/project.pbxproj | 4 ++++ Fuwari/FloatView.swift | 23 +++++++++++++++++++++++ Fuwari/FloatWindow.swift | 10 +--------- 3 files changed, 28 insertions(+), 9 deletions(-) create mode 100644 Fuwari/FloatView.swift diff --git a/Fuwari.xcodeproj/project.pbxproj b/Fuwari.xcodeproj/project.pbxproj index c29a166..25ff282 100644 --- a/Fuwari.xcodeproj/project.pbxproj +++ b/Fuwari.xcodeproj/project.pbxproj @@ -22,6 +22,7 @@ BE6D5E771E12CF5E005492B2 /* AboutWindowController.xib in Resources */ = {isa = PBXBuildFile; fileRef = BE6D5E751E12CF5E005492B2 /* AboutWindowController.xib */; }; BE7E825B1DF74A2D00F3F2F8 /* FloatWindow.swift in Sources */ = {isa = PBXBuildFile; fileRef = BE7E825A1DF74A2D00F3F2F8 /* FloatWindow.swift */; }; BE85482020F975E00035BC60 /* NSMenu+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = BE85481F20F975E00035BC60 /* NSMenu+Extension.swift */; }; + BE85482420FB5C640035BC60 /* FloatView.swift in Sources */ = {isa = PBXBuildFile; fileRef = BE85482320FB5C640035BC60 /* FloatView.swift */; }; BE9777ED1E0E613700E5934F /* UserDefaults+ArchiveData.swift in Sources */ = {isa = PBXBuildFile; fileRef = BE9777EC1E0E613700E5934F /* UserDefaults+ArchiveData.swift */; }; BE9777EF1E0EB4D900E5934F /* KeyHolder.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = BE9777EE1E0EB4D900E5934F /* KeyHolder.framework */; }; BE9777F01E0EC24F00E5934F /* ShortcutsPreferenceViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = BE9777F21E0EC24F00E5934F /* ShortcutsPreferenceViewController.xib */; }; @@ -54,6 +55,7 @@ BE6D5E751E12CF5E005492B2 /* AboutWindowController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = AboutWindowController.xib; sourceTree = ""; }; BE7E825A1DF74A2D00F3F2F8 /* FloatWindow.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FloatWindow.swift; sourceTree = ""; }; BE85481F20F975E00035BC60 /* NSMenu+Extension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "NSMenu+Extension.swift"; sourceTree = ""; }; + BE85482320FB5C640035BC60 /* FloatView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FloatView.swift; sourceTree = ""; }; BE9777EC1E0E613700E5934F /* UserDefaults+ArchiveData.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "UserDefaults+ArchiveData.swift"; sourceTree = ""; }; BE9777EE1E0EB4D900E5934F /* KeyHolder.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = KeyHolder.framework; path = Carthage/Build/Mac/KeyHolder.framework; sourceTree = ""; }; BE9777F31E0EC25500E5934F /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/ShortcutsPreferenceViewController.xib; sourceTree = ""; }; @@ -128,6 +130,7 @@ BEC844F61DED859300A4A57A /* AppDelegate.swift */, BEC844F81DED859300A4A57A /* ViewController.swift */, BE7E825A1DF74A2D00F3F2F8 /* FloatWindow.swift */, + BE85482320FB5C640035BC60 /* FloatView.swift */, BEAFC2D220E8FC2E00F12911 /* ScreenshotManager.swift */, BE5BE7A31E065D7800820201 /* HotKeyManager.swift */, BE9777F71E100D1F00E5934F /* MenuManager.swift */, @@ -308,6 +311,7 @@ BE85482020F975E00035BC60 /* NSMenu+Extension.swift in Sources */, BEF57FEF1DFD58D4006595B6 /* NSColor+Fuwari.swift in Sources */, BEC844F91DED859300A4A57A /* ViewController.swift in Sources */, + BE85482420FB5C640035BC60 /* FloatView.swift in Sources */, BE6D5E761E12CF5E005492B2 /* AboutWindowController.swift in Sources */, BE5BE7A41E065D7800820201 /* HotKeyManager.swift in Sources */, BE5896A11DFCED26007CE7AC /* LocalizedString.swift in Sources */, diff --git a/Fuwari/FloatView.swift b/Fuwari/FloatView.swift new file mode 100644 index 0000000..59f70e6 --- /dev/null +++ b/Fuwari/FloatView.swift @@ -0,0 +1,23 @@ +// +// FloatView.swift +// Fuwari +// +// Created by Kengo Yokoyama on 2018/07/15. +// Copyright © 2018年 AppKnop. All rights reserved. +// + +import Cocoa + +class FloatView: NSView { + override func acceptsFirstMouse(for event: NSEvent?) -> Bool { + return true + } + + override func mouseDown(with event: NSEvent) { + window?.alphaValue = 0.4 + } + + override func mouseUp(with event: NSEvent) { + window?.alphaValue = 1.0 + } +} diff --git a/Fuwari/FloatWindow.swift b/Fuwari/FloatWindow.swift index 62dc0d9..a5c9d16 100644 --- a/Fuwari/FloatWindow.swift +++ b/Fuwari/FloatWindow.swift @@ -31,7 +31,7 @@ class FloatWindow: NSWindow { init(contentRect: NSRect, styleMask style: NSWindow.StyleMask = .borderless, backing bufferingType: NSWindow.BackingStoreType = .buffered, defer flag: Bool = false, image: CGImage) { super.init(contentRect: contentRect, styleMask: style, backing: bufferingType, defer: flag) - + contentView = FloatView(frame: contentRect) originalRect = contentRect level = .floating isMovableByWindowBackground = true @@ -88,14 +88,6 @@ class FloatWindow: NSWindow { } } - override func mouseDown(with event: NSEvent) { - alphaValue = 0.4 - } - - override func mouseUp(with event: NSEvent) { - alphaValue = 1.0 - } - override func rightMouseDown(with event: NSEvent) { if let menu = menu, let contentView = contentView { NSMenu.popUpContextMenu(menu, with: event, for: contentView) From 39601ccc1454147370dc5f992cefaff06f625819 Mon Sep 17 00:00:00 2001 From: Kengo Yokoyama Date: Sun, 15 Jul 2018 19:46:38 +0900 Subject: [PATCH 5/5] :arrow_up: Version 0.5.1 --- Fuwari/Info.plist | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Fuwari/Info.plist b/Fuwari/Info.plist index bafa25c..7946d4a 100644 --- a/Fuwari/Info.plist +++ b/Fuwari/Info.plist @@ -17,9 +17,9 @@ CFBundlePackageType APPL CFBundleShortVersionString - 0.5.0 + 0.5.1 CFBundleVersion - 0.50 + 0.51 Fabric APIKey