mach: add headless option (#450)

Co-authored-by: Stephen Gutekanst <stephen.gutekanst@gmail.com>
This commit is contained in:
LeRoyce Pearson 2022-08-06 20:38:04 -06:00 committed by GitHub
parent 2045142057
commit f4611e1414
Failed to generate hash of commit
2 changed files with 5 additions and 0 deletions

View file

@ -406,6 +406,7 @@ pub const Platform = struct {
const position = platform.last_position;
try platform.window.setMonitor(null, @intCast(i32, position.x), @intCast(i32, position.y), options.width, options.height, null);
}
if (options.headless) platform.window.hide() catch {};
}
pub fn setShouldClose(platform: *Platform, value: bool) void {

View file

@ -34,6 +34,10 @@ pub const Options = struct {
/// Fullscreen window.
fullscreen: bool = false,
/// Headless mode. Once set, this cannot be unset (because e.g. Wayland does not support showing
/// a window after it was hidden.)
headless: bool = false,
/// Monitor synchronization modes.
vsync: enums.VSyncMode = .double,