Add Window::is_minimized

Co-authored-by: Kirill Chibisov <contact@kchibisov.com>
Co-authored-by: Markus Siglreithmaier <m.siglreith@gmail.com>
This commit is contained in:
Amr Bashir 2023-01-19 23:39:04 +02:00 committed by GitHub
parent de782504ab
commit 809162fbd0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
12 changed files with 83 additions and 11 deletions

View file

@ -24,9 +24,10 @@ use windows_sys::{
Input::KeyboardAndMouse::GetActiveWindow,
WindowsAndMessaging::{
ClipCursor, GetClientRect, GetClipCursor, GetSystemMetrics, GetWindowRect,
ShowCursor, IDC_APPSTARTING, IDC_ARROW, IDC_CROSS, IDC_HAND, IDC_HELP, IDC_IBEAM,
IDC_NO, IDC_SIZEALL, IDC_SIZENESW, IDC_SIZENS, IDC_SIZENWSE, IDC_SIZEWE, IDC_WAIT,
SM_CXVIRTUALSCREEN, SM_CYVIRTUALSCREEN, SM_XVIRTUALSCREEN, SM_YVIRTUALSCREEN,
IsIconic, ShowCursor, IDC_APPSTARTING, IDC_ARROW, IDC_CROSS, IDC_HAND, IDC_HELP,
IDC_IBEAM, IDC_NO, IDC_SIZEALL, IDC_SIZENESW, IDC_SIZENS, IDC_SIZENWSE, IDC_SIZEWE,
IDC_WAIT, SM_CXVIRTUALSCREEN, SM_CYVIRTUALSCREEN, SM_XVIRTUALSCREEN,
SM_YVIRTUALSCREEN,
},
},
},
@ -135,6 +136,10 @@ pub fn is_focused(window: HWND) -> bool {
window == unsafe { GetActiveWindow() }
}
pub fn is_minimized(window: HWND) -> bool {
unsafe { IsIconic(window) != false.into() }
}
pub fn get_instance_handle() -> HINSTANCE {
// Gets the instance handle by taking the address of the
// pseudo-variable created by the microsoft linker: