Add raw window handle implementations to GPUI (#7101)

This is in preparation for experiments with wgpu. This should have no
external effect.

Release Notes:

- N/A
This commit is contained in:
Mikayla Maki 2024-01-30 11:42:28 -08:00 committed by GitHub
parent 1d794dbb37
commit a54eaaecee
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 60 additions and 6 deletions

View file

@ -5,6 +5,7 @@ use crate::{
};
use collections::HashMap;
use parking_lot::Mutex;
use raw_window_handle::{HasDisplayHandle, HasWindowHandle};
use std::{
rc::{Rc, Weak},
sync::{self, Arc},
@ -29,6 +30,22 @@ pub(crate) struct TestWindowState {
#[derive(Clone)]
pub(crate) struct TestWindow(pub(crate) Arc<Mutex<TestWindowState>>);
impl HasWindowHandle for TestWindow {
fn window_handle(
&self,
) -> Result<raw_window_handle::WindowHandle<'_>, raw_window_handle::HandleError> {
unimplemented!("Test Windows are not backed by a real platform window")
}
}
impl HasDisplayHandle for TestWindow {
fn display_handle(
&self,
) -> Result<raw_window_handle::DisplayHandle<'_>, raw_window_handle::HandleError> {
unimplemented!("Test Windows are not backed by a real platform window")
}
}
impl TestWindow {
pub fn new(
options: WindowOptions,