Only update serial on PtrEvent::Enter/Button when seat is already presented (#8)
Fixes primary selection storing, when mouse button was pressed inside surface and then released outside.
This commit is contained in:
parent
b2b0e4099d
commit
705939b3bf
2 changed files with 23 additions and 3 deletions
|
|
@ -2,6 +2,8 @@
|
||||||
|
|
||||||
## Unreleased
|
## Unreleased
|
||||||
|
|
||||||
|
- Fix primary selection storing, when releasing button outside of the surface
|
||||||
|
|
||||||
## 0.3.4 -- 2019-08-14
|
## 0.3.4 -- 2019-08-14
|
||||||
|
|
||||||
- Add fallback to gtk primary selection, when zwp primary selection is not available
|
- Add fallback to gtk primary selection, when zwp primary selection is not available
|
||||||
|
|
|
||||||
|
|
@ -665,6 +665,16 @@ fn implement_seat(
|
||||||
// Get serials from recieved events from the seat pointer
|
// Get serials from recieved events from the seat pointer
|
||||||
match evt {
|
match evt {
|
||||||
PtrEvent::Enter { serial, .. } => {
|
PtrEvent::Enter { serial, .. } => {
|
||||||
|
if let Some(seat) = seat_map
|
||||||
|
.lock()
|
||||||
|
.unwrap()
|
||||||
|
.get_mut(&seat_name.lock().unwrap().clone())
|
||||||
|
{
|
||||||
|
// Update serial if "seat" is already presented
|
||||||
|
seat.1 = serial;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
seat_map.lock().unwrap().insert(
|
seat_map.lock().unwrap().insert(
|
||||||
seat_name.lock().unwrap().clone(),
|
seat_name.lock().unwrap().clone(),
|
||||||
(
|
(
|
||||||
|
|
@ -678,6 +688,17 @@ fn implement_seat(
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
PtrEvent::Button { serial, .. } => {
|
PtrEvent::Button { serial, .. } => {
|
||||||
|
if let Some(seat) = seat_map
|
||||||
|
.lock()
|
||||||
|
.unwrap()
|
||||||
|
.get_mut(&seat_name.lock().unwrap().clone())
|
||||||
|
{
|
||||||
|
// Update serial if seat is already presented
|
||||||
|
seat.1 = serial;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// This is for consistency with `PtrEvent::Enter`
|
||||||
seat_map.lock().unwrap().insert(
|
seat_map.lock().unwrap().insert(
|
||||||
seat_name.lock().unwrap().clone(),
|
seat_name.lock().unwrap().clone(),
|
||||||
(
|
(
|
||||||
|
|
@ -690,9 +711,6 @@ fn implement_seat(
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
PtrEvent::Leave { .. } => {
|
|
||||||
seat_map.lock().unwrap().remove(&*seat_name.lock().unwrap());
|
|
||||||
}
|
|
||||||
_ => {}
|
_ => {}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue