Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HWND in raw_window_handle.rs is hardcoded to 4 bytes width #1365

Open
Grimeh opened this issue Jan 20, 2024 · 1 comment
Open

HWND in raw_window_handle.rs is hardcoded to 4 bytes width #1365

Grimeh opened this issue Jan 20, 2024 · 1 comment
Labels

Comments

@Grimeh
Copy link

Grimeh commented Jan 20, 2024

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?)

@Cobrand
Copy link
Member

Cobrand commented Jan 30, 2024

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

@Cobrand Cobrand added the bug label Jan 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants