diff --git a/src/stremio_app/stremio_wevbiew/wevbiew.rs b/src/stremio_app/stremio_wevbiew/wevbiew.rs index 8cad632..af06d47 100644 --- a/src/stremio_app/stremio_wevbiew/wevbiew.rs +++ b/src/stremio_app/stremio_wevbiew/wevbiew.rs @@ -12,7 +12,7 @@ use std::sync::{Arc, Mutex}; use std::thread; use urlencoding::decode; use webview2::Controller; -use winapi::shared::windef::HWND__; +use winapi::shared::windef::HWND; use winapi::um::winuser::*; #[derive(Default)] @@ -28,7 +28,7 @@ pub struct WebView { impl WebView { fn resize_to_window_bounds_and_show( controller: Option<&Controller>, - hwnd: Option<*mut HWND__>, + hwnd: Option, ) { if let (Some(controller), Some(hwnd)) = (controller, hwnd) { unsafe { @@ -56,14 +56,13 @@ impl PartialUi for WebView { let parent = parent.expect("No parent window").into(); - let hwnd = parent.hwnd().expect("Cannot obtain window handle") as i64; + let hwnd = parent.hwnd().expect("Cannot obtain window handle"); nwg::Notice::builder() .parent(parent) .build(&mut data.notice) .ok(); let controller_clone = data.controller.clone(); let endpoint = data.endpoint.clone(); - let hwnd = hwnd as *mut HWND__; let result = webview2::EnvironmentBuilder::new() .with_additional_browser_arguments("--disable-gpu --autoplay-policy=no-user-gesture-required") .build(move |env| { diff --git a/src/stremio_app/window_helper.rs b/src/stremio_app/window_helper.rs index ca5c824..47b734d 100644 --- a/src/stremio_app/window_helper.rs +++ b/src/stremio_app/window_helper.rs @@ -1,5 +1,5 @@ use std::{cmp, mem}; -use winapi::shared::windef::HWND__; +use winapi::shared::windef::HWND; use winapi::um::winuser::{ GetForegroundWindow, GetSystemMetrics, GetWindowLongA, GetWindowRect, IsIconic, IsZoomed, SetWindowLongA, SetWindowPos, GWL_EXSTYLE, GWL_STYLE, HWND_NOTOPMOST, HWND_TOPMOST, @@ -27,7 +27,7 @@ pub struct WindowStyle { } impl WindowStyle { - pub fn get_window_state(self, hwnd: *mut HWND__) -> u32 { + pub fn get_window_state(self, hwnd: HWND) -> u32 { let mut state: WindowState = WindowState::empty(); if 0 != unsafe { IsIconic(hwnd) } { state |= WindowState::MINIMIZED; @@ -43,7 +43,7 @@ impl WindowStyle { } state.bits() as u32 } - pub fn show_window_at(&self, hwnd: *mut HWND__, pos: *mut HWND__) { + pub fn show_window_at(&self, hwnd: HWND, pos: HWND) { unsafe { SetWindowPos( hwnd, @@ -56,7 +56,7 @@ impl WindowStyle { ); } } - pub fn center_window(&mut self, hwnd: *mut HWND__, min_width: i32, min_height: i32) { + pub fn center_window(&mut self, hwnd: HWND, min_width: i32, min_height: i32) { let monitor_w = unsafe { GetSystemMetrics(SM_CXSCREEN) }; let monitor_h = unsafe { GetSystemMetrics(SM_CYSCREEN) }; let small_side = cmp::min(monitor_w, monitor_h) * 70 / 100; @@ -67,7 +67,7 @@ impl WindowStyle { self.pos = ((monitor_w - self.size.0) / 2, (monitor_h - self.size.1) / 2); self.show_window_at(hwnd, HWND_NOTOPMOST); } - pub fn toggle_full_screen(&mut self, hwnd: *mut HWND__) { + pub fn toggle_full_screen(&mut self, hwnd: HWND) { if self.full_screen { let topmost = if self.ex_style as u32 & WS_EX_TOPMOST == WS_EX_TOPMOST { HWND_TOPMOST @@ -115,7 +115,7 @@ impl WindowStyle { self.full_screen = true; } } - pub fn toggle_topmost(&mut self, hwnd: *mut HWND__) { + pub fn toggle_topmost(&mut self, hwnd: HWND) { let topmost = if unsafe { GetWindowLongA(hwnd, GWL_EXSTYLE) } as u32 & WS_EX_TOPMOST == WS_EX_TOPMOST {