Skip to content

Commit a64af3d

Browse files
committed
Merge branch 'master' of https://github.com/tuyenvm/OpenKey
2 parents 6eeb4e2 + af1d94c commit a64af3d

File tree

9 files changed

+179
-50
lines changed

9 files changed

+179
-50
lines changed

README.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,5 +93,8 @@ OpenKey cần cấp quyền, vào *System Preferences -> Security & Privacy -> A
9393
## Một điều nhỏ nhoi
9494
Đừng quên ủng hộ tác giả bằng cách mua ly cafe cho tác giả tỉnh ngủ nhé:
9595
[Buy me a coffee ^^](https://tuyenvm.github.io/donate.html)
96-
[hoặc Redbull cũng được ^^](https://paypal.me/tuyenmai)
96+
[Redbull cũng được ^^](https://paypal.me/tuyenmai)
97+
Hoặc trực tiếp qua ví momo:
98+
![Donate by momo](https://tuyenvm.github.io/images/momo.png "Momo").
99+
97100
Cảm ơn các bạn rất nhiều.

Sources/OpenKey/macOS/ModernKey/AboutViewController.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ NS_ASSUME_NONNULL_BEGIN
1313
@interface AboutViewController : NSViewController
1414
@property (weak) IBOutlet NSTextField *VersionInfo;
1515
@property (weak) IBOutlet NSButton *CheckNewVersionButton;
16+
@property (weak) IBOutlet NSButton *CheckUpdateOnStatus;
1617

1718
@end
1819

Sources/OpenKey/macOS/ModernKey/AboutViewController.m

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@ - (void)viewDidLoad {
2323
[[NSBundle mainBundle] objectForInfoDictionaryKey: @"CFBundleShortVersionString"],
2424
[[NSBundle mainBundle] objectForInfoDictionaryKey: @"CFBundleVersion"],
2525
[OpenKeyManager getBuildDate]] ;
26+
27+
NSInteger dontCheckUpdate = [[NSUserDefaults standardUserDefaults] integerForKey:@"DontCheckUpdate"];
28+
self.CheckUpdateOnStatus.state = dontCheckUpdate ? NSControlStateValueOff :NSControlStateValueOn;
2629
}
2730

2831
- (IBAction)onHomePage:(id)sender {
@@ -37,6 +40,16 @@ - (IBAction)onLatestReleaseVersion:(id)sender {
3740
[[NSWorkspace sharedWorkspace] openURL: [NSURL URLWithString:@"https://github.com/tuyenvm/OpenKey/releases"]];
3841
}
3942

43+
- (IBAction)onCheckUpdateOnStartup:(NSButton *)sender {
44+
NSInteger val = 0;
45+
if (sender.state == NSControlStateValueOn) {
46+
val = 0;
47+
} else {
48+
val = 1;
49+
}
50+
[[NSUserDefaults standardUserDefaults] setInteger:val forKey:@"DontCheckUpdate"];
51+
}
52+
4053
- (IBAction)onCheckNewVersion:(id)sender {
4154

4255
self.CheckNewVersionButton.title = @"Đang kiểm tra...";

Sources/OpenKey/macOS/ModernKey/AppDelegate.m

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,10 @@ - (void)applicationDidFinishLaunching:(NSNotification *)aNotification {
142142
}
143143
[[NSUserDefaults standardUserDefaults] setInteger:1 forKey:@"NonFirstTime"];
144144

145-
[OpenKeyManager checkNewVersion:nil];
145+
//check update if enable
146+
NSInteger dontCheckUpdate = [[NSUserDefaults standardUserDefaults] integerForKey:@"DontCheckUpdate"];
147+
if (!dontCheckUpdate)
148+
[OpenKeyManager checkNewVersion:nil];
146149
}
147150

148151

Sources/OpenKey/macOS/ModernKey/Base.lproj/Main.storyboard

Lines changed: 146 additions & 43 deletions
Large diffs are not rendered by default.

Sources/OpenKey/macOS/ModernKey/Info.plist

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@
1919
<key>CFBundlePackageType</key>
2020
<string>APPL</string>
2121
<key>CFBundleShortVersionString</key>
22-
<string>1.6.2</string>
22+
<string>1.6.5</string>
2323
<key>CFBundleVersion</key>
24-
<string>40</string>
24+
<string>41</string>
2525
<key>LSApplicationCategoryType</key>
2626
<string>public.app-category.utilities</string>
2727
<key>LSMinimumSystemVersion</key>

Sources/OpenKey/macOS/ModernKey/OpenKey.mm

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
CGEventRef eventBackSpaceDown;
4141
CGEventRef eventBackSpaceUp;
4242
UniChar _newChar, _newCharHi;
43-
CGEventRef _newEventDown;
43+
CGEventRef _newEventDown, _newEventUp;
4444
CGKeyCode _keycode;
4545
CGEventFlags _flag, _lastFlag = 0, _privateFlag;
4646
CGEventTapProxy _proxy;
@@ -199,6 +199,7 @@ void SendKeyCode(Uint32 data) {
199199
InsertKeyLength(1);
200200

201201
_newEventDown = CGEventCreateKeyboardEvent(myEventSource, _newChar, true);
202+
_newEventUp = CGEventCreateKeyboardEvent(myEventSource, _newChar, false);
202203
_privateFlag = CGEventGetFlags(_newEventDown);
203204

204205
if (data & CAPS_MASK) {
@@ -209,7 +210,10 @@ void SendKeyCode(Uint32 data) {
209210
_privateFlag |= kCGEventFlagMaskNonCoalesced;
210211

211212
CGEventSetFlags(_newEventDown, _privateFlag);
213+
CGEventSetFlags(_newEventUp, _privateFlag);
212214
CGEventTapPostEvent(_proxy, _newEventDown);
215+
CGEventTapPostEvent(_proxy, _newEventUp);
216+
CFRelease(_newEventUp);
213217
} else {
214218
if (vCodeTable == 0) { //unicode 2 bytes code
215219
_newEventDown = CGEventCreateKeyboardEvent(myEventSource, 0, true);

Sources/OpenKey/win32/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,4 +67,6 @@ OpenKey for Windows được phát hành dưới giấy phép GPL, điều này
6767

6868
## Một điều nữa
6969
Đừng quên ủng hộ tác giả bằng cách mua ly cafe cho tác giả tỉnh ngủ nhé: [Gửi cafe](https://paypal.me/tuyenmai)
70+
Hoặc trực tiếp qua ví momo:
71+
![Donate by momo](https://tuyenvm.github.io/images/momo.png "Momo").
7072
Cảm ơn các bạn.

version.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"latestVersion": {
3-
"versionName": "1.6.2",
4-
"versionCode": 40
3+
"versionName": "1.6.5",
4+
"versionCode": 41
55
},
66
"latestWinVersion": {
77
"versionName": "1.6.2",

0 commit comments

Comments
 (0)