Skip to content

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