Skip to content

Commit

Permalink
floating/resize: Fix broken global geometry
Browse files Browse the repository at this point in the history
  • Loading branch information
Drakulix committed Jan 16, 2025
1 parent 3952887 commit 53d2cf0
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 16 deletions.
24 changes: 8 additions & 16 deletions src/shell/layout/floating/grabs/resize.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ use smithay::{
},
Seat,
},
output::Output,
utils::{IsAlive, Logical, Point, Rectangle, Serial, Size},
};

Expand Down Expand Up @@ -56,6 +57,7 @@ pub struct ResizeSurfaceGrab {
seat: Seat<State>,
window: CosmicMapped,
edges: ResizeEdge,
output: Output,
initial_window_size: Size<i32, Logical>,
last_window_size: Size<i32, Logical>,
release: ReleaseMode,
Expand Down Expand Up @@ -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();
}
Expand Down Expand Up @@ -376,6 +374,7 @@ impl ResizeSurfaceGrab {
start_data: GrabStartData,
mapped: CosmicMapped,
edges: ResizeEdge,
output: Output,
initial_window_location: Point<i32, Local>,
initial_window_size: Size<i32, Logical>,
seat: &Seat<State>,
Expand Down Expand Up @@ -414,6 +413,7 @@ impl ResizeSurfaceGrab {
seat: seat.clone(),
window: mapped,
edges,
output,
initial_window_size,
last_window_size: initial_window_size,
release,
Expand Down Expand Up @@ -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();
Expand Down
1 change: 1 addition & 0 deletions src/shell/layout/floating/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -899,6 +899,7 @@ impl FloatingLayout {
start_data,
mapped.clone(),
edges,
self.space.outputs().next().cloned().unwrap(),
location,
size,
seat,
Expand Down

0 comments on commit 53d2cf0

Please sign in to comment.