Extract tablet_seat and desc variables
Browse files at this commit475d6e4be177b74c23ba225d7cdf6ec30826a374Parent: d9e27981 changed file +6 -5
- src/input.rs +6 -5
src/input.rsmodified+6 -5
| @@ -119,10 +119,10 @@ impl State { | |||
| 119 | 119 | ||
| 120 | fn on_device_added(&mut self, device: impl Device) { | 120 | fn on_device_added(&mut self, device: impl Device) { |
| 121 | if device.has_capability(DeviceCapability::TabletTool) { | 121 | if device.has_capability(DeviceCapability::TabletTool) { |
| 122 | - self.niri | 122 | + let tablet_seat = self.niri.seat.tablet_seat(); |
| 123 | - .seat | 123 | + |
| 124 | - .tablet_seat() | 124 | + let desc = TabletDescriptor::from(&device); |
| 125 | - .add_tablet::<Self>(&self.niri.display_handle, &TabletDescriptor::from(&device)); | 125 | + tablet_seat.add_tablet::<Self>(&self.niri.display_handle, &desc); |
| 126 | } | 126 | } |
| 127 | } | 127 | } |
| 128 | 128 | ||
| @@ -130,7 +130,8 @@ impl State { | |||
| 130 | if device.has_capability(DeviceCapability::TabletTool) { | 130 | if device.has_capability(DeviceCapability::TabletTool) { |
| 131 | let tablet_seat = self.niri.seat.tablet_seat(); | 131 | let tablet_seat = self.niri.seat.tablet_seat(); |
| 132 | 132 | ||
| 133 | - tablet_seat.remove_tablet(&TabletDescriptor::from(&device)); | 133 | + let desc = TabletDescriptor::from(&device); |
| 134 | + tablet_seat.remove_tablet(&desc); | ||
| 134 | 135 | ||
| 135 | // If there are no tablets in seat we can remove all tools | 136 | // If there are no tablets in seat we can remove all tools |
| 136 | if tablet_seat.count_tablets() == 0 { | 137 | if tablet_seat.count_tablets() == 0 { |