aboutsummaryrefslogtreecommitdiff
path: root/crates/fparkan-platform
diff options
context:
space:
mode:
authorValentin Popov <valentin@popov.link>2026-06-23 21:50:32 +0300
committerValentin Popov <valentin@popov.link>2026-06-23 21:50:32 +0300
commita0a4089e4b75296e43a89f9a9ca2592f7fc2f68f (patch)
tree0ccc308da703508e274379385e54ad11d33609bf /crates/fparkan-platform
parentdc7e72961a67ba8f0eab623dd0172df3ced7f74d (diff)
downloadfparkan-a0a4089e4b75296e43a89f9a9ca2592f7fc2f68f.tar.xz
fparkan-a0a4089e4b75296e43a89f9a9ca2592f7fc2f68f.zip
feat: expose native window handles
Diffstat (limited to 'crates/fparkan-platform')
-rw-r--r--crates/fparkan-platform/Cargo.toml1
-rw-r--r--crates/fparkan-platform/src/lib.rs15
2 files changed, 16 insertions, 0 deletions
diff --git a/crates/fparkan-platform/Cargo.toml b/crates/fparkan-platform/Cargo.toml
index dc103f2..3f9d593 100644
--- a/crates/fparkan-platform/Cargo.toml
+++ b/crates/fparkan-platform/Cargo.toml
@@ -6,6 +6,7 @@ license.workspace = true
repository.workspace = true
[dependencies]
+raw-window-handle = "0.6"
[lints]
workspace = true
diff --git a/crates/fparkan-platform/src/lib.rs b/crates/fparkan-platform/src/lib.rs
index fec188e..c2a3a0f 100644
--- a/crates/fparkan-platform/src/lib.rs
+++ b/crates/fparkan-platform/src/lib.rs
@@ -20,6 +20,8 @@
)]
//! Platform ports for clocks, event sources and window descriptors.
+use raw_window_handle::{RawDisplayHandle, RawWindowHandle};
+
/// Monotonic instant measured in milliseconds since process start.
#[derive(Clone, Copy, Debug, Eq, Ord, PartialEq, PartialOrd)]
pub struct MonotonicInstant(pub u64);
@@ -143,6 +145,15 @@ pub struct WindowHandle {
pub id: u64,
}
+/// Native raw window/display handles for render surface creation.
+#[derive(Clone, Copy, Debug)]
+pub struct NativeWindowHandles {
+ /// Raw display handle.
+ pub display: RawDisplayHandle,
+ /// Raw window handle.
+ pub window: RawWindowHandle,
+}
+
/// Window presentation and lifecycle port.
///
/// Presentation is not owned by the window abstraction. Render adapters
@@ -160,6 +171,10 @@ pub trait WindowPort {
fn is_occluded(&self) -> bool;
/// Opaque window identity.
fn handle(&self) -> WindowHandle;
+ /// Raw native handles for render surface creation, when backed by a native window.
+ fn native_handles(&self) -> Option<NativeWindowHandles> {
+ None
+ }
}
/// Render backend request contract.