Skip to content

Commit

Permalink
m: Mark orbital as send/sync
Browse files Browse the repository at this point in the history
@jackpot51 confirmed in chat that Orbital's types should be thread-safe.

Signed-off-by: John Nunley <[email protected]>
  • Loading branch information
notgull committed May 19, 2024
1 parent 0c54f9e commit e8dd90a
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/backends/orbital.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,17 +56,21 @@ impl Drop for OrbitalMap {
}

pub struct OrbitalImpl<D, W> {
handle: OrbitalWindowHandle,
handle: ThreadSafeWindowHandle,
width: u32,
height: u32,
presented: bool,
window_handle: W,
_display: PhantomData<D>,
}

struct ThreadSafeWindowHandle(OrbitalWindowHandle);
unsafe impl Send for ThreadSafeWindowHandle {}
unsafe impl Sync for ThreadSafeWindowHandle {}

impl<D: HasDisplayHandle, W: HasWindowHandle> OrbitalImpl<D, W> {
fn window_fd(&self) -> usize {
self.handle.window.as_ptr() as usize
self.handle.0.window.as_ptr() as usize
}

// Read the current width and size
Expand Down Expand Up @@ -134,7 +138,7 @@ impl<D: HasDisplayHandle, W: HasWindowHandle> SurfaceInterface<D, W> for Orbital
};

Ok(Self {
handle,
handle: ThreadSafeWindowHandle(handle),
width: 0,
height: 0,
presented: false,
Expand Down

0 comments on commit e8dd90a

Please sign in to comment.