tiny.windowing.Window
Defined in tiny.windowing.
API (51)
Actions
Public operations.
clipboardStatuscreatedestroydroppedEventCounteventSourcegamepadgamepadCountgamepadStatusgetClipboardTextAllocgetContentScalegetDrawAreagetFramebufferAreagetFramebufferSizegetMouseDeltagetMousePositiongetMouseWheelgetNativeSurfacegetScaleEvidencegetSizeinputStatusisCursorOnScreenisKeyDownisKeyPressedisKeyReleasedisMaximizedisMouseButtonDownisMouseButtonPressedisMouseButtonReleasedmaximizeminimizemodifiersnextPresentationOutcomenextPressedKeynextTextCodepointpollEventspresentRgba8presentRgba8RegionpresentationStatuspresentationStorageStatusrestoresetClipboardTextsetCursorsetMinSizesetTitleshouldClosetoggleMaximizewaylandDmabuf: The window's dma-buf presentation with explicit synchronization, when it is a Wayland window and the compositor offerszwp_linux_dmabuf_v14 or later andwp_linux_drm_syncobj_manager_v1.waylandStorageStatusx11StorageStatus
Fields and members
Public fields and members.
Source
Source: lib/windowing/src/window.zig:83
zig
pub const Window = struct { allocator: std.mem.Allocator, backend: *Backend, pub fn create(allocator: std.mem.Allocator, config: WindowConfig) CreateError!Window { const backend = allocator.create(Backend) catch return error.OutOfMemory; errdefer allocator.destroy(backend); try backend.init(allocator, config); return .{ .allocator = allocator, .backend = backend }; } pub fn destroy(self: *Window) void { self.backend.deinit(); self.allocator.destroy(self.backend); self.* = undefined; } pub fn pollEvents(self: *Window) PollError!EventIterator { return self.backend.pollEvents(); } pub fn droppedEventCount(self: *const Window) u64 { return self.backend.droppedEventCount(); } pub fn eventSource(self: *const Window) ?EventSource { return self.backend.eventSource(); } pub fn shouldClose(self: *const Window) bool { return self.backend.shouldClose(); } pub fn getSize(self: *const Window) Size { return self.backend.getSize(); } pub fn getFramebufferSize(self: *const Window) Size { return self.backend.getFramebufferSize(); } pub fn getDrawArea(self: *const Window) sys.desktop.DrawArea { return sizeToDrawArea(self.getSize()); } pub fn getFramebufferArea(self: *const Window) sys.desktop.DrawArea { return sizeToDrawArea(self.getFramebufferSize()); } pub fn getNativeSurface(self: *Window) surface.Surface { return self.backend.nativeSurface(); } pub fn getScaleEvidence(self: *const Window) sys.desktop.WindowScaleEvidence { return scaleEvidenceFromSizes(self.getSize(), self.getFramebufferSize(), self.getContentScale()); } pub fn presentRgba8( self: *Window, rgba8: []const u8, width: u32, height: u32, ) PresentError!void { return self.backend.presentRgba8(rgba8, width, height); } pub fn presentRgba8Region( self: *Window, rgba8: []const u8, width: u32, height: u32, region: PresentRegion, ) PresentError!void { return self.backend.presentRgba8Region(rgba8, width, height, region); } pub fn getContentScale(self: *const Window) Scale { return self.backend.getContentScale(); } pub fn isKeyDown(self: *const Window, key: Key) bool { return self.backend.inputState().isKeyDown(key); } pub fn isKeyPressed(self: *const Window, key: Key) bool { return self.backend.inputState().isKeyPressed(key); } pub fn isKeyReleased(self: *const Window, key: Key) bool { return self.backend.inputState().isKeyReleased(key); } pub fn nextPressedKey(self: *Window) ?Key { return self.backend.inputStateMut().nextPressedKey(); } pub fn modifiers(self: *const Window) Modifier { return self.backend.modifiers(); } pub fn isMouseButtonDown(self: *const Window, button: MouseButton) bool { return self.backend.inputState().isMouseButtonDown(button); } pub fn isMouseButtonPressed(self: *const Window, button: MouseButton) bool { return self.backend.inputState().isMouseButtonPressed(button); } pub fn isMouseButtonReleased(self: *const Window, button: MouseButton) bool { return self.backend.inputState().isMouseButtonReleased(button); } pub fn getMousePosition(self: *const Window) input.Point { return self.backend.inputState().mouse_position; } pub fn getMouseDelta(self: *const Window) input.Point { return self.backend.inputState().mouse_delta; } pub fn getMouseWheel(self: *const Window) input.Wheel { return self.backend.inputState().mouse_wheel; } pub fn nextTextCodepoint(self: *Window) ?u21 { return self.backend.inputStateMut().nextTextCodepoint(); } pub fn inputStatus(self: *const Window) input.Status { return self.backend.inputState().status(); } pub fn setCursor(self: *Window, shape: CursorShape) void { self.backend.setCursor(shape); } pub fn isCursorOnScreen(self: *const Window) bool { return self.backend.isCursorOnScreen(); } pub fn setTitle(self: *Window, title: [:0]const u8) void { self.backend.setTitle(title); } pub fn setMinSize(self: *Window, width: u32, height: u32) void { self.backend.setMinSize(width, height); } pub fn minimize(self: *Window) void { self.backend.minimize(); } pub fn maximize(self: *Window) void { self.backend.maximize(); } pub fn restore(self: *Window) void { self.backend.restore(); } pub fn isMaximized(self: *Window) bool { return self.backend.isMaximized(); } pub fn toggleMaximize(self: *Window) void { if (self.isMaximized()) { self.restore(); } else { self.maximize(); } } pub fn getClipboardTextAlloc(self: *Window, allocator: std.mem.Allocator) !?[]u8 { return self.backend.getClipboardTextAlloc(allocator); } pub fn setClipboardText(self: *Window, text: []const u8) clipboard.PublishError!void { return self.backend.setClipboardText(text); } pub fn clipboardStatus(self: *const Window) clipboard.Status { return self.backend.clipboardStatus(); } pub fn x11StorageStatus(self: *const Window) sys.x11.Status { return self.backend.x11StorageStatus(); } /// The window's dma-buf presentation with explicit synchronization, when it is a Wayland /// window and the compositor offers `zwp_linux_dmabuf_v1` 4 or later and /// `wp_linux_drm_syncobj_manager_v1`. Its first commit makes shared-memory presents of the /// window fail with `ExplicitSyncSurface`. pub fn waylandDmabuf(self: *Window) ?WaylandDmabuf { return self.backend.waylandDmabuf(); } pub fn waylandStorageStatus(self: *const Window) WaylandStorageStatus { return self.backend.waylandStorageStatus(); } pub fn nextPresentationOutcome(self: *Window) ?presentation.Outcome { return self.backend.nextPresentationOutcome(); } pub fn presentationStatus(self: *const Window) presentation.Status { return self.backend.presentationStatus(); } pub fn presentationStorageStatus(self: *const Window) presentation.StorageStatus { return self.backend.presentationStorageStatus(); } pub fn gamepadCount(self: *const Window) usize { return self.backend.gamepadState().connectedCount(); } pub fn gamepad(self: *const Window, index: usize) *const gamepads.Gamepad { return self.backend.gamepadState().gamepad(index); } pub fn gamepadStatus(self: *const Window) gamepads.Status { return self.backend.gamepadState().status(); }};Source: lib/windowing/src/root.zig:69
zig
pub const Window = window.Window;Complete caller list for Window.create
22 direct callers.
lib.windowing.src.backend.test_live_automatic_unreachable_Wayland_falls_back_to_invisible_X11_window_under_Xvfb[function] — test source atlib/windowing/src/backend.zig:354in nearest public ownerlib.windowing.src.backendlib.windowing.src.test.test_window_rejects_invalid_clipboard_capacity_before_backend_effects[function] — test source atlib/windowing/src/test.zig:830in nearest public ownerlib.windowing.src.testlib.windowing.src.test.test_window_rejects_invalid_event_queue_capacity_before_backend_effects[function] — test source atlib/windowing/src/test.zig:844in nearest public ownerlib.windowing.src.testlib.windowing.src.test.test_window_rejects_invalid_frame_storage_before_backend_effects[function] — test source atlib/windowing/src/test.zig:579in nearest public ownerlib.windowing.src.testlib.windowing.src.test.test_window_rejects_invalid_gamepad_capacity_before_backend_effects[function] — test source atlib/windowing/src/test.zig:866in nearest public ownerlib.windowing.src.testlib.windowing.src.test.test_window_rejects_invalid_input_capacity_before_backend_effects[function] — test source atlib/windowing/src/test.zig:883in nearest public ownerlib.windowing.src.testlib.windowing.src.test.test_windowing_Cocoa_delegate_reports_focus_transitions_through_public_events[function] — test source atlib/windowing/src/test.zig:323in nearest public ownerlib.windowing.src.testlib.windowing.src.test.test_windowing_Cocoa_key_repeats_preserve_native_metadata[function] — test source atlib/windowing/src/test.zig:424in nearest public ownerlib.windowing.src.testlib.windowing.src.test.test_windowing_Cocoa_modifier_events_update_public_key_state[function] — test source atlib/windowing/src/test.zig:359in nearest public ownerlib.windowing.src.testlib.windowing.src.test.test_windowing_Cocoa_other_mouse_buttons_update_public_state[function] — test source atlib/windowing/src/test.zig:449in nearest public ownerlib.windowing.src.testlib.windowing.src.test.test_windowing_Cocoa_other_mouse_drag_updates_public_position[function] — test source atlib/windowing/src/test.zig:486in nearest public ownerlib.windowing.src.testlib.windowing.src.test.test_windowing_Cocoa_window_exposes_consistent_live_backing_scale[function] — test source atlib/windowing/src/test.zig:511in nearest public ownerlib.windowing.src.testlib.windowing.src.test.test_windowing_Cocoa_window_presents_through_the_public_lifecycle[function] — test source atlib/windowing/src/test.zig:245in nearest public ownerlib.windowing.src.testlib.windowing.src.test.test_windowing_Cocoa_window_preserves_empty_title_support[function] — test source atlib/windowing/src/test.zig:296in nearest public ownerlib.windowing.src.testlib.windowing.src.test.test_windowing_Cocoa_window_reports_native_close_through_public_state[function] — test source atlib/windowing/src/test.zig:274in nearest public ownerlib.windowing.src.testlib.windowing.src.test.test_windowing_Wayland_rejects_empty_output_storage_before_backend_effects[function] — test source atlib/windowing/src/test.zig:780in nearest public ownerlib.windowing.src.testlib.windowing.src.test.test_windowing_Wayland_rejects_invalid_Compose_scratch_before_backend_effects[function] — test source atlib/windowing/src/test.zig:799in nearest public ownerlib.windowing.src.testlib.windowing.src.test.test_windowing_Wayland_rejects_invalid_Compose_storage_before_backend_effects[function] — test source atlib/windowing/src/test.zig:788in nearest public ownerlib.windowing.src.testlib.windowing.src.test.test_windowing_Wayland_rejects_invalid_global_storage_before_backend_effects[function] — test source atlib/windowing/src/test.zig:769in nearest public ownerlib.windowing.src.testlib.windowing.src.test.test_windowing_Wayland_rejects_invalid_object_storage_before_backend_effects[function] — test source atlib/windowing/src/test.zig:759in nearest public ownerlib.windowing.src.testlib.windowing.src.test.test_windowing_Wayland_rejects_invalid_swapchain_capacity_before_backend_effects[function] — test source atlib/windowing/src/test.zig:810in nearest public ownerlib.windowing.src.testlib.windowing.src.test.test_windowing_Wayland_rejects_invalid_transport_storage_before_backend_effects[function] — test source atlib/windowing/src/test.zig:751in nearest public ownerlib.windowing.src.test
Audit
| Definitions | 50 |
|---|---|
| Public names | 50 |
| Members | 2 |
| Version | 26.7.0 |
| Revision | daab053ee433 |