can-lehmann / owlkettle

A declarative user interface framework based on GTK 4
https://can-lehmann.github.io/owlkettle/README
MIT License
367 stars 14 forks source link

Allow specifying arbitrary adwaita versions #96

Closed PhilippMDoerner closed 9 months ago

PhilippMDoerner commented 9 months ago

Issue written based on the discussion in #86

Currently owlkettle requires you to add the flag -d:adwaita12 if you wish to compile for environments where you know the adwaita lib is installed with a version of 1.2 or higher.

This is done for widgets that were added in version 1.2 of the adwaita lib.

This doesn't scale well if later down the road we have widgets that were added in 1.4, introducing a new -d:adwaita14 flag and now you need to specify both -d:adwaita12 and -d:adwaita14 if you need both their widgets.

Thus it makes sense to rather move over to compilation flags such as -d:adwMajor=1 -d=adwMinor=2 where you define a specific version and based on that sections of code are either compiled in or out.

PhilippMDoerner commented 9 months ago

Honestly I think I prefer having a single number for this because version comparisons become so tedious if they're separate.

Particularly the following scenario is highly annoying: Imagine you are in a world where adwaita version 2.X already exists and a widget was available since 1.4.

You now need to write: when AdwMajor > 1 or (AdwMajor == 1 and AdwMinor >= 4)

As opposed to when AdwVersion > 14

can-lehmann commented 9 months ago

There are nice overloaded comparison operators for tuples: https://nim-lang.org/docs/system.html#%3C%2CT%2CT

PhilippMDoerner commented 9 months ago

There are nice overloaded comparison operators for tuples: https://nim-lang.org/docs/system.html#%3C%2CT%2CT

That makes it so insanely much better, I am no longer against the split

PhilippMDoerner commented 9 months ago

I found when defined(gtk48): flag, shall we do the same for GTK as well? GtkMajor, GtkMinor wrapped in GtkVersion and then when GtkVersion >= (4, 7) ?

Edit: Well, GtkMajor makes no sense I guess, but GtkMinor might

can-lehmann commented 9 months ago

Seems reasonable.