Skip to content

Commit b1d8ce2

Browse files
authored
Use i32 instead of u32 for position type in WindowEvent::Moved (#1502)
* Use i32 instead of u32 for position type in WindowEvent::Moved * Mark change as breaking
1 parent 098fd5d commit b1d8ce2

File tree

3 files changed

+3
-2
lines changed

3 files changed

+3
-2
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
- On Windows, add `IconExtWindows` trait which exposes creating an `Icon` from an external file or embedded resource
1616
- Add `BadIcon::OsError` variant for when OS icon functionality fails
1717
- On Windows, fix crash at startup on systems that do not properly support Windows' Dark Mode
18+
- **Breaking:** Use `i32` instead of `u32` for position type in `WindowEvent::Moved`.
1819

1920
# 0.21.0 (2020-02-04)
2021

src/event.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ pub enum WindowEvent<'a> {
185185
Resized(PhysicalSize<u32>),
186186

187187
/// The position of the window has changed. Contains the window's new position.
188-
Moved(PhysicalPosition<u32>),
188+
Moved(PhysicalPosition<i32>),
189189

190190
/// The window has been requested to close.
191191
CloseRequested,

src/platform_impl/windows/event_loop.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -736,7 +736,7 @@ unsafe extern "system" fn public_window_callback<T: 'static>(
736736
let windowpos = lparam as *const winuser::WINDOWPOS;
737737
if (*windowpos).flags & winuser::SWP_NOMOVE != winuser::SWP_NOMOVE {
738738
let physical_position =
739-
PhysicalPosition::new((*windowpos).x as u32, (*windowpos).y as u32);
739+
PhysicalPosition::new((*windowpos).x as i32, (*windowpos).y as i32);
740740
subclass_input.send_event(Event::WindowEvent {
741741
window_id: RootWindowId(WindowId(window)),
742742
event: Moved(physical_position),

0 commit comments

Comments
 (0)