From 475d6e4be177b74c23ba225d7cdf6ec30826a374 Mon Sep 17 00:00:00 2001 From: Ivan Molodetskikh Date: Sat, 9 Dec 2023 09:28:41 +0400 Subject: Extract tablet_seat and desc variables --- src/input.rs | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/input.rs b/src/input.rs index 3b7e4dab..292d08bc 100644 --- a/src/input.rs +++ b/src/input.rs @@ -119,10 +119,10 @@ impl State { fn on_device_added(&mut self, device: impl Device) { if device.has_capability(DeviceCapability::TabletTool) { - self.niri - .seat - .tablet_seat() - .add_tablet::(&self.niri.display_handle, &TabletDescriptor::from(&device)); + let tablet_seat = self.niri.seat.tablet_seat(); + + let desc = TabletDescriptor::from(&device); + tablet_seat.add_tablet::(&self.niri.display_handle, &desc); } } @@ -130,7 +130,8 @@ impl State { if device.has_capability(DeviceCapability::TabletTool) { let tablet_seat = self.niri.seat.tablet_seat(); - tablet_seat.remove_tablet(&TabletDescriptor::from(&device)); + let desc = TabletDescriptor::from(&device); + tablet_seat.remove_tablet(&desc); // If there are no tablets in seat we can remove all tools if tablet_seat.count_tablets() == 0 { -- cgit