mirror of
https://github.com/feschber/lan-mouse.git
synced 2026-03-07 20:09:59 +03:00
Fix an issue where client could not be entered again (#51)
RELEASE_MODIFIERS are now handled server side. A client exited through CTRL+ALT+SHIFT+SUPER could sometimes not be entered again when the client did not send a Modifiers (0) event. Such a client would always respond with Modifiers (RELEASE_MODIFIERS) and immediately cause the sender to exit again. To prevent this, a modifier event with all modifiers released is now sent instead when the release modifiers are detected.
This commit is contained in:
committed by
GitHub
parent
735434438f
commit
eca367cdb4
@@ -753,10 +753,6 @@ impl Dispatch<wl_keyboard::WlKeyboard, ()> for State {
|
||||
}),
|
||||
));
|
||||
}
|
||||
if mods_depressed == 77 {
|
||||
// ctrl shift super alt
|
||||
app.ungrab();
|
||||
}
|
||||
}
|
||||
wl_keyboard::Event::Keymap {
|
||||
format: _,
|
||||
|
||||
@@ -22,7 +22,7 @@ use tokio::net::TcpStream;
|
||||
|
||||
use std::{io::ErrorKind, net::SocketAddr};
|
||||
|
||||
use crate::event::Event;
|
||||
use crate::event::{Event, KeyboardEvent};
|
||||
use crate::{
|
||||
client::{ClientEvent, ClientHandle, ClientManager, Position},
|
||||
config::Config,
|
||||
@@ -368,9 +368,21 @@ impl Server {
|
||||
}
|
||||
}
|
||||
|
||||
async fn handle_producer_event(&mut self, c: ClientHandle, e: Event) {
|
||||
const RELEASE_MODIFIERDS: u32 = 77; // ctrl+shift+super+alt
|
||||
|
||||
async fn handle_producer_event(&mut self, c: ClientHandle, mut e: Event) {
|
||||
log::trace!("producer: ({c}) {e:?}");
|
||||
|
||||
if let Event::Keyboard(crate::event::KeyboardEvent::Modifiers { mods_depressed, mods_latched: _, mods_locked: _, group: _ }) = e {
|
||||
if mods_depressed == Self::RELEASE_MODIFIERDS {
|
||||
self.producer.release();
|
||||
self.state = State::Receiving;
|
||||
// send an event to release all the modifiers
|
||||
e = Event::Keyboard(KeyboardEvent::Modifiers {
|
||||
mods_depressed: 0, mods_latched: 0, mods_locked: 0, group: 0 });
|
||||
}
|
||||
}
|
||||
|
||||
// get client state for handle
|
||||
let state = match self.client_manager.get_mut(c) {
|
||||
Some(state) => state,
|
||||
|
||||
Reference in New Issue
Block a user