seat: only set click grab on pressed
if we set the clickgrab unconditionally
and a previous grab was active the button
event could be a relaese. This will result
in a wrong clickgrab state as the click grab
is only unset on the next release
use std::fmt;
-use wayland_server::{protocol::wl_surface::WlSurface, DisplayHandle};
+use wayland_server::{
+ protocol::{wl_pointer::ButtonState, wl_surface::WlSurface},
+ DisplayHandle,
+};
use crate::{
utils::{Logical, Point},
@@ -128,6 +131,7 @@ impl<D> PointerGrab<D> for DefaultGrab {
event: &ButtonEvent,
) {
handle.button(event.button, event.state, event.serial, event.time);
+ if event.state == ButtonState::Pressed {
handle.set_grab(
event.serial,
event.time,
@@ -140,6 +144,7 @@ impl<D> PointerGrab<D> for DefaultGrab {
},
);
}
+ }
fn axis(
&mut self,
