pointer absolute events for anvil udev mode.
allows mouse to work in qemu when running anvil in --tty-udev mode
@@ -532,6 +532,7 @@ impl AnvilState<UdevData> {
},
},
InputEvent::PointerMotion { event, .. } => self.on_pointer_move::<B>(dh, event),
+ InputEvent::PointerMotionAbsolute { event, .. } => self.on_pointer_move_absolute::<B>(dh, event),
InputEvent::PointerButton { event, .. } => self.on_pointer_button::<B>(dh, event),
InputEvent::PointerAxis { event, .. } => self.on_pointer_axis::<B>(dh, event),
InputEvent::TabletToolAxis { event, .. } => self.on_tablet_tool_axis::<B>(event),
@@ -586,6 +587,47 @@ impl AnvilState<UdevData> {
}
}
+ fn on_pointer_move_absolute<B: InputBackend>(
+ &mut self,
+ dh: &DisplayHandle,
+ evt: B::PointerMotionAbsoluteEvent,
+ ) {
+ let serial = SCOUNTER.next_serial();
+
+ let max_x = self
+ .space
+ .outputs()
+ .fold(0, |acc, o| acc + self.space.output_geometry(o).unwrap().size.w);
+
+ let max_h_output = self
+ .space
+ .outputs()
+ .max_by_key(|o| self.space.output_geometry(o).unwrap().size.h)
+ .unwrap();
+
+ let max_y = self.space.output_geometry(max_h_output).unwrap().size.h;
+
+ self.pointer_location.x = evt.x_transformed(max_x);
+ self.pointer_location.y = evt.y_transformed(max_y);
+
+ // clamp to screen limits
+ self.pointer_location = self.clamp_coords(self.pointer_location);
+
+ let under = self.surface_under();
+ if let Some(ptr) = self.seat.get_pointer() {
+ ptr.motion(
+ self,
+ dh,
+ &MotionEvent {
+ location: self.pointer_location,
+ focus: under,
+ serial,
+ time: evt.time(),
+ },
+ );
+ }
+ }
+
fn on_tablet_tool_axis<B: InputBackend>(&mut self, evt: B::TabletToolAxisEvent) {
let tablet_seat = self.seat.tablet_seat();
