Provide HotkeyState on Global Shortcut Events (#3822)
* Only react to hotkeys that are pressed The global shortcuts are otherwise also triggering when the hotkey is being released. This affects at least Windows. * Provide `HotkeyState` on Global Shortcut Events Instead of ignoring the events where the shortcut is released, the state is now provided as an argument to the event handler.
This commit is contained in:
1 parent
e0ecf0eb49
commit
3da821d184
7 files changed
+34
-15
No files matched your search
@@ -4,7 +4,7 @@ use crate::{
|
||||
file_upload::NativeFileHover,
|
||||
ipc::UserWindowEvent,
|
||||
query::QueryEngine,
|
||||
shortcut::{HotKey, ShortcutHandle, ShortcutRegistryError},
|
||||
shortcut::{HotKey, HotKeyState, ShortcutHandle, ShortcutRegistryError},
|
||||
webview::WebviewInstance,
|
||||
AssetRequest, Config, WryEventHandler,
|
||||
};
|
||||
@@ -214,7 +214,7 @@ impl DesktopService {
|
||||
pub fn create_shortcut(
|
||||
&self,
|
||||
hotkey: HotKey,
|
||||
callback: impl FnMut() + 'static,
|
||||
callback: impl FnMut(HotKeyState) + 'static,
|
||||
) -> Result<ShortcutHandle, ShortcutRegistryError> {
|
||||
self.shared
|
||||
.shortcut_manager
|
||||
|
||||
Reference in new issue
Block a user