rust-windowing / raw-window-handle

A common windowing interoperability library for Rust
Apache License 2.0
311 stars 49 forks source link

Change Windows `HANDLE` types back to `*mut c_void` **again** :weary:? #171

Open MarijnS95 opened 1 month ago

MarijnS95 commented 1 month ago

FYI, win32metadata is changing these back to void pointers it seems:

https://github.com/microsoft/win32metadata/issues/1924 https://github.com/microsoft/win32metadata/commit/b4dfd2f25c0114da8b27d0d390bca5c1555fc55c

See also my local regeneration: https://github.com/microsoft/windows-rs/commit/96b9a27a6293fe08e4a96b64400239594941ff20

_Originally posted by @MarijnS95 in https://github.com/rust-windowing/raw-window-handle/pull/136#discussion_r1640368547_


This is out now in the windows 0.58 release and somewhat annoying when using raw-window-handle together with it.

Lokathor commented 1 month ago

deep and heavy sigh

madsmtm commented 1 month ago

This is a breaking change, and should be combined with https://github.com/rust-windowing/raw-window-handle/pull/154

notgull commented 3 weeks ago

We can change them back to pointers. If they decide to go back to usize just keep them as pointers.

notgull commented 3 weeks ago

Actually wait, does this impact us? From the issue linked above:

Rust currently emits isize/usize integers as a result of decomposing our synthetic handle types and encountering IntPtr/UIntPtr. Rust would now like to emit pointers to better align with its core handle type, but it cannot differentiate between legitimate pointer-sized integers (e.g. LRESULT) and handles (e.g. HMODULE).

Since window IDs in Windows are just indexes into a thread-local table, they're still semantically usize/isize. So it's still correct (by Rust's standards) to not change them here, even if win32metadata doesn't realize it.