diff --git a/Sources/OpenKey/macOS/ModernKey/AboutViewController.h b/Sources/OpenKey/macOS/ModernKey/AboutViewController.h
index d2d9630..0ff3274 100644
--- a/Sources/OpenKey/macOS/ModernKey/AboutViewController.h
+++ b/Sources/OpenKey/macOS/ModernKey/AboutViewController.h
@@ -13,6 +13,7 @@ NS_ASSUME_NONNULL_BEGIN
@interface AboutViewController : NSViewController
@property (weak) IBOutlet NSTextField *VersionInfo;
@property (weak) IBOutlet NSButton *CheckNewVersionButton;
+@property (weak) IBOutlet NSButton *CheckUpdateOnStatus;
@end
diff --git a/Sources/OpenKey/macOS/ModernKey/AboutViewController.m b/Sources/OpenKey/macOS/ModernKey/AboutViewController.m
index 38e4f56..b05190f 100644
--- a/Sources/OpenKey/macOS/ModernKey/AboutViewController.m
+++ b/Sources/OpenKey/macOS/ModernKey/AboutViewController.m
@@ -23,6 +23,9 @@ - (void)viewDidLoad {
[[NSBundle mainBundle] objectForInfoDictionaryKey: @"CFBundleShortVersionString"],
[[NSBundle mainBundle] objectForInfoDictionaryKey: @"CFBundleVersion"],
[OpenKeyManager getBuildDate]] ;
+
+ NSInteger dontCheckUpdate = [[NSUserDefaults standardUserDefaults] integerForKey:@"DontCheckUpdate"];
+ self.CheckUpdateOnStatus.state = dontCheckUpdate ? NSControlStateValueOff :NSControlStateValueOn;
}
- (IBAction)onHomePage:(id)sender {
@@ -37,6 +40,16 @@ - (IBAction)onLatestReleaseVersion:(id)sender {
[[NSWorkspace sharedWorkspace] openURL: [NSURL URLWithString:@"https://github.com/tuyenvm/OpenKey/releases"]];
}
+- (IBAction)onCheckUpdateOnStartup:(NSButton *)sender {
+ NSInteger val = 0;
+ if (sender.state == NSControlStateValueOn) {
+ val = 0;
+ } else {
+ val = 1;
+ }
+ [[NSUserDefaults standardUserDefaults] setInteger:val forKey:@"DontCheckUpdate"];
+}
+
- (IBAction)onCheckNewVersion:(id)sender {
self.CheckNewVersionButton.title = @"Đang kiểm tra...";
diff --git a/Sources/OpenKey/macOS/ModernKey/AppDelegate.m b/Sources/OpenKey/macOS/ModernKey/AppDelegate.m
index 2c64e59..325f459 100644
--- a/Sources/OpenKey/macOS/ModernKey/AppDelegate.m
+++ b/Sources/OpenKey/macOS/ModernKey/AppDelegate.m
@@ -142,7 +142,10 @@ - (void)applicationDidFinishLaunching:(NSNotification *)aNotification {
}
[[NSUserDefaults standardUserDefaults] setInteger:1 forKey:@"NonFirstTime"];
- [OpenKeyManager checkNewVersion:nil];
+ //check update if enable
+ NSInteger dontCheckUpdate = [[NSUserDefaults standardUserDefaults] integerForKey:@"DontCheckUpdate"];
+ if (!dontCheckUpdate)
+ [OpenKeyManager checkNewVersion:nil];
}
diff --git a/Sources/OpenKey/macOS/ModernKey/Base.lproj/Main.storyboard b/Sources/OpenKey/macOS/ModernKey/Base.lproj/Main.storyboard
index 5336dcc..54a3c70 100644
--- a/Sources/OpenKey/macOS/ModernKey/Base.lproj/Main.storyboard
+++ b/Sources/OpenKey/macOS/ModernKey/Base.lproj/Main.storyboard
@@ -707,11 +707,11 @@
-
+
-
+
@@ -720,7 +720,7 @@
-
+
@@ -729,7 +729,7 @@
-
+
@@ -738,12 +738,12 @@
-
+
-
+
@@ -759,7 +759,7 @@
-
+
@@ -768,7 +768,7 @@
-
+
@@ -784,7 +784,7 @@
-
+
@@ -793,7 +793,7 @@
-
+
@@ -809,7 +809,7 @@
-
+
@@ -827,7 +827,7 @@
+
+
-
+
@@ -873,11 +885,11 @@
-
+
-
+
@@ -886,7 +898,7 @@
-
+
@@ -953,7 +965,7 @@
-
+
@@ -962,7 +974,7 @@
-
+
@@ -971,7 +983,7 @@
-
+
@@ -980,7 +992,7 @@
-
+
@@ -998,7 +1010,7 @@
-
+
@@ -1016,7 +1028,7 @@
-
+
@@ -1025,7 +1037,7 @@
-
+
@@ -1213,7 +1225,7 @@
-
+
@@ -1222,7 +1234,7 @@
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Sources/OpenKey/macOS/ModernKey/Info.plist b/Sources/OpenKey/macOS/ModernKey/Info.plist
index 6dcb9b2..5ed04c8 100644
--- a/Sources/OpenKey/macOS/ModernKey/Info.plist
+++ b/Sources/OpenKey/macOS/ModernKey/Info.plist
@@ -19,9 +19,9 @@
CFBundlePackageType
APPL
CFBundleShortVersionString
- 1.6.2
+ 1.6.5
CFBundleVersion
- 40
+ 41
LSApplicationCategoryType
public.app-category.utilities
LSMinimumSystemVersion
diff --git a/Sources/OpenKey/macOS/ModernKey/OpenKey.mm b/Sources/OpenKey/macOS/ModernKey/OpenKey.mm
index beb293e..78febcf 100644
--- a/Sources/OpenKey/macOS/ModernKey/OpenKey.mm
+++ b/Sources/OpenKey/macOS/ModernKey/OpenKey.mm
@@ -40,7 +40,7 @@
CGEventRef eventBackSpaceDown;
CGEventRef eventBackSpaceUp;
UniChar _newChar, _newCharHi;
- CGEventRef _newEventDown;
+ CGEventRef _newEventDown, _newEventUp;
CGKeyCode _keycode;
CGEventFlags _flag, _lastFlag = 0, _privateFlag;
CGEventTapProxy _proxy;
@@ -199,6 +199,7 @@ void SendKeyCode(Uint32 data) {
InsertKeyLength(1);
_newEventDown = CGEventCreateKeyboardEvent(myEventSource, _newChar, true);
+ _newEventUp = CGEventCreateKeyboardEvent(myEventSource, _newChar, false);
_privateFlag = CGEventGetFlags(_newEventDown);
if (data & CAPS_MASK) {
@@ -209,7 +210,10 @@ void SendKeyCode(Uint32 data) {
_privateFlag |= kCGEventFlagMaskNonCoalesced;
CGEventSetFlags(_newEventDown, _privateFlag);
+ CGEventSetFlags(_newEventUp, _privateFlag);
CGEventTapPostEvent(_proxy, _newEventDown);
+ CGEventTapPostEvent(_proxy, _newEventUp);
+ CFRelease(_newEventUp);
} else {
if (vCodeTable == 0) { //unicode 2 bytes code
_newEventDown = CGEventCreateKeyboardEvent(myEventSource, 0, true);