Skip to content

Commit 53d2cf0

Browse files
committed
floating/resize: Fix broken global geometry
1 parent 3952887 commit 53d2cf0

File tree

2 files changed

+9
-16
lines changed

2 files changed

+9
-16
lines changed

src/shell/layout/floating/grabs/resize.rs

Lines changed: 8 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ use smithay::{
2828
},
2929
Seat,
3030
},
31+
output::Output,
3132
utils::{IsAlive, Logical, Point, Rectangle, Serial, Size},
3233
};
3334

@@ -56,6 +57,7 @@ pub struct ResizeSurfaceGrab {
5657
seat: Seat<State>,
5758
window: CosmicMapped,
5859
edges: ResizeEdge,
60+
output: Output,
5961
initial_window_size: Size<i32, Logical>,
6062
last_window_size: Size<i32, Logical>,
6163
release: ReleaseMode,
@@ -111,15 +113,11 @@ impl ResizeSurfaceGrab {
111113

112114
self.last_window_size = (new_window_width, new_window_height).into();
113115

116+
let mut win_loc = location.as_local().to_global(&self.output).to_i32_round();
117+
win_loc.y += self.window.ssd_height(false).unwrap_or(0);
114118
self.window.set_resizing(true);
115-
self.window.set_geometry(Rectangle::new(
116-
if let Some(s) = self.window.active_window().x11_surface() {
117-
s.geometry().loc.as_global()
118-
} else {
119-
(0, 0).into()
120-
},
121-
self.last_window_size.as_global(),
122-
));
119+
self.window
120+
.set_geometry(Rectangle::new(win_loc, self.last_window_size.as_global()));
123121
if self.window.latest_size_committed() {
124122
self.window.configure();
125123
}
@@ -376,6 +374,7 @@ impl ResizeSurfaceGrab {
376374
start_data: GrabStartData,
377375
mapped: CosmicMapped,
378376
edges: ResizeEdge,
377+
output: Output,
379378
initial_window_location: Point<i32, Local>,
380379
initial_window_size: Size<i32, Logical>,
381380
seat: &Seat<State>,
@@ -414,6 +413,7 @@ impl ResizeSurfaceGrab {
414413
seat: seat.clone(),
415414
window: mapped,
416415
edges,
416+
output,
417417
initial_window_size,
418418
last_window_size: initial_window_size,
419419
release,
@@ -525,14 +525,6 @@ impl ResizeSurfaceGrab {
525525
}
526526

527527
self.window.set_resizing(false);
528-
self.window.set_geometry(Rectangle::new(
529-
if let Some(x11_surface) = self.window.active_window().x11_surface() {
530-
x11_surface.geometry().loc.as_global()
531-
} else {
532-
(0, 0).into()
533-
},
534-
self.last_window_size.as_global(),
535-
));
536528
self.window.configure();
537529

538530
let mut resize_state = self.window.resize_state.lock().unwrap();

src/shell/layout/floating/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -899,6 +899,7 @@ impl FloatingLayout {
899899
start_data,
900900
mapped.clone(),
901901
edges,
902+
self.space.outputs().next().cloned().unwrap(),
902903
location,
903904
size,
904905
seat,

0 commit comments

Comments
 (0)