From 536203ee554f2caf696ef1801c0f4f10c8605c34 Mon Sep 17 00:00:00 2001 From: Ferdinand Schober Date: Fri, 5 Jan 2024 17:31:30 +0100 Subject: [PATCH] ignore every event except Enter in receiving mode --- src/event.rs | 6 +++--- src/server.rs | 5 +++++ 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/event.rs b/src/event.rs index 44a2bb92..2de64f78 100644 --- a/src/event.rs +++ b/src/event.rs @@ -11,7 +11,7 @@ pub const BTN_MIDDLE: u32 = 0x112; pub const BTN_BACK: u32 = 0x113; pub const BTN_FORWARD: u32 = 0x114; -#[derive(Debug, Clone, Copy)] +#[derive(Debug, PartialEq, Clone, Copy)] pub enum PointerEvent { Motion { time: u32, @@ -31,7 +31,7 @@ pub enum PointerEvent { Frame {}, } -#[derive(Debug, Clone, Copy)] +#[derive(Debug, PartialEq, Clone, Copy)] pub enum KeyboardEvent { Key { time: u32, @@ -46,7 +46,7 @@ pub enum KeyboardEvent { }, } -#[derive(Debug, Clone, Copy)] +#[derive(PartialEq, Debug, Clone, Copy)] pub enum Event { /// pointer event (motion / button / axis) Pointer(PointerEvent), diff --git a/src/server.rs b/src/server.rs index b62275f8..2b2270b0 100644 --- a/src/server.rs +++ b/src/server.rs @@ -824,6 +824,11 @@ impl Server { start_timer = true; log::trace!("STATE ===> AwaitingLeave"); enter = true; + } else { + // ignore any potential events in receiving mode + if self.state.get() == State::Receiving && e != Event::Disconnect() { + return Ok(()); + } } (client_state.active_addr, enter, start_timer)