From e0536e9e0b5f8c2dbd3c5abeda89b9b914c1c5a3 Mon Sep 17 00:00:00 2001 From: Jackson Goode Date: Sun, 1 Sep 2024 01:07:48 -0700 Subject: [PATCH] Fix win? --- psst-gui/src/controller/playback.rs | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/psst-gui/src/controller/playback.rs b/psst-gui/src/controller/playback.rs index 79b8b811..78e5a073 100644 --- a/psst-gui/src/controller/playback.rs +++ b/psst-gui/src/controller/playback.rs @@ -128,12 +128,14 @@ impl PlaybackController { let hwnd = { #[cfg(target_os = "windows")] { - use raw_window_handle::{HasRawWindowHandle, RawWindowHandle}; - let handle = match window.raw_window_handle() { - RawWindowHandle::Win32(h) => h, - _ => unreachable!(), - }; - Some(handle.hwnd) + use raw_window_handle::{HasWindowHandle, RawWindowHandle}; + let handle = window + .window_handle() + .map_err(|_| souvlaki::Error::Other("Failed to get window handle".into()))?; + match handle.as_raw() { + RawWindowHandle::Win32(h) => Some(h.hwnd.get() as *mut std::ffi::c_void), + _ => None, + } } #[cfg(not(target_os = "windows"))] None