Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 13 additions & 11 deletions src/platform_impl/windows/event_loop.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2299,17 +2299,19 @@ unsafe fn public_window_callback_inner(
};
}

unsafe {
SetWindowPos(
window,
0,
new_outer_rect.left,
new_outer_rect.top,
new_outer_rect.right - new_outer_rect.left,
new_outer_rect.bottom - new_outer_rect.top,
SWP_NOZORDER | SWP_NOACTIVATE,
)
};
if !userdata.window_state_lock().currently_repositioning {
unsafe {
SetWindowPos(
window,
0,
new_outer_rect.left,
new_outer_rect.top,
new_outer_rect.right - new_outer_rect.left,
new_outer_rect.bottom - new_outer_rect.top,
SWP_NOZORDER | SWP_NOACTIVATE,
)
};
}

result = ProcResult::Value(0);
},
Expand Down
2 changes: 2 additions & 0 deletions src/platform_impl/windows/window.rs
Original file line number Diff line number Diff line change
Expand Up @@ -823,6 +823,7 @@ impl Window {
let position: (i32, i32) = monitor.position().into();
let size: (u32, u32) = monitor.size().into();

window_state.lock().unwrap().currently_repositioning = true;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have a bunch of SetWindowPos calls, wouldn't it be the problem for all of them, if so we would need to probably wrap it, somehow.

Copy link
Member

@kchibisov kchibisov Aug 23, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Like, I wonder why fullscreen is special here, if maximize is probably the same, though, I'm not familiar with windows much? I'd assume that the point if you change position to other monitor?

unsafe {
SetWindowPos(
window,
Expand All @@ -835,6 +836,7 @@ impl Window {
);
InvalidateRgn(window, 0, false.into());
}
window_state.lock().unwrap().currently_repositioning = false;
},
None => {
let mut window_state_lock = window_state.lock().unwrap();
Expand Down
4 changes: 4 additions & 0 deletions src/platform_impl/windows/window_state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ pub(crate) struct WindowState {
pub dragging: bool,

pub skip_taskbar: bool,

pub currently_repositioning: bool
}

#[derive(Clone)]
Expand Down Expand Up @@ -176,6 +178,8 @@ impl WindowState {
dragging: false,

skip_taskbar: false,

currently_repositioning: false
}
}

Expand Down
Loading