ignore every event except Enter in receiving mode (#65)

Modifier or other key events are still sent by some compositors after leaving the window which causes them to be pressed on both devices.
Now an Enter event must be produced before any further events are sent out (except disconnect)
This commit is contained in:
Ferdinand Schober
2024-01-05 18:00:30 +01:00
committed by GitHub
parent eb366bcd34
commit fa15048ad8
2 changed files with 8 additions and 3 deletions

View File

@@ -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),

View File

@@ -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)