Correct the comptime GTK atLeast() function

The comptime path of the GTK `atLeast()` version function fails to take
the preceeding portion of the version into account. For example version
5.1.0 is incorrectly marked as less than 4.16.7 due to the minor version
(1) being less than the minor we are comparing against (16).

For example, building against GTK 4.17.1:
Before: version.atLeast(4,16,2) -> false
After:  version.atLeast(4,16,2) -> true
This commit is contained in:
Iain H
2024-12-29 16:20:20 -06:00
parent b3925b83ae
commit b3290f6887

View File

@ -19,8 +19,9 @@ pub inline fn atLeast(
// compiling against unknown symbols and makes runtime checks // compiling against unknown symbols and makes runtime checks
// very slightly faster. // very slightly faster.
if (comptime c.GTK_MAJOR_VERSION < major or if (comptime c.GTK_MAJOR_VERSION < major or
c.GTK_MINOR_VERSION < minor or (c.GTK_MAJOR_VERSION == major and c.GTK_MINOR_VERSION < minor) or
c.GTK_MICRO_VERSION < micro) return false; (c.GTK_MAJOR_VERSION == major and c.GTK_MINOR_VERSION == minor and c.GTK_MICRO_VERSION < micro))
return false;
// If we're in comptime then we can't check the runtime version. // If we're in comptime then we can't check the runtime version.
if (@inComptime()) return true; if (@inComptime()) return true;