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

Inappropriate field type in WINDOWPLACEMENT #1781

Closed
Enyium opened this issue Dec 28, 2023 · 1 comment
Closed

Inappropriate field type in WINDOWPLACEMENT #1781

Enyium opened this issue Dec 28, 2023 · 1 comment

Comments

@Enyium
Copy link

Enyium commented Dec 28, 2023

GetWindowPlacement() and SetWindowPlacement() handle a WINDOWPLACEMENT struct. showCmd is a u32, but it should be a SHOW_WINDOW_CMD, because the values that it may contain like, e.g., SW_SHOWMINIMIZED are of that type.

@riverar
Copy link
Collaborator

riverar commented Dec 28, 2023

We can't do that, sadly. See related issue #1502 for the details.

The short version is: showCmd is u32 while SW_SHOWMINIMIZED et al. are integer literals in the original C/C++ headers (i.e., #define SW_SHOWMINIMIZED 2). Those default to int. We have to preserve these types for application binary interface (ABI) correctness.

Projections (e.g., C#, Rust) can opt into reading the associated enum attribute value and generate any desired overloads, wrappers, etc.

public struct WINDOWPLACEMENT
{
...
	[AssociatedEnum("SHOW_WINDOW_CMD")]
	public uint showCmd;
...

Closing for now but feel free to keep the discussion going.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants