glfw: add Window.maximize
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
This commit is contained in:
parent
f260b948e1
commit
6c9cde0bb8
1 changed files with 33 additions and 0 deletions
|
@ -654,6 +654,23 @@ pub inline fn restore(self: Window) Error!void {
|
|||
try getError();
|
||||
}
|
||||
|
||||
/// Maximizes the specified window.
|
||||
///
|
||||
/// This function maximizes the specified window if it was previously not maximized. If the window
|
||||
/// is already maximized, this function does nothing.
|
||||
///
|
||||
/// If the specified window is a full screen window, this function does nothing.
|
||||
///
|
||||
/// Possible errors include glfw.Error.NotInitialized and glfw.Error.PlatformError.
|
||||
///
|
||||
/// @thread_safety This function must only be called from the main thread.
|
||||
///
|
||||
/// see also: window_iconify, glfw.Window.iconify, glfw.Window.restore
|
||||
pub inline fn maximize(self: Window) Error!void {
|
||||
c.glfwMaximizeWindow(self.handle);
|
||||
try getError();
|
||||
}
|
||||
|
||||
test "defaultHints" {
|
||||
const glfw = @import("main.zig");
|
||||
try glfw.init();
|
||||
|
@ -952,3 +969,19 @@ test "restore" {
|
|||
|
||||
_ = window.restore() catch |err| std.debug.print("can't restore window, not supported by OS maybe? error={}\n", .{err});
|
||||
}
|
||||
|
||||
test "maximize" {
|
||||
const glfw = @import("main.zig");
|
||||
try glfw.init();
|
||||
defer glfw.terminate();
|
||||
|
||||
const window = glfw.Window.create(640, 480, "Hello, Zig!", null, null) catch |err| {
|
||||
// return without fail, because most of our CI environments are headless / we cannot open
|
||||
// windows on them.
|
||||
std.debug.print("note: failed to create window: {}\n", .{err});
|
||||
return;
|
||||
};
|
||||
defer window.destroy();
|
||||
|
||||
_ = window.maximize() catch |err| std.debug.print("can't maximize window, not supported by OS maybe? error={}\n", .{err});
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue