mirror of
https://github.com/rustdesk/rustdesk.git
synced 2026-05-09 15:48:09 +03:00
feat(keyboard): shortcuts, release keys before shortcut callback
Signed-off-by: fufesou <linlong1266@gmail.com>
This commit is contained in:
@@ -344,7 +344,7 @@ pub mod client {
|
|||||||
// `flutter::get_cur_session_id()` — the rdev grab loop is process-wide
|
// `flutter::get_cur_session_id()` — the rdev grab loop is process-wide
|
||||||
// and has no per-event session context to thread.
|
// and has no per-event session context to thread.
|
||||||
#[cfg(feature = "flutter")]
|
#[cfg(feature = "flutter")]
|
||||||
if crate::keyboard::shortcuts::try_dispatch(None, event) {
|
if crate::keyboard::shortcuts::try_dispatch(None, event, keyboard_mode) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -371,7 +371,7 @@ pub mod client {
|
|||||||
// through, so dispatch targets the exact tab the keystroke originated
|
// through, so dispatch targets the exact tab the keystroke originated
|
||||||
// from — no dependency on the global focus tracker.
|
// from — no dependency on the global focus tracker.
|
||||||
#[cfg(feature = "flutter")]
|
#[cfg(feature = "flutter")]
|
||||||
if crate::keyboard::shortcuts::try_dispatch(Some(&session_id), event) {
|
if crate::keyboard::shortcuts::try_dispatch(Some(&session_id), event, keyboard_mode) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#[cfg(not(feature = "flutter"))]
|
#[cfg(not(feature = "flutter"))]
|
||||||
|
|||||||
@@ -360,7 +360,11 @@ pub fn match_event(event: &rdev::Event) -> Option<String> {
|
|||||||
/// which Flutter session id the keystroke was meant for, so route to the
|
/// which Flutter session id the keystroke was meant for, so route to the
|
||||||
/// globally-current session via `flutter::get_cur_session_id()`.
|
/// globally-current session via `flutter::get_cur_session_id()`.
|
||||||
#[cfg(feature = "flutter")]
|
#[cfg(feature = "flutter")]
|
||||||
pub fn try_dispatch(session_id: Option<&hbb_common::SessionID>, event: &rdev::Event) -> bool {
|
pub fn try_dispatch(
|
||||||
|
session_id: Option<&hbb_common::SessionID>,
|
||||||
|
event: &rdev::Event,
|
||||||
|
keyboard_mode: &str,
|
||||||
|
) -> bool {
|
||||||
let Some(action_id) = match_event(event) else {
|
let Some(action_id) = match_event(event) else {
|
||||||
return false;
|
return false;
|
||||||
};
|
};
|
||||||
@@ -372,6 +376,7 @@ pub fn try_dispatch(session_id: Option<&hbb_common::SessionID>, event: &rdev::Ev
|
|||||||
&resolved
|
&resolved
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
crate::keyboard::release_remote_keys(keyboard_mode);
|
||||||
crate::flutter::push_session_event(sid, "shortcut_triggered", vec![("action", &action_id)]);
|
crate::flutter::push_session_event(sid, "shortcut_triggered", vec![("action", &action_id)]);
|
||||||
true
|
true
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user