mirror of
https://github.com/LGUG2Z/komorebi.git
synced 2026-04-24 17:48:34 +02:00
chore(deps): bump windows-rs from 0.58 to 0.59
This commit is contained in:
18
Cargo.lock
generated
18
Cargo.lock
generated
@@ -2690,10 +2690,10 @@ dependencies = [
|
|||||||
"uds_windows",
|
"uds_windows",
|
||||||
"which",
|
"which",
|
||||||
"win32-display-data",
|
"win32-display-data",
|
||||||
"windows 0.58.0",
|
"windows 0.59.0",
|
||||||
"windows-core 0.58.0",
|
"windows-core 0.59.0",
|
||||||
"windows-implement 0.58.0",
|
"windows-implement 0.59.0",
|
||||||
"windows-interface 0.58.0",
|
"windows-interface 0.59.0",
|
||||||
"winput",
|
"winput",
|
||||||
"winreg",
|
"winreg",
|
||||||
]
|
]
|
||||||
@@ -2728,7 +2728,7 @@ dependencies = [
|
|||||||
"sysinfo",
|
"sysinfo",
|
||||||
"tracing",
|
"tracing",
|
||||||
"tracing-subscriber",
|
"tracing-subscriber",
|
||||||
"windows 0.58.0",
|
"windows 0.59.0",
|
||||||
"windows-icons",
|
"windows-icons",
|
||||||
]
|
]
|
||||||
|
|
||||||
@@ -2750,7 +2750,7 @@ dependencies = [
|
|||||||
"komorebi-client",
|
"komorebi-client",
|
||||||
"random_word",
|
"random_word",
|
||||||
"serde_json_lenient",
|
"serde_json_lenient",
|
||||||
"windows 0.58.0",
|
"windows 0.59.0",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -2789,7 +2789,7 @@ dependencies = [
|
|||||||
"sysinfo",
|
"sysinfo",
|
||||||
"thiserror 2.0.11",
|
"thiserror 2.0.11",
|
||||||
"which",
|
"which",
|
||||||
"windows 0.58.0",
|
"windows 0.59.0",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -5926,12 +5926,12 @@ dependencies = [
|
|||||||
[[package]]
|
[[package]]
|
||||||
name = "win32-display-data"
|
name = "win32-display-data"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
source = "git+https://github.com/LGUG2Z/win32-display-data?rev=3ff53fb6f53ec3ec4f9941a0409fba5e36decc46#3ff53fb6f53ec3ec4f9941a0409fba5e36decc46"
|
source = "git+https://github.com/LGUG2Z/win32-display-data?rev=14406d46a94d4e29ffe8a789539e453fa15cf3d3#14406d46a94d4e29ffe8a789539e453fa15cf3d3"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"itertools",
|
"itertools",
|
||||||
"serde",
|
"serde",
|
||||||
"thiserror 1.0.69",
|
"thiserror 1.0.69",
|
||||||
"windows 0.58.0",
|
"windows 0.59.0",
|
||||||
"wmi",
|
"wmi",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|||||||
12
Cargo.toml
12
Cargo.toml
@@ -33,19 +33,19 @@ tracing-subscriber = { version = "0.3", features = ["env-filter"] }
|
|||||||
paste = "1"
|
paste = "1"
|
||||||
sysinfo = "0.33"
|
sysinfo = "0.33"
|
||||||
uds_windows = "1"
|
uds_windows = "1"
|
||||||
win32-display-data = { git = "https://github.com/LGUG2Z/win32-display-data", rev = "3ff53fb6f53ec3ec4f9941a0409fba5e36decc46" }
|
win32-display-data = { git = "https://github.com/LGUG2Z/win32-display-data", rev = "14406d46a94d4e29ffe8a789539e453fa15cf3d3" }
|
||||||
windows-implement = { version = "0.58" }
|
windows-implement = { version = "0.59" }
|
||||||
windows-interface = { version = "0.58" }
|
windows-interface = { version = "0.59" }
|
||||||
windows-core = { version = "0.58" }
|
windows-core = { version = "0.59" }
|
||||||
shadow-rs = "0.38"
|
shadow-rs = "0.38"
|
||||||
which = "7"
|
which = "7"
|
||||||
|
|
||||||
[workspace.dependencies.windows]
|
[workspace.dependencies.windows]
|
||||||
version = "0.58"
|
version = "0.59"
|
||||||
features = [
|
features = [
|
||||||
"implement",
|
|
||||||
"Foundation_Numerics",
|
"Foundation_Numerics",
|
||||||
"Win32_Devices",
|
"Win32_Devices",
|
||||||
|
"Win32_Devices_Display",
|
||||||
"Win32_System_Com",
|
"Win32_System_Com",
|
||||||
"Win32_UI_Shell_Common", # for IObjectArray
|
"Win32_UI_Shell_Common", # for IObjectArray
|
||||||
"Win32_Foundation",
|
"Win32_Foundation",
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
use crate::border_manager::window_kind_colour;
|
use crate::border_manager::window_kind_colour;
|
||||||
|
use crate::border_manager::RenderTarget;
|
||||||
use crate::border_manager::WindowKind;
|
use crate::border_manager::WindowKind;
|
||||||
use crate::border_manager::BORDER_OFFSET;
|
use crate::border_manager::BORDER_OFFSET;
|
||||||
use crate::border_manager::BORDER_WIDTH;
|
use crate::border_manager::BORDER_WIDTH;
|
||||||
@@ -32,7 +33,6 @@ use windows::Win32::Graphics::Direct2D::Common::D2D_RECT_F;
|
|||||||
use windows::Win32::Graphics::Direct2D::Common::D2D_SIZE_U;
|
use windows::Win32::Graphics::Direct2D::Common::D2D_SIZE_U;
|
||||||
use windows::Win32::Graphics::Direct2D::D2D1CreateFactory;
|
use windows::Win32::Graphics::Direct2D::D2D1CreateFactory;
|
||||||
use windows::Win32::Graphics::Direct2D::ID2D1Factory;
|
use windows::Win32::Graphics::Direct2D::ID2D1Factory;
|
||||||
use windows::Win32::Graphics::Direct2D::ID2D1HwndRenderTarget;
|
|
||||||
use windows::Win32::Graphics::Direct2D::ID2D1SolidColorBrush;
|
use windows::Win32::Graphics::Direct2D::ID2D1SolidColorBrush;
|
||||||
use windows::Win32::Graphics::Direct2D::D2D1_ANTIALIAS_MODE_PER_PRIMITIVE;
|
use windows::Win32::Graphics::Direct2D::D2D1_ANTIALIAS_MODE_PER_PRIMITIVE;
|
||||||
use windows::Win32::Graphics::Direct2D::D2D1_BRUSH_PROPERTIES;
|
use windows::Win32::Graphics::Direct2D::D2D1_BRUSH_PROPERTIES;
|
||||||
@@ -70,11 +70,25 @@ use windows::Win32::UI::WindowsAndMessaging::WM_PAINT;
|
|||||||
use windows::Win32::UI::WindowsAndMessaging::WNDCLASSW;
|
use windows::Win32::UI::WindowsAndMessaging::WNDCLASSW;
|
||||||
use windows_core::PCWSTR;
|
use windows_core::PCWSTR;
|
||||||
|
|
||||||
|
pub struct RenderFactory(ID2D1Factory);
|
||||||
|
unsafe impl Sync for RenderFactory {}
|
||||||
|
unsafe impl Send for RenderFactory {}
|
||||||
|
|
||||||
|
impl Deref for RenderFactory {
|
||||||
|
type Target = ID2D1Factory;
|
||||||
|
|
||||||
|
fn deref(&self) -> &Self::Target {
|
||||||
|
&self.0
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#[allow(clippy::expect_used)]
|
#[allow(clippy::expect_used)]
|
||||||
static RENDER_FACTORY: LazyLock<ID2D1Factory> = unsafe {
|
static RENDER_FACTORY: LazyLock<RenderFactory> = unsafe {
|
||||||
LazyLock::new(|| {
|
LazyLock::new(|| {
|
||||||
D2D1CreateFactory::<ID2D1Factory>(D2D1_FACTORY_TYPE_MULTI_THREADED, None)
|
RenderFactory(
|
||||||
.expect("creating RENDER_FACTORY failed")
|
D2D1CreateFactory::<ID2D1Factory>(D2D1_FACTORY_TYPE_MULTI_THREADED, None)
|
||||||
|
.expect("creating RENDER_FACTORY failed"),
|
||||||
|
)
|
||||||
})
|
})
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -100,7 +114,7 @@ pub extern "system" fn border_hwnds(hwnd: HWND, lparam: LPARAM) -> BOOL {
|
|||||||
#[derive(Debug, Clone)]
|
#[derive(Debug, Clone)]
|
||||||
pub struct Border {
|
pub struct Border {
|
||||||
pub hwnd: isize,
|
pub hwnd: isize,
|
||||||
pub render_target: OnceLock<ID2D1HwndRenderTarget>,
|
pub render_target: OnceLock<RenderTarget>,
|
||||||
pub tracking_hwnd: isize,
|
pub tracking_hwnd: isize,
|
||||||
pub window_rect: Rect,
|
pub window_rect: Rect,
|
||||||
pub window_kind: WindowKind,
|
pub window_kind: WindowKind,
|
||||||
@@ -180,7 +194,7 @@ impl Border {
|
|||||||
|
|
||||||
loop {
|
loop {
|
||||||
unsafe {
|
unsafe {
|
||||||
if !GetMessageW(&mut msg, HWND::default(), 0, 0).as_bool() {
|
if !GetMessageW(&mut msg, None, 0, 0).as_bool() {
|
||||||
tracing::debug!("border window event processing thread shutdown");
|
tracing::debug!("border window event processing thread shutdown");
|
||||||
break;
|
break;
|
||||||
};
|
};
|
||||||
@@ -261,7 +275,11 @@ impl Border {
|
|||||||
|
|
||||||
render_target.SetAntialiasMode(D2D1_ANTIALIAS_MODE_PER_PRIMITIVE);
|
render_target.SetAntialiasMode(D2D1_ANTIALIAS_MODE_PER_PRIMITIVE);
|
||||||
|
|
||||||
if border.render_target.set(render_target.clone()).is_err() {
|
if border
|
||||||
|
.render_target
|
||||||
|
.set(RenderTarget(render_target.clone()))
|
||||||
|
.is_err()
|
||||||
|
{
|
||||||
return Err(anyhow!("could not store border render target"));
|
return Err(anyhow!("could not store border render target"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -275,7 +293,7 @@ impl Border {
|
|||||||
};
|
};
|
||||||
|
|
||||||
let mut render_targets = RENDER_TARGETS.lock();
|
let mut render_targets = RENDER_TARGETS.lock();
|
||||||
render_targets.insert(border.hwnd, render_target);
|
render_targets.insert(border.hwnd, RenderTarget(render_target));
|
||||||
Ok(border.clone())
|
Ok(border.clone())
|
||||||
},
|
},
|
||||||
Err(error) => Err(error.into()),
|
Err(error) => Err(error.into()),
|
||||||
@@ -300,7 +318,7 @@ impl Border {
|
|||||||
|
|
||||||
// this triggers WM_PAINT in the callback below
|
// this triggers WM_PAINT in the callback below
|
||||||
pub fn invalidate(&self) {
|
pub fn invalidate(&self) {
|
||||||
let _ = unsafe { InvalidateRect(self.hwnd(), None, false) };
|
let _ = unsafe { InvalidateRect(Option::from(self.hwnd()), None, false) };
|
||||||
}
|
}
|
||||||
|
|
||||||
pub extern "system" fn callback(
|
pub extern "system" fn callback(
|
||||||
@@ -508,7 +526,7 @@ impl Border {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
let _ = ValidateRect(window, None);
|
let _ = ValidateRect(Option::from(window), None);
|
||||||
LRESULT(0)
|
LRESULT(0)
|
||||||
}
|
}
|
||||||
WM_DESTROY => {
|
WM_DESTROY => {
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ use serde::Deserialize;
|
|||||||
use serde::Serialize;
|
use serde::Serialize;
|
||||||
use std::collections::hash_map::Entry;
|
use std::collections::hash_map::Entry;
|
||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
|
use std::ops::Deref;
|
||||||
use std::sync::atomic::AtomicBool;
|
use std::sync::atomic::AtomicBool;
|
||||||
use std::sync::atomic::AtomicI32;
|
use std::sync::atomic::AtomicI32;
|
||||||
use std::sync::atomic::AtomicU32;
|
use std::sync::atomic::AtomicU32;
|
||||||
@@ -57,8 +58,19 @@ lazy_static! {
|
|||||||
static ref BORDER_STATE: Mutex<HashMap<String, Border>> = Mutex::new(HashMap::new());
|
static ref BORDER_STATE: Mutex<HashMap<String, Border>> = Mutex::new(HashMap::new());
|
||||||
static ref WINDOWS_BORDERS: Mutex<HashMap<isize, Border>> = Mutex::new(HashMap::new());
|
static ref WINDOWS_BORDERS: Mutex<HashMap<isize, Border>> = Mutex::new(HashMap::new());
|
||||||
static ref FOCUS_STATE: Mutex<HashMap<isize, WindowKind>> = Mutex::new(HashMap::new());
|
static ref FOCUS_STATE: Mutex<HashMap<isize, WindowKind>> = Mutex::new(HashMap::new());
|
||||||
static ref RENDER_TARGETS: Mutex<HashMap<isize, ID2D1HwndRenderTarget>> =
|
static ref RENDER_TARGETS: Mutex<HashMap<isize, RenderTarget>> = Mutex::new(HashMap::new());
|
||||||
Mutex::new(HashMap::new());
|
}
|
||||||
|
|
||||||
|
#[derive(Debug, Clone)]
|
||||||
|
pub struct RenderTarget(pub ID2D1HwndRenderTarget);
|
||||||
|
unsafe impl Send for RenderTarget {}
|
||||||
|
|
||||||
|
impl Deref for RenderTarget {
|
||||||
|
type Target = ID2D1HwndRenderTarget;
|
||||||
|
|
||||||
|
fn deref(&self) -> &Self::Target {
|
||||||
|
&self.0
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub struct Notification(pub Option<isize>);
|
pub struct Notification(pub Option<isize>);
|
||||||
|
|||||||
@@ -87,7 +87,7 @@ impl Hidden {
|
|||||||
|
|
||||||
loop {
|
loop {
|
||||||
unsafe {
|
unsafe {
|
||||||
if !GetMessageW(&mut msg, HWND::default(), 0, 0).as_bool() {
|
if !GetMessageW(&mut msg, None, 0, 0).as_bool() {
|
||||||
tracing::debug!("hidden window event processing thread shutdown");
|
tracing::debug!("hidden window event processing thread shutdown");
|
||||||
break;
|
break;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -123,7 +123,7 @@ impl Stackbar {
|
|||||||
0,
|
0,
|
||||||
None,
|
None,
|
||||||
None,
|
None,
|
||||||
HINSTANCE(windows_api::as_ptr!(instance)),
|
Option::from(HINSTANCE(windows_api::as_ptr!(instance))),
|
||||||
None,
|
None,
|
||||||
)?;
|
)?;
|
||||||
|
|
||||||
@@ -133,7 +133,7 @@ impl Stackbar {
|
|||||||
let mut msg: MSG = MSG::default();
|
let mut msg: MSG = MSG::default();
|
||||||
|
|
||||||
loop {
|
loop {
|
||||||
if !GetMessageW(&mut msg, HWND::default(), 0, 0).as_bool() {
|
if !GetMessageW(&mut msg, None, 0, 0).as_bool() {
|
||||||
tracing::debug!("stackbar window event processing thread shutdown");
|
tracing::debug!("stackbar window event processing thread shutdown");
|
||||||
break;
|
break;
|
||||||
};
|
};
|
||||||
@@ -183,13 +183,13 @@ impl Stackbar {
|
|||||||
WindowsApi::position_window(self.hwnd, &layout, false)?;
|
WindowsApi::position_window(self.hwnd, &layout, false)?;
|
||||||
|
|
||||||
unsafe {
|
unsafe {
|
||||||
let hdc = GetDC(self.hwnd());
|
let hdc = GetDC(Option::from(self.hwnd()));
|
||||||
|
|
||||||
let hpen = CreatePen(PS_SOLID, 0, COLORREF(background));
|
let hpen = CreatePen(PS_SOLID, 0, COLORREF(background));
|
||||||
let hbrush = CreateSolidBrush(COLORREF(background));
|
let hbrush = CreateSolidBrush(COLORREF(background));
|
||||||
|
|
||||||
SelectObject(hdc, hpen);
|
SelectObject(hdc, hpen.into());
|
||||||
SelectObject(hdc, hbrush);
|
SelectObject(hdc, hbrush.into());
|
||||||
SetBkColor(hdc, COLORREF(background));
|
SetBkColor(hdc, COLORREF(background));
|
||||||
|
|
||||||
let mut logfont = LOGFONTW {
|
let mut logfont = LOGFONTW {
|
||||||
@@ -209,14 +209,14 @@ impl Stackbar {
|
|||||||
let logical_height = -MulDiv(
|
let logical_height = -MulDiv(
|
||||||
STACKBAR_FONT_SIZE.load(Ordering::SeqCst),
|
STACKBAR_FONT_SIZE.load(Ordering::SeqCst),
|
||||||
72,
|
72,
|
||||||
GetDeviceCaps(hdc, LOGPIXELSY),
|
GetDeviceCaps(Option::from(hdc), LOGPIXELSY),
|
||||||
);
|
);
|
||||||
|
|
||||||
logfont.lfHeight = logical_height;
|
logfont.lfHeight = logical_height;
|
||||||
|
|
||||||
let hfont = CreateFontIndirectW(&logfont);
|
let hfont = CreateFontIndirectW(&logfont);
|
||||||
|
|
||||||
SelectObject(hdc, hfont);
|
SelectObject(hdc, hfont.into());
|
||||||
|
|
||||||
for (i, window) in container.windows().iter().enumerate() {
|
for (i, window) in container.windows().iter().enumerate() {
|
||||||
if window.hwnd == container.focused_window().copied().unwrap_or_default().hwnd {
|
if window.hwnd == container.focused_window().copied().unwrap_or_default().hwnd {
|
||||||
@@ -283,13 +283,13 @@ impl Stackbar {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
ReleaseDC(self.hwnd(), hdc);
|
ReleaseDC(Option::from(self.hwnd()), hdc);
|
||||||
// TODO: error handling
|
// TODO: error handling
|
||||||
let _ = DeleteObject(hpen);
|
let _ = DeleteObject(hpen.into());
|
||||||
// TODO: error handling
|
// TODO: error handling
|
||||||
let _ = DeleteObject(hbrush);
|
let _ = DeleteObject(hbrush.into());
|
||||||
// TODO: error handling
|
// TODO: error handling
|
||||||
let _ = DeleteObject(hfont);
|
let _ = DeleteObject(hfont.into());
|
||||||
}
|
}
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
|
use core::ffi::c_void;
|
||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
use std::collections::VecDeque;
|
use std::collections::VecDeque;
|
||||||
use std::convert::TryFrom;
|
use std::convert::TryFrom;
|
||||||
use std::ffi::c_void;
|
|
||||||
use std::mem::size_of;
|
use std::mem::size_of;
|
||||||
|
|
||||||
use color_eyre::eyre::anyhow;
|
use color_eyre::eyre::anyhow;
|
||||||
@@ -236,16 +236,9 @@ impl WindowsApi {
|
|||||||
callback: MONITORENUMPROC,
|
callback: MONITORENUMPROC,
|
||||||
callback_data_address: isize,
|
callback_data_address: isize,
|
||||||
) -> Result<()> {
|
) -> Result<()> {
|
||||||
unsafe {
|
unsafe { EnumDisplayMonitors(None, None, callback, LPARAM(callback_data_address)) }
|
||||||
EnumDisplayMonitors(
|
.ok()
|
||||||
HDC(std::ptr::null_mut()),
|
.process()
|
||||||
None,
|
|
||||||
callback,
|
|
||||||
LPARAM(callback_data_address),
|
|
||||||
)
|
|
||||||
}
|
|
||||||
.ok()
|
|
||||||
.process()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn valid_hmonitors() -> Result<Vec<(String, isize)>> {
|
pub fn valid_hmonitors() -> Result<Vec<(String, isize)>> {
|
||||||
@@ -519,7 +512,7 @@ impl WindowsApi {
|
|||||||
unsafe {
|
unsafe {
|
||||||
SetWindowPos(
|
SetWindowPos(
|
||||||
hwnd,
|
hwnd,
|
||||||
position,
|
Option::from(position),
|
||||||
layout.left,
|
layout.left,
|
||||||
layout.top,
|
layout.top,
|
||||||
layout.right,
|
layout.right,
|
||||||
@@ -557,7 +550,7 @@ impl WindowsApi {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn post_message(hwnd: HWND, message: u32, wparam: WPARAM, lparam: LPARAM) -> Result<()> {
|
fn post_message(hwnd: HWND, message: u32, wparam: WPARAM, lparam: LPARAM) -> Result<()> {
|
||||||
unsafe { PostMessageW(hwnd, message, wparam, lparam) }.process()
|
unsafe { PostMessageW(Option::from(hwnd), message, wparam, lparam) }.process()
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn close_window(hwnd: isize) -> Result<()> {
|
pub fn close_window(hwnd: isize) -> Result<()> {
|
||||||
@@ -600,7 +593,7 @@ impl WindowsApi {
|
|||||||
// Error ignored, as the operation is not always necessary.
|
// Error ignored, as the operation is not always necessary.
|
||||||
let _ = SetWindowPos(
|
let _ = SetWindowPos(
|
||||||
HWND(as_ptr!(hwnd)),
|
HWND(as_ptr!(hwnd)),
|
||||||
HWND_TOP,
|
Option::from(HWND_TOP),
|
||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
@@ -616,7 +609,7 @@ impl WindowsApi {
|
|||||||
|
|
||||||
#[allow(dead_code)]
|
#[allow(dead_code)]
|
||||||
pub fn top_window() -> Result<isize> {
|
pub fn top_window() -> Result<isize> {
|
||||||
unsafe { GetTopWindow(HWND::default())? }.process()
|
unsafe { GetTopWindow(None)? }.process()
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn desktop_window() -> Result<isize> {
|
pub fn desktop_window() -> Result<isize> {
|
||||||
@@ -932,7 +925,7 @@ impl WindowsApi {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub fn is_window(hwnd: isize) -> bool {
|
pub fn is_window(hwnd: isize) -> bool {
|
||||||
unsafe { IsWindow(HWND(as_ptr!(hwnd))) }.into()
|
unsafe { IsWindow(Option::from(HWND(as_ptr!(hwnd)))) }.into()
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn is_window_visible(hwnd: isize) -> bool {
|
pub fn is_window_visible(hwnd: isize) -> bool {
|
||||||
@@ -1160,7 +1153,7 @@ impl WindowsApi {
|
|||||||
CW_USEDEFAULT,
|
CW_USEDEFAULT,
|
||||||
None,
|
None,
|
||||||
None,
|
None,
|
||||||
HINSTANCE(as_ptr!(instance)),
|
Option::from(HINSTANCE(as_ptr!(instance))),
|
||||||
Some(border as _),
|
Some(border as _),
|
||||||
)?
|
)?
|
||||||
}
|
}
|
||||||
@@ -1209,7 +1202,7 @@ impl WindowsApi {
|
|||||||
CW_USEDEFAULT,
|
CW_USEDEFAULT,
|
||||||
None,
|
None,
|
||||||
None,
|
None,
|
||||||
HINSTANCE(as_ptr!(instance)),
|
Option::from(HINSTANCE(as_ptr!(instance))),
|
||||||
None,
|
None,
|
||||||
)?
|
)?
|
||||||
}
|
}
|
||||||
@@ -1221,7 +1214,7 @@ impl WindowsApi {
|
|||||||
guid: &windows_core::GUID,
|
guid: &windows_core::GUID,
|
||||||
flags: REGISTER_NOTIFICATION_FLAGS,
|
flags: REGISTER_NOTIFICATION_FLAGS,
|
||||||
) -> WindowsCrateResult<HPOWERNOTIFY> {
|
) -> WindowsCrateResult<HPOWERNOTIFY> {
|
||||||
unsafe { RegisterPowerSettingNotification(HWND(as_ptr!(hwnd)), guid, flags) }
|
unsafe { RegisterPowerSettingNotification(HANDLE::from(HWND(as_ptr!(hwnd))), guid, flags) }
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn register_device_notification(
|
pub fn register_device_notification(
|
||||||
@@ -1230,15 +1223,14 @@ impl WindowsApi {
|
|||||||
flags: REGISTER_NOTIFICATION_FLAGS,
|
flags: REGISTER_NOTIFICATION_FLAGS,
|
||||||
) -> WindowsCrateResult<HDEVNOTIFY> {
|
) -> WindowsCrateResult<HDEVNOTIFY> {
|
||||||
unsafe {
|
unsafe {
|
||||||
let state_ptr: *const core::ffi::c_void =
|
let state_ptr: *const c_void = &mut filter as *mut _ as *const c_void;
|
||||||
&mut filter as *mut _ as *const core::ffi::c_void;
|
RegisterDeviceNotificationW(HANDLE::from(HWND(as_ptr!(hwnd))), state_ptr, flags)
|
||||||
RegisterDeviceNotificationW(HWND(as_ptr!(hwnd)), state_ptr, flags)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn invalidate_rect(hwnd: isize, rect: Option<&Rect>, erase: bool) -> bool {
|
pub fn invalidate_rect(hwnd: isize, rect: Option<&Rect>, erase: bool) -> bool {
|
||||||
let rect = rect.map(|rect| &rect.rect() as *const RECT);
|
let rect = rect.map(|rect| &rect.rect() as *const RECT);
|
||||||
unsafe { InvalidateRect(HWND(as_ptr!(hwnd)), rect, erase) }.as_bool()
|
unsafe { InvalidateRect(Option::from(HWND(as_ptr!(hwnd))), rect, erase) }.as_bool()
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn alt_is_pressed() -> bool {
|
pub fn alt_is_pressed() -> bool {
|
||||||
|
|||||||
@@ -3,7 +3,6 @@ use std::time::Duration;
|
|||||||
|
|
||||||
use crossbeam_channel::Receiver;
|
use crossbeam_channel::Receiver;
|
||||||
use crossbeam_channel::Sender;
|
use crossbeam_channel::Sender;
|
||||||
use windows::Win32::Foundation::HWND;
|
|
||||||
use windows::Win32::UI::Accessibility::SetWinEventHook;
|
use windows::Win32::UI::Accessibility::SetWinEventHook;
|
||||||
use windows::Win32::UI::WindowsAndMessaging::DispatchMessageW;
|
use windows::Win32::UI::WindowsAndMessaging::DispatchMessageW;
|
||||||
use windows::Win32::UI::WindowsAndMessaging::GetMessageW;
|
use windows::Win32::UI::WindowsAndMessaging::GetMessageW;
|
||||||
@@ -41,7 +40,7 @@ pub fn start() {
|
|||||||
|
|
||||||
loop {
|
loop {
|
||||||
unsafe {
|
unsafe {
|
||||||
if !GetMessageW(&mut msg, HWND(std::ptr::null_mut()), 0, 0).as_bool() {
|
if !GetMessageW(&mut msg, None, 0, 0).as_bool() {
|
||||||
tracing::debug!("windows event processing thread shutdown");
|
tracing::debug!("windows event processing thread shutdown");
|
||||||
break;
|
break;
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user