From c2165fc097689556c17102b095012a296f599945 Mon Sep 17 00:00:00 2001 From: Leah Amelia Chen Date: Thu, 31 Jul 2025 15:47:54 +0800 Subject: [PATCH] gtk(wayland): bind globals correctly Fixes #7988 --- src/apprt/gtk-ng/winproto/wayland.zig | 38 +++++++++++++++++---------- src/apprt/gtk/winproto/wayland.zig | 38 +++++++++++++++++---------- 2 files changed, 48 insertions(+), 28 deletions(-) diff --git a/src/apprt/gtk-ng/winproto/wayland.zig b/src/apprt/gtk-ng/winproto/wayland.zig index 83133723c..93f8639f3 100644 --- a/src/apprt/gtk-ng/winproto/wayland.zig +++ b/src/apprt/gtk-ng/winproto/wayland.zig @@ -157,11 +157,19 @@ pub const App = struct { const ctx_fields = @typeInfo(Context).@"struct".fields; switch (event) { - .global => |v| global: { + .global => |v| { + log.debug("found global {s}", .{v.interface}); + // We don't actually do anything with this other than checking // for its existence, so we process this separately. - if (std.mem.orderZ(u8, v.interface, "xdg_wm_dialog_v1") == .eq) + if (std.mem.orderZ( + u8, + v.interface, + "xdg_wm_dialog_v1", + ) == .eq) { context.xdg_wm_dialog_present = true; + return; + } inline for (ctx_fields) |field| { const T = getInterfaceType(field) orelse continue; @@ -170,19 +178,21 @@ pub const App = struct { u8, v.interface, T.interface.name, - ) != .eq) break :global; + ) == .eq) { + log.debug("matched {}", .{T}); - @field(context, field.name) = registry.bind( - v.name, - T, - T.generated_version, - ) catch |err| { - log.warn( - "error binding interface {s} error={}", - .{ v.interface, err }, - ); - return; - }; + @field(context, field.name) = registry.bind( + v.name, + T, + T.generated_version, + ) catch |err| { + log.warn( + "error binding interface {s} error={}", + .{ v.interface, err }, + ); + return; + }; + } } }, diff --git a/src/apprt/gtk/winproto/wayland.zig b/src/apprt/gtk/winproto/wayland.zig index ae3c871f2..0973499cc 100644 --- a/src/apprt/gtk/winproto/wayland.zig +++ b/src/apprt/gtk/winproto/wayland.zig @@ -157,11 +157,19 @@ pub const App = struct { const ctx_fields = @typeInfo(Context).@"struct".fields; switch (event) { - .global => |v| global: { + .global => |v| { + log.debug("found global {s}", .{v.interface}); + // We don't actually do anything with this other than checking // for its existence, so we process this separately. - if (std.mem.orderZ(u8, v.interface, "xdg_wm_dialog_v1") == .eq) + if (std.mem.orderZ( + u8, + v.interface, + "xdg_wm_dialog_v1", + ) == .eq) { context.xdg_wm_dialog_present = true; + return; + } inline for (ctx_fields) |field| { const T = getInterfaceType(field) orelse continue; @@ -170,19 +178,21 @@ pub const App = struct { u8, v.interface, T.interface.name, - ) != .eq) break :global; + ) == .eq) { + log.debug("matched {}", .{T}); - @field(context, field.name) = registry.bind( - v.name, - T, - T.generated_version, - ) catch |err| { - log.warn( - "error binding interface {s} error={}", - .{ v.interface, err }, - ); - return; - }; + @field(context, field.name) = registry.bind( + v.name, + T, + T.generated_version, + ) catch |err| { + log.warn( + "error binding interface {s} error={}", + .{ v.interface, err }, + ); + return; + }; + } } },