gtk(wayland): bind globals correctly (#8110)

This commit is contained in:
Leah Amelia Chen
2025-07-31 18:28:05 +02:00
committed by GitHub
2 changed files with 48 additions and 28 deletions

View File

@ -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,7 +178,8 @@ 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,
@ -184,6 +193,7 @@ pub const App = struct {
return;
};
}
}
},
// This should be a rare occurrence, but in case a global

View File

@ -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,7 +178,8 @@ 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,
@ -184,6 +193,7 @@ pub const App = struct {
return;
};
}
}
},
// This should be a rare occurrence, but in case a global