Skip to content

Commit

Permalink
Update moving.rs
Browse files Browse the repository at this point in the history
  • Loading branch information
Koranir authored and Drakulix committed Feb 14, 2025
1 parent 2553810 commit 2bf7495
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions src/shell/grabs/moving.rs
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,7 @@ pub struct MoveGrab {
window_outputs: HashSet<Output>,
previous: ManagedLayer,
release: ReleaseMode,
window_snap_threshold: f64,
edge_snap_threshold: f64,
// SAFETY: This is only used on drop which will always be on the main thread
evlh: NotSend<LoopHandle<'static, State>>,
}
Expand Down Expand Up @@ -396,21 +396,19 @@ impl MoveGrab {
let output_loc = output_geom.loc;
let output_size = output_geom.size;

grab_state.location.x = if (loc.x - output_loc.x).abs() < self.window_snap_threshold
{
grab_state.location.x = if (loc.x - output_loc.x).abs() < self.edge_snap_threshold {
output_loc.x - grab_state.window_offset.x as f64
} else if ((loc.x + size.w) - (output_loc.x + output_size.w)).abs()
< self.window_snap_threshold
< self.edge_snap_threshold
{
output_loc.x + output_size.w - grab_state.window_offset.x as f64 - size.w
} else {
grab_state.location.x
};
grab_state.location.y = if (loc.y - output_loc.y).abs() < self.window_snap_threshold
{
grab_state.location.y = if (loc.y - output_loc.y).abs() < self.edge_snap_threshold {
output_loc.y - grab_state.window_offset.y as f64
} else if ((loc.y + size.h) - (output_loc.y + output_size.h)).abs()
< self.window_snap_threshold
< self.edge_snap_threshold
{
output_loc.y + output_size.h - grab_state.window_offset.y as f64 - size.h
} else {
Expand Down Expand Up @@ -716,7 +714,7 @@ impl MoveGrab {
initial_window_location: Point<i32, Global>,
cursor_output: Output,
indicator_thickness: u8,
window_snap_threshold: f64,
edge_snap_threshold: f64,
previous_layer: ManagedLayer,
release: ReleaseMode,
evlh: LoopHandle<'static, State>,
Expand Down Expand Up @@ -760,7 +758,7 @@ impl MoveGrab {
window_outputs: outputs,
previous: previous_layer,
release,
window_snap_threshold,
edge_snap_threshold,
evlh: NotSend(evlh),
}
}
Expand Down

0 comments on commit 2bf7495

Please sign in to comment.