Rust-SDL2 / rust-sdl2

SDL2 bindings for Rust

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

`HWND` in `raw_window_handle.rs` is hardcoded to 4 bytes width

Grimeh opened this issue · comments

In raw_window_handle.rs HWND is a struct with a libc::c_int field, but it's defined as an alias for isize in both raw-window-handle and windows-rs. This inconsistency is error prone when working with crates that interface with Win32 APIs, or when writing code that interfaces with Win32 directly.

I think it would be a lot smarter to follow the lead of windows-rs here and use isize rather than copying the C Win32 API (where HWND is void*) so literally (but also not literally since it's a struct?).

Before I make a PR I thought I'd ask: is there a specific reason it's done this way? (and why it's a struct at all and not a unit type?)

Probably just an oversight on the original developer, if it's an issue with native APIs, it's very probably a bug.