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

Rebase enumerations on integer datatypes #989

Merged
merged 1 commit into from
Dec 14, 2023

Conversation

badcel
Copy link
Member

@badcel badcel commented Dec 14, 2023

  • Int is the base type for enumerations
  • UInt is the base type for bitfields This matches the return types of the GObject.Value.GetEnum / GetFlags methods.

With GTK3 support this was problematic as there were some enumerations (int based) which defined values in the range of unsigned integers. This was the reason long was used as it could handle all values which could be created either with integer or unsigned integer

Starting with GTK4 such enumerations are not longer used and the base type can be switched to int / uint.

In case such enumerations appear again those enumerations would probably need to be dynamically declared as uint based instead of int based. During runtime this must then be evaluated and handled accordingly (e.g. via Unsafe.As<int, uint>()).

  • I agree that my contribution may be licensed either under MIT or any version of LGPL license.

- Int is the base type for enumerations
- UInt is the base type for bitfields
This matches the return types of the GObject.Value.GetEnum / GetFlags methods.

With GTK3 support this was problematic as there were some enumerations (int based) which defined values in the range of unsigned integers. This was the reason long was used as it could handle all values which could be created either with integer or unsigned integer

Starting with GTK4 such enumerations are not longer used and the base type can be switched to int / uint.

In case such enumerations appear again those enumerations would probably need to be dynamically declared as uint based instead of int based. During runtime this must then be evaluated and handled accordingly (e.g. via Unsafe.As<int, uint>()).
@badcel badcel merged commit 96a71bb into main Dec 14, 2023
@badcel badcel deleted the base-enumerations-on-integer-datatypes branch December 14, 2023 21:46
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

Successfully merging this pull request may close these issues.

1 participant