From b3290f68870b0b5ee977fea59a5504dba3502eaa Mon Sep 17 00:00:00 2001 From: Iain H Date: Sun, 29 Dec 2024 16:20:20 -0600 Subject: [PATCH] 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 --- src/apprt/gtk/version.zig | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/apprt/gtk/version.zig b/src/apprt/gtk/version.zig index c61e940fb..8d98f6a40 100644 --- a/src/apprt/gtk/version.zig +++ b/src/apprt/gtk/version.zig @@ -19,8 +19,9 @@ pub inline fn atLeast( // compiling against unknown symbols and makes runtime checks // very slightly faster. if (comptime c.GTK_MAJOR_VERSION < major or - c.GTK_MINOR_VERSION < minor or - c.GTK_MICRO_VERSION < micro) return false; + (c.GTK_MAJOR_VERSION == major and c.GTK_MINOR_VERSION < minor) or + (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 (@inComptime()) return true;