Skip to content

Commit

Permalink
Better minimize handling on Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
casperstorm committed Feb 10, 2025
1 parent 3b05681 commit b0510ae
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions src/window.rs
Original file line number Diff line number Diff line change
Expand Up @@ -183,23 +183,26 @@ impl subscription::Recipe for Events {
status: _,
} => match window_event {
iced::window::Event::Moved(point) => {
if elapsed >= INITIAL_SKIP_THRESHOLD {
let clamped_x = point.x.max(0.0);
let clamped_y = point.y.max(0.0);
let point_is_positive =
point.x.is_sign_positive() && point.y.is_sign_positive();

if point_is_positive && elapsed >= INITIAL_SKIP_THRESHOLD {
Some((
id,
Event::Moved(Point {
x: clamped_x,
y: clamped_y,
x: point.x.max(0.0),
y: point.y.max(0.0),
}),
))
} else {
None
}
}
iced::window::Event::Resized(size) => {
if elapsed >= INITIAL_SKIP_THRESHOLD {
let is_bigger_than_min_allowed =
size.width >= MIN_SIZE.width && size.height >= MIN_SIZE.height;

if is_bigger_than_min_allowed && elapsed >= INITIAL_SKIP_THRESHOLD {
Some((id, Event::Resized(size.max(MIN_SIZE))))
} else {
None
Expand Down

0 comments on commit b0510ae

Please sign in to comment.