From 53d2cf01aa6578c550363c0da4cf1df941508424 Mon Sep 17 00:00:00 2001 From: Victoria Brekenfeld Date: Thu, 16 Jan 2025 16:24:19 +0100 Subject: [PATCH] floating/resize: Fix broken global geometry --- src/shell/layout/floating/grabs/resize.rs | 24 ++++++++--------------- src/shell/layout/floating/mod.rs | 1 + 2 files changed, 9 insertions(+), 16 deletions(-) diff --git a/src/shell/layout/floating/grabs/resize.rs b/src/shell/layout/floating/grabs/resize.rs index edc39414..9e2a0dd9 100644 --- a/src/shell/layout/floating/grabs/resize.rs +++ b/src/shell/layout/floating/grabs/resize.rs @@ -28,6 +28,7 @@ use smithay::{ }, Seat, }, + output::Output, utils::{IsAlive, Logical, Point, Rectangle, Serial, Size}, }; @@ -56,6 +57,7 @@ pub struct ResizeSurfaceGrab { seat: Seat, window: CosmicMapped, edges: ResizeEdge, + output: Output, initial_window_size: Size, last_window_size: Size, release: ReleaseMode, @@ -111,15 +113,11 @@ impl ResizeSurfaceGrab { self.last_window_size = (new_window_width, new_window_height).into(); + let mut win_loc = location.as_local().to_global(&self.output).to_i32_round(); + win_loc.y += self.window.ssd_height(false).unwrap_or(0); self.window.set_resizing(true); - self.window.set_geometry(Rectangle::new( - if let Some(s) = self.window.active_window().x11_surface() { - s.geometry().loc.as_global() - } else { - (0, 0).into() - }, - self.last_window_size.as_global(), - )); + self.window + .set_geometry(Rectangle::new(win_loc, self.last_window_size.as_global())); if self.window.latest_size_committed() { self.window.configure(); } @@ -376,6 +374,7 @@ impl ResizeSurfaceGrab { start_data: GrabStartData, mapped: CosmicMapped, edges: ResizeEdge, + output: Output, initial_window_location: Point, initial_window_size: Size, seat: &Seat, @@ -414,6 +413,7 @@ impl ResizeSurfaceGrab { seat: seat.clone(), window: mapped, edges, + output, initial_window_size, last_window_size: initial_window_size, release, @@ -525,14 +525,6 @@ impl ResizeSurfaceGrab { } self.window.set_resizing(false); - self.window.set_geometry(Rectangle::new( - if let Some(x11_surface) = self.window.active_window().x11_surface() { - x11_surface.geometry().loc.as_global() - } else { - (0, 0).into() - }, - self.last_window_size.as_global(), - )); self.window.configure(); let mut resize_state = self.window.resize_state.lock().unwrap(); diff --git a/src/shell/layout/floating/mod.rs b/src/shell/layout/floating/mod.rs index 5c96d6ff..21175a1f 100644 --- a/src/shell/layout/floating/mod.rs +++ b/src/shell/layout/floating/mod.rs @@ -899,6 +899,7 @@ impl FloatingLayout { start_data, mapped.clone(), edges, + self.space.outputs().next().cloned().unwrap(), location, size, seat,