mac/dialog: release all input keys when modal steals key input
modal dialogs steal the key/mouse input and possibly eat corresponding key up events when opening via key binding. this leads to key sequence ends to not reported and key bindings not being triggered if no key up event was triggered after closing the modal.
This commit is contained in:
1 parent
209521ff7c
commit
76e3e8ae45
1 file changed
+6
-1
@@ -18,7 +18,7 @@
|
||||
import Cocoa
|
||||
import UniformTypeIdentifiers
|
||||
|
||||
class Dialog {
|
||||
class Dialog: NSObject, NSWindowDelegate, NSOpenSavePanelDelegate {
|
||||
var option: OptionHelper?
|
||||
|
||||
init(_ option: OptionHelper? = nil) {
|
||||
@@ -48,6 +48,7 @@ class Dialog {
|
||||
panel.canChooseDirectories = directories
|
||||
panel.allowsMultipleSelection = multiple
|
||||
panel.allowedContentTypes = types
|
||||
panel.delegate = self
|
||||
|
||||
if panel.runModal() == .OK {
|
||||
return panel.urls.map { $0.path }
|
||||
@@ -83,4 +84,8 @@ class Dialog {
|
||||
alert.addButton(withTitle: "Ok")
|
||||
alert.runModal()
|
||||
}
|
||||
|
||||
func windowDidBecomeKey(_ notification: Notification) {
|
||||
AppHub.shared.input.put(key: MP_INPUT_RELEASE_ALL)
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user