mirror of
https://github.com/feschber/lan-mouse.git
synced 2026-03-18 18:50:56 +03:00
enforce only one client at a position (#102)
This commit is contained in:
committed by
GitHub
parent
cc7984c066
commit
9ca7e2378c
@@ -178,6 +178,19 @@ impl ClientManager {
|
||||
.map(|p| p as ClientHandle)
|
||||
}
|
||||
|
||||
pub fn find_client(&self, pos: Position) -> Option<ClientHandle> {
|
||||
self.clients
|
||||
.iter()
|
||||
.position(|c| {
|
||||
if let Some(c) = c {
|
||||
c.active && c.client.pos == pos
|
||||
} else {
|
||||
false
|
||||
}
|
||||
})
|
||||
.map(|p| p as ClientHandle)
|
||||
}
|
||||
|
||||
/// remove a client from the list
|
||||
pub fn remove_client(&mut self, client: ClientHandle) -> Option<ClientState> {
|
||||
// remove id from occupied ids
|
||||
|
||||
Reference in New Issue
Block a user