glfw: better handle Wayland limitations

Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
This commit is contained in:
Stephen Gutekanst 2021-07-23 14:05:54 -07:00
parent 8ccae4cb1a
commit a690b84732
2 changed files with 7 additions and 3 deletions

View file

@ -529,7 +529,10 @@ test "set_getGammaRamp" {
const monitor = try getPrimary();
if (monitor) |m| {
const ramp = try m.getGammaRamp();
const ramp = m.getGammaRamp() catch |err| {
std.debug.print("can't get window position, wayland maybe? error={}\n", .{err});
return;
};
// Set it to the exact same value; if we do otherwise an our tests fail it wouldn't call
// terminate and our made-up gamma ramp would get stuck.

View file

@ -447,7 +447,8 @@ test "setIcon" {
icon.pixels[(x * y * 4) + 3] = 255; // alpha
}
}
try window.setIcon(allocator, &[_]Image{icon});
window.setIcon(allocator, &[_]Image{icon}) catch |err| std.debug.print("can't set window icon, wayland maybe? error={}\n", .{err});
icon.deinit(allocator); // glfw copies it.
}
@ -464,5 +465,5 @@ test "getPos" {
};
defer window.destroy();
_ = try window.getPos();
_ = window.getPos() catch |err| std.debug.print("can't get window position, wayland maybe? error={}\n", .{err});
}