Add Send and Sync to OwnedDisplayHandle (#4509)

This commit is contained in:
junglie85
2026-03-17 02:54:42 +00:00
committed by GitHub
parent 6f3d763650
commit 8e38112ad3
4 changed files with 13 additions and 2 deletions

View File

@@ -176,11 +176,11 @@ pub trait EventLoopProxyProvider: Send + Sync + Debug {
/// - A reference-counted pointer to the underlying type.
#[derive(Clone)]
pub struct OwnedDisplayHandle {
pub(crate) handle: Arc<dyn HasDisplayHandle>,
pub(crate) handle: Arc<dyn HasDisplayHandle + Send + Sync>,
}
impl OwnedDisplayHandle {
pub fn new(handle: Arc<dyn HasDisplayHandle>) -> Self {
pub fn new(handle: Arc<dyn HasDisplayHandle + Send + Sync>) -> Self {
Self { handle }
}
}

View File

@@ -45,6 +45,7 @@ changelog entry.
- Add `keyboard` support for OpenHarmony.
- On iOS, add Apple Pencil support with force, altitude, and azimuth data.
- On Redox, add support for missing keyboard scancodes.
- Implement `Send` and `Sync` for `OwnedDisplayHandle`.
### Changed

View File

@@ -28,3 +28,8 @@ fn custom_cursor_send() {
needs_send::<winit::cursor::CustomCursorSource>();
needs_send::<winit::cursor::CustomCursor>();
}
#[test]
fn owned_display_handle_send() {
needs_send::<winit::event_loop::OwnedDisplayHandle>();
}

View File

@@ -21,3 +21,8 @@ fn custom_cursor_sync() {
needs_sync::<winit::cursor::CustomCursorSource>();
needs_sync::<winit::cursor::CustomCursor>();
}
#[test]
fn owned_display_handle_sync() {
needs_sync::<winit::event_loop::OwnedDisplayHandle>();
}