1
1
mirror of https://github.com/qvacua/vimr.git synced 2024-11-24 03:25:03 +03:00

Implement init from coder for application just to be safe

This commit is contained in:
Tae Won Ha 2017-06-14 23:45:33 +02:00
parent fcefde94d1
commit e3b9b361c7
No known key found for this signature in database
GPG Key ID: E40743465B5B8B44
2 changed files with 24 additions and 20 deletions

View File

@ -8,19 +8,21 @@ import Cocoa
class Application: NSApplication {
override init() {
// Do very early initializtion here
// disable default press and hold behavior (copied from MacVim)
CFPreferencesSetAppValue(
"ApplePressAndHoldEnabled" as NSString,
"NO" as NSString,
kCFPreferencesCurrentApplication
)
setPressAndHoldSetting()
super.init()
}
required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
setPressAndHoldSetting()
super.init(coder: coder)
}
}
fileprivate func setPressAndHoldSetting() {
// disable default press and hold behavior (copied from MacVim)
CFPreferencesSetAppValue(
"ApplePressAndHoldEnabled" as NSString,
"NO" as NSString,
kCFPreferencesCurrentApplication
)
}

View File

@ -12,23 +12,25 @@ let logger = FileLogger(as: "VimR",
class Application: NSApplication {
override init() {
// Do very early initializtion here
// disable default press and hold behavior (copied from MacVim)
CFPreferencesSetAppValue(
"ApplePressAndHoldEnabled" as NSString,
"NO" as NSString,
kCFPreferencesCurrentApplication
)
setPressAndHoldSetting()
super.init()
}
required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
setPressAndHoldSetting()
super.init(coder: coder)
}
@IBAction override func showHelp(_: Any?) {
NSWorkspace.shared().open(URL(string: "https://github.com/qvacua/vimr/wiki")!)
}
}
fileprivate func setPressAndHoldSetting() {
// disable default press and hold behavior (copied from MacVim)
CFPreferencesSetAppValue(
"ApplePressAndHoldEnabled" as NSString,
"NO" as NSString,
kCFPreferencesCurrentApplication
)
}