winit-sonoma-fix/src
Francesca Frangipane 8f47fdbe67
Windows: Position fixes (#479)
* Remove executable flag from os/macos.rs

This was causing me some grief while working on Windows, and it
doesn't belong here to begin with.

* Windows: get_position returns screen coordinates instead of workspace coordinates

Previously, get_position used GetWindowPlacement. As per the
documentation of WINDOWSTRUCT, the returned coordinates are in
workspace space, meaning they're relative to the taskbar. It's
also explicitly remarked that these coordinates should only be
used in conjunction with SetWindowPlacement, as mixing them with
functions expecting screen coordinates can cause unpleasantness.
Since our set_position (correctly) uses SetWindowPos, this meant
that passing the return of get_position to set_position would
cause the window to move.

We now use GetWindowRect, which returns screen coordinates. This
gives us both better consistency within the Windows backend and
across platforms.

Note that this only makes a difference if the taskbar is visible.
With the taskbar hidden, the values are exactly the same as before.

* Windows: Moved event position values are consistent with get_position

The old Moved values had two problems:

* They were obtained by casting a WORD (u16) straight to an i32.
This meant wrap-around would never be interpreted as negative,
thus negative positions (which are ubiquitous when using multiple
monitors) would result in positions around u16::MAX.

* WM_MOVE supplies client area positions, not window positions.

Switching to handling WM_WINDOWPOSCHANGED solves both of these
problems.

* Better documentation for Moved and Resized
2018-04-26 20:09:33 -04:00
..
os Windows: Position fixes (#479) 2018-04-26 20:09:33 -04:00
platform Windows: Position fixes (#479) 2018-04-26 20:09:33 -04:00
events.rs Windows: Position fixes (#479) 2018-04-26 20:09:33 -04:00
lib.rs Replace Closed event with CloseRequested and Destroyed (#476) 2018-04-24 16:20:40 -04:00
window.rs Add methods to get the position of a window's client area, relative to the desktop (#430) 2018-04-16 21:40:30 -04:00