mirror of
https://github.com/storytold/winit.git
synced 2026-11-21 03:50:41 +01:00
W2: Wayland: destroy the seat text input only when the seat is removed
Port of rust-windowing/winit#4747 (merged on master). Originally "M15.1: preserve Wayland winit text input" in storytold/wordcraft#787 (same change as storytold/pdfcraft vendor/winit).
This commit is contained in:
1 parent
b357a33287
commit
13ca693b1e
1 file changed
+10
-5
@@ -158,10 +158,11 @@ impl SeatHandler for WinitState {
|
||||
},
|
||||
};
|
||||
|
||||
if let Some(text_input) = seat_state.text_input.take() {
|
||||
text_input.destroy();
|
||||
}
|
||||
|
||||
// WordCraft patch: the text input belongs to the seat, not to a capability, so it is
|
||||
// destroyed in `remove_seat` instead (rust-windowing/winit#4747). Destroying it here
|
||||
// whenever any capability went away (a touch screen or tablet unplugged, a remote-desktop
|
||||
// session ending) left the window without IME until restart: `new_capability` only
|
||||
// recreates it when a capability is added.
|
||||
match capability {
|
||||
SeatCapability::Touch => {
|
||||
if let Some(touch) = seat_state.touch.take() {
|
||||
@@ -214,7 +215,11 @@ impl SeatHandler for WinitState {
|
||||
_queue_handle: &QueueHandle<Self>,
|
||||
seat: WlSeat,
|
||||
) {
|
||||
let _ = self.seats.remove(&seat.id());
|
||||
if let Some(mut seat_state) = self.seats.remove(&seat.id()) {
|
||||
if let Some(text_input) = seat_state.text_input.take() {
|
||||
text_input.destroy();
|
||||
}
|
||||
}
|
||||
self.on_keyboard_destroy(&seat.id());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user