fix: test TabletServer initialization on Enter

Previously, a `zwp_tablet_pad_v2` `Enter` event would attempt to
initialize the clientside tablet. Since initializing the clientside
tablet is the job of `zwp_tablet_seat_v2` `TabletAdded` event, it would
be already initialized, which triggers an `expect` in
`LateInitObjectKey::init`. To remedy this, the `Enter` event instead
checks for an initialized tablet before entering, and early returns
otherwise.
This commit is contained in:
En-En 2026-01-20 18:49:04 +00:00 committed by Supreeeme
parent ed1cef792b
commit 7af39ce419

View file

@ -1514,7 +1514,6 @@ impl Event for zwp_tablet_pad_v2::Event {
tablet,
surface,
} => {
let (e_tab, s_tablet) = from_client::<TabletServer, _, _>(&tablet, state);
let Some(surface) = surface
.data()
.copied()
@ -1522,10 +1521,16 @@ impl Event for zwp_tablet_pad_v2::Event {
else {
return;
};
let Some(s_tablet) =
tablet
.data()
.and_then(|key: &LateInitObjectKey<TabletClient>| {
state.world.get::<&TabletServer>(key.get()).ok()
})
else {
return;
};
pad.enter(serial, &s_tablet, &surface);
drop(pad);
drop(surface);
state.world.spawn_at(e_tab, (tablet, s_tablet));
}
_ => simple_event_shunt! {
pad, self => [