From 76e3e8ae45ed0a3aa85d1c57a57b1013f1d02417 Mon Sep 17 00:00:00 2001 From: der richter Date: Sun, 16 Feb 2025 16:39:49 +0100 Subject: [PATCH] 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. --- osdep/mac/dialog.swift | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/osdep/mac/dialog.swift b/osdep/mac/dialog.swift index 6f8b6b01fd..2223ba6a8b 100644 --- a/osdep/mac/dialog.swift +++ b/osdep/mac/dialog.swift @@ -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) + } }