Skip to content

Commit de6a1ea

Browse files
authored
Merge pull request #38 from Fincap/main
Add missing Window bindings
2 parents feeeff9 + 8f87f18 commit de6a1ea

File tree

1 file changed

+48
-0
lines changed

1 file changed

+48
-0
lines changed

src/zglfw.zig

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,10 @@ extern fn glfwWaitEvents() void;
7171
pub const waitEventsTimeout = glfwWaitEventsTimeout;
7272
extern fn glfwWaitEventsTimeout(timeout: f64) void;
7373

74+
/// `pub fn postEmptyEvent() void`
75+
pub const postEmptyEvent = glfwPostEmptyEvent;
76+
extern fn glfwPostEmptyEvent() void;
77+
7478
pub fn isVulkanSupported() bool {
7579
return glfwVulkanSupported() == TRUE;
7680
}
@@ -722,11 +726,19 @@ pub const Window = opaque {
722726
pub const setCursorEnterCallback = zglfw.setCursorEnterCallback;
723727
pub const getMonitor = zglfw.getWindowMonitor;
724728
pub const setMonitor = zglfw.setWindowMonitor;
729+
pub const iconify = zglfw.iconifyWindow;
730+
pub const restore = zglfw.restoreWindow;
731+
pub const maximize = zglfw.maximizeWindow;
725732
pub const show = zglfw.showWindow;
733+
pub const hide = zglfw.hideWindow;
726734
pub const focus = zglfw.focusWindow;
735+
pub const requestAttention = zglfw.requestWindowAttention;
727736
pub const getKey = zglfw.getKey;
728737
pub const getMouseButton = zglfw.getMouseButton;
729738
pub const setSizeLimits = zglfw.setWindowSizeLimits;
739+
pub const setAspectRatio = zglfw.setWindowAspectRatio;
740+
pub const getOpacity = zglfw.getWindowOpacity;
741+
pub const setOpacity = zglfw.setWindowOpacity;
730742
pub const setSize = zglfw.setWindowSize;
731743
pub const setPos = zglfw.setWindowPos;
732744
pub const setTitle = zglfw.setWindowTitle;
@@ -755,6 +767,15 @@ pub const Window = opaque {
755767
return .{ xscale, yscale };
756768
}
757769

770+
pub fn getFrameSize(self: *Window) [4]c_int {
771+
var left: c_int = 0.0;
772+
var top: c_int = 0.0;
773+
var right: c_int = 0.0;
774+
var bottom: c_int = 0.0;
775+
zglfw.getWindowFrameSize(self, &left, &top, &right, &bottom);
776+
return .{ left, top, right, bottom };
777+
}
778+
758779
pub fn getFramebufferSize(self: *Window) [2]c_int {
759780
var width: c_int = 0.0;
760781
var height: c_int = 0.0;
@@ -921,12 +942,27 @@ extern fn glfwSetWindowMonitor(
921942
refreshRate: c_int,
922943
) void;
923944

945+
pub const iconifyWindow = glfwIconifyWindow;
946+
extern fn glfwIconifyWindow(*Window) void;
947+
948+
pub const restoreWindow = glfwRestoreWindow;
949+
extern fn glfwRestoreWindow(*Window) void;
950+
951+
pub const maximizeWindow = glfwMaximizeWindow;
952+
extern fn glfwMaximizeWindow(*Window) void;
953+
924954
pub const showWindow = glfwShowWindow;
925955
extern fn glfwShowWindow(*Window) void;
926956

957+
pub const hideWindow = glfwHideWindow;
958+
extern fn glfwHideWindow(*Window) void;
959+
927960
pub const focusWindow = glfwFocusWindow;
928961
extern fn glfwFocusWindow(*Window) void;
929962

963+
pub const requestWindowAttention = glfwRequestWindowAttention;
964+
extern fn glfwRequestWindowAttention(*Window) void;
965+
930966
pub const getKey = glfwGetKey;
931967
extern fn glfwGetKey(*Window, key: Key) Action;
932968

@@ -942,9 +978,21 @@ extern fn glfwSetCursorPos(*Window, xpos: f64, ypos: f64) void;
942978
pub const setWindowSizeLimits = glfwSetWindowSizeLimits;
943979
extern fn glfwSetWindowSizeLimits(*Window, min_w: c_int, min_h: c_int, max_w: c_int, max_h: c_int) void;
944980

981+
pub const setWindowAspectRatio = glfwSetWindowAspectRatio;
982+
extern fn glfwSetWindowAspectRatio(*Window, numer: c_int, denom: c_int) void;
983+
945984
pub const getWindowContentScale = glfwGetWindowContentScale;
946985
extern fn glfwGetWindowContentScale(*Window, xscale: ?*f32, yscale: ?*f32) void;
947986

987+
pub const getWindowFrameSize = glfwGetWindowFrameSize;
988+
extern fn glfwGetWindowFrameSize(*Window, left: ?*c_int, top: ?*c_int, right: ?*c_int, bottom: ?*c_int) void;
989+
990+
pub const getWindowOpacity = glfwGetWindowOpacity;
991+
extern fn glfwGetWindowOpacity(*Window) f32;
992+
993+
pub const setWindowOpacity = glfwSetWindowOpacity;
994+
extern fn glfwSetWindowOpacity(*Window, opacity: f32) void;
995+
948996
pub const getFramebufferSize = glfwGetFramebufferSize;
949997
extern fn glfwGetFramebufferSize(*Window, width: ?*c_int, height: ?*c_int) void;
950998

0 commit comments

Comments
 (0)