From 33eedb0b582096d82c2359a5b4fffef0a65115b6 Mon Sep 17 00:00:00 2001 From: Victoria Brekenfeld Date: Wed, 19 Apr 2023 11:42:46 +0200 Subject: [PATCH] shell: Fix repeated window grabs --- src/shell/layout/floating/grabs/moving.rs | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/src/shell/layout/floating/grabs/moving.rs b/src/shell/layout/floating/grabs/moving.rs index 7c1d3839..5b0bea54 100644 --- a/src/shell/layout/floating/grabs/moving.rs +++ b/src/shell/layout/floating/grabs/moving.rs @@ -222,7 +222,7 @@ impl MoveSurfaceGrab { // No more buttons are pressed, release the grab. let output = self.seat.active_output(); - if let Some(grab_state) = self + let offset = if let Some(grab_state) = self .seat .user_data() .get::() @@ -266,11 +266,27 @@ impl MoveSurfaceGrab { .active_space_mut(&output) .floating_layer .map_internal(grab_state.window, &output, Some(window_location + offset)); + Some(grab_state.window_offset) + } else { + None } - } + } else { + None + }; handle.unset_grab(state, serial, time); if self.window.alive() { + if let Some(offset) = offset { + handle.motion( + state, + Some((PointerFocusTarget::from(self.window.clone()), offset)), + &MotionEvent { + location: handle.current_location(), + serial: serial, + time: time, + }, + ); + } Common::set_focus( state, Some(&KeyboardFocusTarget::from(self.window.clone())),