mirror of
https://github.com/italicsjenga/winit-sonoma-fix.git
synced 2025-01-23 02:16:33 +11:00
Update to winapi 0.3.5 (#563)
This commit is contained in:
parent
be5a2b0e87
commit
233ac4aed2
3 changed files with 18 additions and 54 deletions
23
Cargo.toml
23
Cargo.toml
|
@ -34,20 +34,21 @@ core-foundation = "0.6"
|
||||||
core-graphics = "0.14"
|
core-graphics = "0.14"
|
||||||
|
|
||||||
[target.'cfg(target_os = "windows")'.dependencies.winapi]
|
[target.'cfg(target_os = "windows")'.dependencies.winapi]
|
||||||
version = "0.3"
|
version = "0.3.5"
|
||||||
features = [
|
features = [
|
||||||
|
"combaseapi",
|
||||||
|
"dwmapi",
|
||||||
|
"hidusage",
|
||||||
|
"libloaderapi",
|
||||||
|
"objbase",
|
||||||
|
"processthreadsapi",
|
||||||
|
"shellapi",
|
||||||
|
"shobjidl_core",
|
||||||
|
"unknwnbase",
|
||||||
|
"windowsx",
|
||||||
|
"wingdi",
|
||||||
"winnt",
|
"winnt",
|
||||||
"winuser",
|
"winuser",
|
||||||
"wingdi",
|
|
||||||
"shellapi",
|
|
||||||
"dwmapi",
|
|
||||||
"processthreadsapi",
|
|
||||||
"libloaderapi",
|
|
||||||
"windowsx",
|
|
||||||
"hidusage",
|
|
||||||
"combaseapi",
|
|
||||||
"objbase",
|
|
||||||
"unknwnbase",
|
|
||||||
]
|
]
|
||||||
|
|
||||||
[target.'cfg(any(target_os = "linux", target_os = "dragonfly", target_os = "freebsd", target_os = "openbsd"))'.dependencies]
|
[target.'cfg(any(target_os = "linux", target_os = "dragonfly", target_os = "freebsd", target_os = "openbsd"))'.dependencies]
|
||||||
|
|
|
@ -87,7 +87,6 @@ extern crate libc;
|
||||||
extern crate image;
|
extern crate image;
|
||||||
|
|
||||||
#[cfg(target_os = "windows")]
|
#[cfg(target_os = "windows")]
|
||||||
#[macro_use]
|
|
||||||
extern crate winapi;
|
extern crate winapi;
|
||||||
#[cfg(any(target_os = "macos", target_os = "ios"))]
|
#[cfg(any(target_os = "macos", target_os = "ios"))]
|
||||||
#[macro_use]
|
#[macro_use]
|
||||||
|
|
|
@ -12,8 +12,8 @@ use winapi::shared::minwindef::{BOOL, DWORD, FALSE, TRUE, UINT};
|
||||||
use winapi::shared::windef::{HDC, HWND, LPPOINT, POINT, RECT};
|
use winapi::shared::windef::{HDC, HWND, LPPOINT, POINT, RECT};
|
||||||
use winapi::um::{combaseapi, dwmapi, libloaderapi, winuser};
|
use winapi::um::{combaseapi, dwmapi, libloaderapi, winuser};
|
||||||
use winapi::um::objbase::{COINIT_MULTITHREADED};
|
use winapi::um::objbase::{COINIT_MULTITHREADED};
|
||||||
use winapi::um::unknwnbase::{IUnknown, IUnknownVtbl};
|
use winapi::um::shobjidl_core::{CLSID_TaskbarList, ITaskbarList2};
|
||||||
use winapi::um::winnt::{HRESULT, LONG, LPCWSTR};
|
use winapi::um::winnt::{LONG, LPCWSTR};
|
||||||
|
|
||||||
use CreationError;
|
use CreationError;
|
||||||
use CursorState;
|
use CursorState;
|
||||||
|
@ -239,7 +239,7 @@ impl Window {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn set_resizable(&self, resizable: bool) {
|
pub fn set_resizable(&self, resizable: bool) {
|
||||||
if let Ok(mut window_state) = self.window_state.lock() {
|
if let Ok(mut window_state) = self.window_state.lock() {
|
||||||
|
@ -1024,49 +1024,13 @@ thread_local!{
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
static TASKBAR_LIST: Cell<*mut taskbar::ITaskbarList2> = Cell::new(ptr::null_mut());
|
static TASKBAR_LIST: Cell<*mut ITaskbarList2> = Cell::new(ptr::null_mut());
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn com_initialized() {
|
pub fn com_initialized() {
|
||||||
COM_INITIALIZED.with(|_| {});
|
COM_INITIALIZED.with(|_| {});
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: remove these when they get added to winapi
|
|
||||||
// https://github.com/retep998/winapi-rs/pull/592
|
|
||||||
#[allow(non_upper_case_globals)]
|
|
||||||
#[allow(non_snake_case)]
|
|
||||||
#[allow(dead_code)]
|
|
||||||
mod taskbar {
|
|
||||||
use super::{IUnknown,IUnknownVtbl,HRESULT, HWND,BOOL};
|
|
||||||
DEFINE_GUID!{CLSID_TaskbarList,
|
|
||||||
0x56fdf344, 0xfd6d, 0x11d0, 0x95, 0x8a, 0x00, 0x60, 0x97, 0xc9, 0xa0, 0x90}
|
|
||||||
|
|
||||||
RIDL!(#[uuid(0x56fdf342, 0xfd6d, 0x11d0, 0x95, 0x8a, 0x00, 0x60, 0x97, 0xc9, 0xa0, 0x90)]
|
|
||||||
interface ITaskbarList(ITaskbarListVtbl): IUnknown(IUnknownVtbl) {
|
|
||||||
fn HrInit() -> HRESULT,
|
|
||||||
fn AddTab(
|
|
||||||
hwnd: HWND,
|
|
||||||
) -> HRESULT,
|
|
||||||
fn DeleteTab(
|
|
||||||
hwnd: HWND,
|
|
||||||
) -> HRESULT,
|
|
||||||
fn ActivateTab(
|
|
||||||
hwnd: HWND,
|
|
||||||
) -> HRESULT,
|
|
||||||
fn SetActiveAlt(
|
|
||||||
hwnd: HWND,
|
|
||||||
) -> HRESULT,
|
|
||||||
});
|
|
||||||
|
|
||||||
RIDL!(#[uuid(0x602d4995, 0xb13a, 0x429b, 0xa6, 0x6e, 0x19, 0x35, 0xe4, 0x4f, 0x43, 0x17)]
|
|
||||||
interface ITaskbarList2(ITaskbarList2Vtbl): ITaskbarList(ITaskbarListVtbl) {
|
|
||||||
fn MarkFullscreenWindow(
|
|
||||||
hwnd: HWND,
|
|
||||||
fFullscreen: BOOL,
|
|
||||||
) -> HRESULT,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
// Reference Implementation:
|
// Reference Implementation:
|
||||||
// https://github.com/chromium/chromium/blob/f18e79d901f56154f80eea1e2218544285e62623/ui/views/win/fullscreen_handler.cc
|
// https://github.com/chromium/chromium/blob/f18e79d901f56154f80eea1e2218544285e62623/ui/views/win/fullscreen_handler.cc
|
||||||
//
|
//
|
||||||
|
@ -1086,10 +1050,10 @@ unsafe fn mark_fullscreen(handle: HWND, fullscreen: bool) {
|
||||||
use winapi::Interface;
|
use winapi::Interface;
|
||||||
|
|
||||||
let hr = combaseapi::CoCreateInstance(
|
let hr = combaseapi::CoCreateInstance(
|
||||||
&taskbar::CLSID_TaskbarList,
|
&CLSID_TaskbarList,
|
||||||
ptr::null_mut(),
|
ptr::null_mut(),
|
||||||
combaseapi::CLSCTX_ALL,
|
combaseapi::CLSCTX_ALL,
|
||||||
&taskbar::ITaskbarList2::uuidof(),
|
&ITaskbarList2::uuidof(),
|
||||||
&mut task_bar_list as *mut _ as *mut _,
|
&mut task_bar_list as *mut _ as *mut _,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue