mach: mouse cursor support (#352)

adds mouse cursor support for standard cursors

Co-authored-by: Stephen Gutekanst <stephen.gutekanst@gmail.com>
This commit is contained in:
David Vanderson 2022-06-16 00:53:55 -04:00 committed by GitHub
parent f5affbe7ae
commit 43bff35d2c
Failed to generate hash of commit
5 changed files with 87 additions and 0 deletions

View file

@ -14,6 +14,7 @@ const js = struct {
extern fn machCanvasGetWindowHeight(canvas: CanvasId) u32;
extern fn machCanvasGetFramebufferWidth(canvas: CanvasId) u32;
extern fn machCanvasGetFramebufferHeight(canvas: CanvasId) u32;
extern fn machSetMouseCursor(cursor_name: [*]const u8, len: u32) void;
extern fn machEmitCloseEvent() void;
extern fn machSetWaitEvent(timeout: f64) void;
extern fn machHasEvent() bool;
@ -84,6 +85,11 @@ pub const Platform = struct {
return platform.last_window_size;
}
pub fn setMouseCursor(_: *Platform, cursor: enums.MouseCursor) !void {
const cursor_name = @tagName(cursor);
js.machSetMouseCursor(cursor_name.ptr, cursor_name.len);
}
fn pollChanges(platform: *Platform) void {
const change_type = js.machChangeShift();