Skip to content

Commit 9217205

Browse files
committed
all key/mouse in QUEUE since --server has GUI too (--tray)
1 parent 4f6ae08 commit 9217205

1 file changed

Lines changed: 4 additions & 8 deletions

File tree

src/server/input_service.rs

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -701,8 +701,8 @@ fn get_modifier_state(key: Key, en: &mut Enigo) -> bool {
701701

702702
pub fn handle_mouse(evt: &MouseEvent, conn: i32) {
703703
#[cfg(target_os = "macos")]
704-
if !is_server() {
705-
// having GUI, run main GUI thread, otherwise crash
704+
{
705+
// having GUI (--server has tray, it is GUI too), run main GUI thread, otherwise crash
706706
let evt = evt.clone();
707707
QUEUE.exec_async(move || handle_mouse_(&evt, conn));
708708
return;
@@ -716,7 +716,7 @@ pub fn handle_mouse(evt: &MouseEvent, conn: i32) {
716716
// to-do: merge handle_mouse and handle_pointer
717717
pub fn handle_pointer(evt: &PointerDeviceEvent, conn: i32) {
718718
#[cfg(target_os = "macos")]
719-
if !is_server() {
719+
{
720720
// having GUI, run main GUI thread, otherwise crash
721721
let evt = evt.clone();
722722
QUEUE.exec_async(move || handle_pointer_(&evt, conn));
@@ -1215,11 +1215,7 @@ fn reset_input() {
12151215

12161216
#[cfg(target_os = "macos")]
12171217
pub fn reset_input_ondisconn() {
1218-
if !is_server() {
1219-
QUEUE.exec_async(reset_input);
1220-
} else {
1221-
reset_input();
1222-
}
1218+
QUEUE.exec_async(reset_input);
12231219
}
12241220

12251221
fn sim_rdev_rawkey_position(code: KeyCode, keydown: bool) {

0 commit comments

Comments
 (0)