Merge pull request #40 from pop-os/window-drag_jammy
Fix position window is rendered during drag with multiple outputs
This commit is contained in:
commit
6c66137c8c
1 changed files with 13 additions and 11 deletions
|
|
@ -57,7 +57,7 @@ impl Shell {
|
||||||
};
|
};
|
||||||
let mut initial_window_location = workspace.space.window_location(&window).unwrap();
|
let mut initial_window_location = workspace.space.window_location(&window).unwrap();
|
||||||
|
|
||||||
let output = match &window.toplevel() {
|
match &window.toplevel() {
|
||||||
Kind::Xdg(surface) => {
|
Kind::Xdg(surface) => {
|
||||||
// If surface is maximized then unmaximize it
|
// If surface is maximized then unmaximize it
|
||||||
let current_state = surface.current_state();
|
let current_state = surface.current_state();
|
||||||
|
|
@ -73,8 +73,6 @@ impl Shell {
|
||||||
.unwrap_or_else(|| pos)
|
.unwrap_or_else(|| pos)
|
||||||
.to_i32_round();
|
.to_i32_round();
|
||||||
}
|
}
|
||||||
|
|
||||||
output
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -117,6 +115,7 @@ impl Shell {
|
||||||
was_tiled,
|
was_tiled,
|
||||||
initial_cursor_location: pointer.current_location(),
|
initial_cursor_location: pointer.current_location(),
|
||||||
initial_window_location,
|
initial_window_location,
|
||||||
|
initial_output_location: output.geometry().loc,
|
||||||
};
|
};
|
||||||
let grab = MoveSurfaceGrab::new(start_data, window.clone(), seat);
|
let grab = MoveSurfaceGrab::new(start_data, window.clone(), seat);
|
||||||
|
|
||||||
|
|
@ -142,8 +141,11 @@ impl Shell {
|
||||||
|
|
||||||
if window.alive() {
|
if window.alive() {
|
||||||
let delta = pointer.current_location() - move_state.initial_cursor_location;
|
let delta = pointer.current_location() - move_state.initial_cursor_location;
|
||||||
let window_location =
|
let window_location = (move_state.initial_window_location.to_f64()
|
||||||
(move_state.initial_window_location.to_f64() + delta).to_i32_round();
|
+ move_state.initial_output_location.to_f64()
|
||||||
|
- output.geometry().loc.to_f64()
|
||||||
|
+ delta)
|
||||||
|
.to_i32_round();
|
||||||
let surface = window.toplevel().wl_surface().clone();
|
let surface = window.toplevel().wl_surface().clone();
|
||||||
|
|
||||||
let workspace_handle = state.common.shell.active_space(output).handle;
|
let workspace_handle = state.common.shell.active_space(output).handle;
|
||||||
|
|
@ -199,6 +201,7 @@ pub struct MoveGrabState {
|
||||||
was_tiled: bool,
|
was_tiled: bool,
|
||||||
initial_cursor_location: Point<f64, Logical>,
|
initial_cursor_location: Point<f64, Logical>,
|
||||||
initial_window_location: Point<i32, Logical>,
|
initial_window_location: Point<i32, Logical>,
|
||||||
|
initial_output_location: Point<i32, Logical>,
|
||||||
}
|
}
|
||||||
|
|
||||||
pub struct MoveGrabRenderElement {
|
pub struct MoveGrabRenderElement {
|
||||||
|
|
@ -268,20 +271,19 @@ impl MoveGrabState {
|
||||||
{
|
{
|
||||||
let cursor_at = seat.get_pointer().unwrap().current_location();
|
let cursor_at = seat.get_pointer().unwrap().current_location();
|
||||||
let delta = cursor_at - self.initial_cursor_location;
|
let delta = cursor_at - self.initial_cursor_location;
|
||||||
let mut window_geo = self.window.bbox();
|
let location =
|
||||||
window_geo.loc += (self.initial_window_location.to_f64() + delta).to_i32_round();
|
self.initial_output_location.to_f64() + self.initial_window_location.to_f64() + delta;
|
||||||
|
|
||||||
|
let mut window_geo = self.window.bbox();
|
||||||
|
window_geo.loc += location.to_i32_round();
|
||||||
if !output.geometry().intersection(window_geo).is_some() {
|
if !output.geometry().intersection(window_geo).is_some() {
|
||||||
return None;
|
return None;
|
||||||
}
|
}
|
||||||
|
|
||||||
let delta = cursor_at - self.initial_cursor_location;
|
|
||||||
let window_location =
|
|
||||||
self.initial_window_location.to_f64() + delta - output.geometry().loc.to_f64();
|
|
||||||
Some(I::from(MoveGrabRenderElement {
|
Some(I::from(MoveGrabRenderElement {
|
||||||
seat_id: seat.id(),
|
seat_id: seat.id(),
|
||||||
window: self.window.clone(),
|
window: self.window.clone(),
|
||||||
window_location,
|
window_location: location - output.geometry().loc.to_f64(),
|
||||||
}))
|
}))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue