Pass new pointer location to pointer.motion()

This is correct, it was a bug in smallvil.
This commit is contained in:
Ivan Molodetskikh
2023-08-09 17:51:02 +04:00
parent ec1a888386
commit 1035f3e6cd
2 changed files with 4 additions and 6 deletions
+2 -2
View File
@@ -69,7 +69,7 @@ impl Niri {
pointer_location.x = pointer_location.x.clamp(0., output_geo.size.w as f64); pointer_location.x = pointer_location.x.clamp(0., output_geo.size.w as f64);
pointer_location.y = pointer_location.y.clamp(0., output_geo.size.h as f64); pointer_location.y = pointer_location.y.clamp(0., output_geo.size.h as f64);
let under = self.surface_under_pointer(&pointer); let under = self.surface_under(pointer_location);
pointer.motion( pointer.motion(
self, self,
under.clone(), under.clone(),
@@ -101,7 +101,7 @@ impl Niri {
let pointer = self.seat.get_pointer().unwrap(); let pointer = self.seat.get_pointer().unwrap();
let under = self.surface_under_pointer(&pointer); let under = self.surface_under(pos);
pointer.motion( pointer.motion(
self, self,
+2 -4
View File
@@ -5,7 +5,6 @@ use std::time::Duration;
use smithay::desktop::space::space_render_elements; use smithay::desktop::space::space_render_elements;
use smithay::desktop::{Space, Window, WindowSurfaceType}; use smithay::desktop::{Space, Window, WindowSurfaceType};
use smithay::input::keyboard::XkbConfig; use smithay::input::keyboard::XkbConfig;
use smithay::input::pointer::PointerHandle;
use smithay::input::{Seat, SeatState}; use smithay::input::{Seat, SeatState};
use smithay::output::Output; use smithay::output::Output;
use smithay::reexports::calloop::generic::Generic; use smithay::reexports::calloop::generic::Generic;
@@ -119,11 +118,10 @@ impl Niri {
} }
} }
pub fn surface_under_pointer( pub fn surface_under(
&self, &self,
pointer: &PointerHandle<Self>, pos: Point<f64, Logical>,
) -> Option<(WlSurface, Point<i32, Logical>)> { ) -> Option<(WlSurface, Point<i32, Logical>)> {
let pos = pointer.current_location();
self.space self.space
.element_under(pos) .element_under(pos)
.and_then(|(window, location)| { .and_then(|(window, location)| {