diff --git a/smallvil/src/input.rs b/smallvil/src/input.rs index 0531c29ba4ea..a8775c578072 100644 --- a/smallvil/src/input.rs +++ b/smallvil/src/input.rs @@ -41,7 +41,7 @@ impl Smallvil { let pointer = self.seat.get_pointer().unwrap(); - let under = self.surface_under_pointer(&pointer); + let under = self.surface_under(pos); pointer.motion( self, @@ -98,10 +98,10 @@ impl Smallvil { let horizontal_amount = event .amount(Axis::Horizontal) - .unwrap_or_else(|| event.amount_discrete(Axis::Horizontal).unwrap() * 3.0); + .unwrap_or_else(|| event.amount_discrete(Axis::Horizontal).unwrap_or(0.0) * 3.0); let vertical_amount = event .amount(Axis::Vertical) - .unwrap_or_else(|| event.amount_discrete(Axis::Vertical).unwrap() * 3.0); + .unwrap_or_else(|| event.amount_discrete(Axis::Vertical).unwrap_or(0.0) * 3.0); let horizontal_amount_discrete = event.amount_discrete(Axis::Horizontal); let vertical_amount_discrete = event.amount_discrete(Axis::Vertical); diff --git a/smallvil/src/state.rs b/smallvil/src/state.rs index a0405b77bb36..b1fd312ef1a0 100644 --- a/smallvil/src/state.rs +++ b/smallvil/src/state.rs @@ -2,7 +2,7 @@ use std::{ffi::OsString, os::unix::io::AsRawFd, sync::Arc}; use smithay::{ desktop::{Space, Window, WindowSurfaceType}, - input::{pointer::PointerHandle, Seat, SeatState}, + input::{Seat, SeatState}, reexports::{ calloop::{generic::Generic, EventLoop, Interest, LoopSignal, Mode, PostAction}, wayland_server::{ @@ -61,7 +61,7 @@ impl Smallvil { // Notify clients that we have a keyboard, for the sake of the example we assume that keyboard is always present. // You may want to track keyboard hot-plug in real compositor. - seat.add_keyboard(Default::default(), 200, 200).unwrap(); + seat.add_keyboard(Default::default(), 200, 25).unwrap(); // Notify clients that we have a pointer (mouse) // Here we assume that there is always pointer plugged in @@ -140,11 +140,7 @@ impl Smallvil { socket_name } - pub fn surface_under_pointer( - &self, - pointer: &PointerHandle, - ) -> Option<(WlSurface, Point)> { - let pos = pointer.current_location(); + pub fn surface_under(&self, pos: Point) -> Option<(WlSurface, Point)> { self.space.element_under(pos).and_then(|(window, location)| { window .surface_under(pos - location.to_f64(), WindowSurfaceType::ALL) diff --git a/smallvil/src/winit.rs b/smallvil/src/winit.rs index 6b1b04ae812d..0a453084e873 100644 --- a/smallvil/src/winit.rs +++ b/smallvil/src/winit.rs @@ -50,19 +50,9 @@ pub fn init_winit( std::env::set_var("WAYLAND_DISPLAY", &state.socket_name); - let mut full_redraw = 0u8; - let timer = Timer::immediate(); event_loop.handle().insert_source(timer, move |_, _, data| { - winit_dispatch( - &mut backend, - &mut winit, - data, - &output, - &mut damage_tracker, - &mut full_redraw, - ) - .unwrap(); + winit_dispatch(&mut backend, &mut winit, data, &output, &mut damage_tracker).unwrap(); TimeoutAction::ToDuration(Duration::from_millis(16)) })?; @@ -75,7 +65,6 @@ pub fn winit_dispatch( data: &mut CalloopData, output: &Output, damage_tracker: &mut OutputDamageTracker, - full_redraw: &mut u8, ) -> Result<(), Box> { let display = &mut data.display; let state = &mut data.state; @@ -105,8 +94,6 @@ pub fn winit_dispatch( res?; } - *full_redraw = full_redraw.saturating_sub(1); - let size = backend.window_size().physical_size; let damage = Rectangle::from_loc_and_size((0, 0), size);