chore(deps): bump windows-rs from 0.58 to 0.60

This commit is contained in:
LGUG2Z
2025-02-20 21:09:05 -08:00
parent 30c22f51c9
commit 8bc04f0610
15 changed files with 212 additions and 113 deletions
Generated
+125 -51
View File
@@ -268,9 +268,9 @@ dependencies = [
[[package]] [[package]]
name = "anyhow" name = "anyhow"
version = "1.0.95" version = "1.0.96"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "34ac096ce696dc2fcabef30516bb13c0a68a11d30131d3df6f04711467681b04" checksum = "6b964d184e89d9b6b67dd2715bc8e74cf3107fb2b529990c90cf517326150bf4"
[[package]] [[package]]
name = "arbitrary" name = "arbitrary"
@@ -788,9 +788,9 @@ dependencies = [
[[package]] [[package]]
name = "cc" name = "cc"
version = "1.2.14" version = "1.2.15"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0c3d1b2e905a3a7b00a6141adb0e4c0bb941d11caf55349d863942a1cc44e3c9" checksum = "c736e259eea577f443d5c86c304f9f4ae0295c43f3ba05c21f1d66b5f06001af"
dependencies = [ dependencies = [
"jobserver", "jobserver",
"libc", "libc",
@@ -1588,7 +1588,7 @@ dependencies = [
"bit_field", "bit_field",
"half", "half",
"lebe", "lebe",
"miniz_oxide 0.8.4", "miniz_oxide 0.8.5",
"rayon-core", "rayon-core",
"smallvec", "smallvec",
"zune-inflate", "zune-inflate",
@@ -1653,7 +1653,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c936bfdafb507ebbf50b8074c54fa31c5be9a1e7e5f467dd659697041407d07c" checksum = "c936bfdafb507ebbf50b8074c54fa31c5be9a1e7e5f467dd659697041407d07c"
dependencies = [ dependencies = [
"crc32fast", "crc32fast",
"miniz_oxide 0.8.4", "miniz_oxide 0.8.5",
] ]
[[package]] [[package]]
@@ -2582,6 +2582,15 @@ dependencies = [
"either", "either",
] ]
[[package]]
name = "itertools"
version = "0.14.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2b192c782037fadd9cfa75548310488aabdbf3d2da73885b31bd0abd03351285"
dependencies = [
"either",
]
[[package]] [[package]]
name = "itoa" name = "itoa"
version = "1.0.14" version = "1.0.14"
@@ -2690,10 +2699,11 @@ dependencies = [
"uds_windows", "uds_windows",
"which", "which",
"win32-display-data", "win32-display-data",
"windows 0.58.0", "windows 0.60.0",
"windows-core 0.58.0", "windows-core 0.60.1",
"windows-implement 0.58.0", "windows-implement 0.59.0",
"windows-interface 0.58.0", "windows-interface 0.59.0",
"windows-numerics",
"winput", "winput",
"winreg", "winreg",
] ]
@@ -2728,7 +2738,8 @@ dependencies = [
"sysinfo", "sysinfo",
"tracing", "tracing",
"tracing-subscriber", "tracing-subscriber",
"windows 0.58.0", "windows 0.60.0",
"windows-core 0.60.1",
"windows-icons", "windows-icons",
] ]
@@ -2750,7 +2761,8 @@ dependencies = [
"komorebi-client", "komorebi-client",
"random_word", "random_word",
"serde_json_lenient", "serde_json_lenient",
"windows 0.58.0", "windows 0.60.0",
"windows-core 0.60.1",
] ]
[[package]] [[package]]
@@ -2789,7 +2801,7 @@ dependencies = [
"sysinfo", "sysinfo",
"thiserror 2.0.11", "thiserror 2.0.11",
"which", "which",
"windows 0.58.0", "windows 0.60.0",
] ]
[[package]] [[package]]
@@ -2880,7 +2892,7 @@ checksum = "c0ff37bd590ca25063e35af745c343cb7a0271906fb7b37e4813e8f79f00268d"
dependencies = [ dependencies = [
"bitflags 2.8.0", "bitflags 2.8.0",
"libc", "libc",
"redox_syscall 0.5.8", "redox_syscall 0.5.9",
] ]
[[package]] [[package]]
@@ -2925,9 +2937,9 @@ dependencies = [
[[package]] [[package]]
name = "log" name = "log"
version = "0.4.25" version = "0.4.26"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "04cbf5b083de1c7e0222a7a51dbfdba1cbe1c6ab0b15e29fff3f6c077fd9cd9f" checksum = "30bde2b3dc3671ae49d8e2e9f044c7c005836e7a023ee57cffa25ab82764bb9e"
[[package]] [[package]]
name = "loop9" name = "loop9"
@@ -3078,9 +3090,9 @@ dependencies = [
[[package]] [[package]]
name = "miniz_oxide" name = "miniz_oxide"
version = "0.8.4" version = "0.8.5"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b3b1c9bd4fe1f0f8b387f6eb9eb3b4a1aa26185e5750efb9140301703f62cd1b" checksum = "8e3e04debbb59698c15bacbb6d93584a8c0ca9cc3213cb423d31f760d8843ce5"
dependencies = [ dependencies = [
"adler2", "adler2",
"simd-adler32", "simd-adler32",
@@ -3150,9 +3162,9 @@ dependencies = [
[[package]] [[package]]
name = "native-tls" name = "native-tls"
version = "0.2.13" version = "0.2.14"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0dab59f8e050d5df8e4dd87d9206fb6f65a483e20ac9fda365ade4fab353196c" checksum = "87de3442987e9dbec73158d5c715e7ad9072fda936bb03d19d7fa10e00520f0e"
dependencies = [ dependencies = [
"libc", "libc",
"log", "log",
@@ -3853,7 +3865,7 @@ dependencies = [
"cfg-if 1.0.0", "cfg-if 1.0.0",
"libc", "libc",
"petgraph", "petgraph",
"redox_syscall 0.5.8", "redox_syscall 0.5.9",
"smallvec", "smallvec",
"thread-id", "thread-id",
"windows-targets 0.52.6", "windows-targets 0.52.6",
@@ -3953,7 +3965,7 @@ dependencies = [
"crc32fast", "crc32fast",
"fdeflate", "fdeflate",
"flate2", "flate2",
"miniz_oxide 0.8.4", "miniz_oxide 0.8.5",
] ]
[[package]] [[package]]
@@ -4161,7 +4173,7 @@ dependencies = [
"built", "built",
"cfg-if 1.0.0", "cfg-if 1.0.0",
"interpolate_name", "interpolate_name",
"itertools", "itertools 0.12.1",
"libc", "libc",
"libfuzzer-sys", "libfuzzer-sys",
"log", "log",
@@ -4234,9 +4246,9 @@ dependencies = [
[[package]] [[package]]
name = "redox_syscall" name = "redox_syscall"
version = "0.5.8" version = "0.5.9"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "03a862b389f93e68874fbf580b9de08dd02facb9a788ebadaf4a3fd33cf58834" checksum = "82b568323e98e49e2a0899dcee453dd679fae22d69adf9b11dd508d1549b7e2f"
dependencies = [ dependencies = [
"bitflags 2.8.0", "bitflags 2.8.0",
] ]
@@ -4355,9 +4367,9 @@ checksum = "57397d16646700483b67d2dd6511d79318f9d057fdbd21a4066aeac8b41d310a"
[[package]] [[package]]
name = "ring" name = "ring"
version = "0.17.9" version = "0.17.10"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e75ec5e92c4d8aede845126adc388046234541629e76029599ed35a003c7ed24" checksum = "d34b5020fcdea098ef7d95e9f89ec15952123a4a039badd09fabebe9e963e839"
dependencies = [ dependencies = [
"cc", "cc",
"cfg-if 1.0.0", "cfg-if 1.0.0",
@@ -4535,18 +4547,18 @@ dependencies = [
[[package]] [[package]]
name = "serde" name = "serde"
version = "1.0.217" version = "1.0.218"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "02fc4265df13d6fa1d00ecff087228cc0a2b5f3c0e87e258d8b94a156e984c70" checksum = "e8dfc9d19bdbf6d17e22319da49161d5d0108e4188e8b680aef6299eed22df60"
dependencies = [ dependencies = [
"serde_derive", "serde_derive",
] ]
[[package]] [[package]]
name = "serde_derive" name = "serde_derive"
version = "1.0.217" version = "1.0.218"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5a9bf7cf98d04a2b28aead066b7496853d4779c9cc183c440dbac457641e19a0" checksum = "f09503e191f4e797cb8aac08e9a4a4695c5edf6a2e70e376d961ddd5c969f82b"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
@@ -4566,9 +4578,9 @@ dependencies = [
[[package]] [[package]]
name = "serde_json" name = "serde_json"
version = "1.0.138" version = "1.0.139"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d434192e7da787e94a6ea7e9670b26a036d0ca41e0b7efb2676dd32bae872949" checksum = "44f86c3acccc9c65b153fe1b85a3be07fe5515274ec9f0653b4a0875731c72a6"
dependencies = [ dependencies = [
"itoa", "itoa",
"memchr", "memchr",
@@ -5439,9 +5451,9 @@ checksum = "75b844d17643ee918803943289730bec8aac480150456169e647ed0b576ba539"
[[package]] [[package]]
name = "unicode-ident" name = "unicode-ident"
version = "1.0.16" version = "1.0.17"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a210d160f08b701c8721ba1c726c11662f877ea6b7094007e1ca9a1041945034" checksum = "00e2473a93778eb0bad35909dff6a10d28e63f792f16ed15e404fca9d5eeedbe"
[[package]] [[package]]
name = "unicode-linebreak" name = "unicode-linebreak"
@@ -5926,12 +5938,13 @@ 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=376523b9e1321e033b0b0ed0e6fa75a072b46ad9#376523b9e1321e033b0b0ed0e6fa75a072b46ad9"
dependencies = [ dependencies = [
"itertools", "itertools 0.14.0",
"serde", "serde",
"thiserror 1.0.69", "thiserror 2.0.11",
"windows 0.58.0", "windows 0.60.0",
"windows-core 0.60.1",
"wmi", "wmi",
] ]
@@ -5996,6 +6009,28 @@ dependencies = [
"windows-targets 0.53.0", "windows-targets 0.53.0",
] ]
[[package]]
name = "windows"
version = "0.60.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ddf874e74c7a99773e62b1c671427abf01a425e77c3d3fb9fb1e4883ea934529"
dependencies = [
"windows-collections",
"windows-core 0.60.1",
"windows-future",
"windows-link",
"windows-numerics",
]
[[package]]
name = "windows-collections"
version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5467f79cc1ba3f52ebb2ed41dbb459b8e7db636cc3429458d9a852e15bc24dec"
dependencies = [
"windows-core 0.60.1",
]
[[package]] [[package]]
name = "windows-core" name = "windows-core"
version = "0.52.0" version = "0.52.0"
@@ -6038,11 +6073,34 @@ checksum = "810ce18ed2112484b0d4e15d022e5f598113e220c53e373fb31e67e21670c1ce"
dependencies = [ dependencies = [
"windows-implement 0.59.0", "windows-implement 0.59.0",
"windows-interface 0.59.0", "windows-interface 0.59.0",
"windows-result 0.3.0", "windows-result 0.3.1",
"windows-strings 0.3.0", "windows-strings 0.3.1",
"windows-targets 0.53.0", "windows-targets 0.53.0",
] ]
[[package]]
name = "windows-core"
version = "0.60.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ca21a92a9cae9bf4ccae5cf8368dce0837100ddf6e6d57936749e85f152f6247"
dependencies = [
"windows-implement 0.59.0",
"windows-interface 0.59.0",
"windows-link",
"windows-result 0.3.1",
"windows-strings 0.3.1",
]
[[package]]
name = "windows-future"
version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a787db4595e7eb80239b74ce8babfb1363d8e343ab072f2ffe901400c03349f0"
dependencies = [
"windows-core 0.60.1",
"windows-link",
]
[[package]] [[package]]
name = "windows-icons" name = "windows-icons"
version = "0.1.0" version = "0.1.0"
@@ -6120,6 +6178,22 @@ dependencies = [
"syn", "syn",
] ]
[[package]]
name = "windows-link"
version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6dccfd733ce2b1753b03b6d3c65edf020262ea35e20ccdf3e288043e6dd620e3"
[[package]]
name = "windows-numerics"
version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "005dea54e2f6499f2cee279b8f703b3cf3b5734a2d8d21867c8f44003182eeed"
dependencies = [
"windows-core 0.60.1",
"windows-link",
]
[[package]] [[package]]
name = "windows-registry" name = "windows-registry"
version = "0.2.0" version = "0.2.0"
@@ -6151,11 +6225,11 @@ dependencies = [
[[package]] [[package]]
name = "windows-result" name = "windows-result"
version = "0.3.0" version = "0.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d08106ce80268c4067c0571ca55a9b4e9516518eaa1a1fe9b37ca403ae1d1a34" checksum = "06374efe858fab7e4f881500e6e86ec8bc28f9462c47e5a9941a0142ad86b189"
dependencies = [ dependencies = [
"windows-targets 0.53.0", "windows-link",
] ]
[[package]] [[package]]
@@ -6170,11 +6244,11 @@ dependencies = [
[[package]] [[package]]
name = "windows-strings" name = "windows-strings"
version = "0.3.0" version = "0.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b888f919960b42ea4e11c2f408fadb55f78a9f236d5eef084103c8ce52893491" checksum = "87fa48cc5d406560701792be122a10132491cff9d0aeb23583cc2dcafc847319"
dependencies = [ dependencies = [
"windows-targets 0.53.0", "windows-link",
] ]
[[package]] [[package]]
@@ -6509,9 +6583,9 @@ dependencies = [
[[package]] [[package]]
name = "winnow" name = "winnow"
version = "0.7.2" version = "0.7.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "59690dea168f2198d1a3b0cac23b8063efcd11012f10ae4698f284808c8ef603" checksum = "0e7f4ea97f6f78012141bcdb6a216b2609f0979ada50b20ca5b52dde2eac2bb1"
dependencies = [ dependencies = [
"memchr", "memchr",
] ]
@@ -6552,9 +6626,9 @@ dependencies = [
[[package]] [[package]]
name = "wmi" name = "wmi"
version = "0.14.5" version = "0.15.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7787dacdd8e71cbc104658aade4009300777f9b5fda6a75f19145fedb8a18e71" checksum = "58078b4e28f04064dae68f6e11a6b93133c83b88dfd5ae16738ded4942db6544"
dependencies = [ dependencies = [
"chrono", "chrono",
"futures", "futures",
+7 -6
View File
@@ -33,19 +33,20 @@ 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 = "376523b9e1321e033b0b0ed0e6fa75a072b46ad9" }
windows-implement = { version = "0.58" } windows-numerics = { version = "0.1" }
windows-interface = { version = "0.58" } windows-implement = { version = "0.59" }
windows-core = { version = "0.58" } windows-interface = { version = "0.59" }
windows-core = { version = "0.60" }
shadow-rs = "0.38" shadow-rs = "0.38"
which = "7" which = "7"
[workspace.dependencies.windows] [workspace.dependencies.windows]
version = "0.58" version = "0.60"
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
View File
@@ -34,4 +34,5 @@ sysinfo = { workspace = true }
tracing = { workspace = true } tracing = { workspace = true }
tracing-subscriber = { workspace = true } tracing-subscriber = { workspace = true }
windows = { workspace = true } windows = { workspace = true }
windows-core = { workspace = true }
windows-icons = { git = "https://github.com/LGUG2Z/windows-icons", rev = "d67cc9920aa9b4883393e411fb4fa2ddd4c498b5" } windows-icons = { git = "https://github.com/LGUG2Z/windows-icons", rev = "d67cc9920aa9b4883393e411fb4fa2ddd4c498b5" }
+1 -1
View File
@@ -42,7 +42,6 @@ use std::sync::LazyLock;
use std::sync::Mutex; use std::sync::Mutex;
use std::time::Duration; use std::time::Duration;
use tracing_subscriber::EnvFilter; use tracing_subscriber::EnvFilter;
use windows::Win32::Foundation::BOOL;
use windows::Win32::Foundation::HWND; use windows::Win32::Foundation::HWND;
use windows::Win32::Foundation::LPARAM; use windows::Win32::Foundation::LPARAM;
use windows::Win32::System::Threading::GetCurrentProcessId; use windows::Win32::System::Threading::GetCurrentProcessId;
@@ -51,6 +50,7 @@ use windows::Win32::UI::HiDpi::SetProcessDpiAwarenessContext;
use windows::Win32::UI::HiDpi::DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE_V2; use windows::Win32::UI::HiDpi::DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE_V2;
use windows::Win32::UI::WindowsAndMessaging::EnumThreadWindows; use windows::Win32::UI::WindowsAndMessaging::EnumThreadWindows;
use windows::Win32::UI::WindowsAndMessaging::GetWindowThreadProcessId; use windows::Win32::UI::WindowsAndMessaging::GetWindowThreadProcessId;
use windows_core::BOOL;
pub static MAX_LABEL_WIDTH: AtomicI32 = AtomicI32::new(400); pub static MAX_LABEL_WIDTH: AtomicI32 = AtomicI32::new(400);
pub static MONITOR_LEFT: AtomicI32 = AtomicI32::new(0); pub static MONITOR_LEFT: AtomicI32 = AtomicI32::new(0);
+1
View File
@@ -12,4 +12,5 @@ eframe = { workspace = true }
egui_extras = { workspace = true } egui_extras = { workspace = true }
random_word = { version = "0.4", features = ["en"] } random_word = { version = "0.4", features = ["en"] }
serde_json = { workspace = true } serde_json = { workspace = true }
windows-core = { workspace = true }
windows = { workspace = true } windows = { workspace = true }
+1 -1
View File
@@ -215,7 +215,7 @@ impl KomorebiGui {
extern "system" fn enum_window( extern "system" fn enum_window(
hwnd: windows::Win32::Foundation::HWND, hwnd: windows::Win32::Foundation::HWND,
lparam: windows::Win32::Foundation::LPARAM, lparam: windows::Win32::Foundation::LPARAM,
) -> windows::Win32::Foundation::BOOL { ) -> windows_core::BOOL {
let windows = unsafe { &mut *(lparam.0 as *mut Vec<Window>) }; let windows = unsafe { &mut *(lparam.0 as *mut Vec<Window>) };
let window = Window::from(hwnd.0 as isize); let window = Window::from(hwnd.0 as isize);
+1
View File
@@ -44,6 +44,7 @@ which = { workspace = true }
win32-display-data = { workspace = true } win32-display-data = { workspace = true }
windows = { workspace = true } windows = { workspace = true }
windows-core = { workspace = true } windows-core = { workspace = true }
windows-numerics = { workspace = true }
windows-implement = { workspace = true } windows-implement = { workspace = true }
windows-interface = { workspace = true } windows-interface = { workspace = true }
winput = "0.2" winput = "0.2"
+30 -12
View File
@@ -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;
@@ -17,8 +18,6 @@ use std::sync::atomic::Ordering;
use std::sync::mpsc; use std::sync::mpsc;
use std::sync::LazyLock; use std::sync::LazyLock;
use std::sync::OnceLock; use std::sync::OnceLock;
use windows::Foundation::Numerics::Matrix3x2;
use windows::Win32::Foundation::BOOL;
use windows::Win32::Foundation::FALSE; use windows::Win32::Foundation::FALSE;
use windows::Win32::Foundation::HWND; use windows::Win32::Foundation::HWND;
use windows::Win32::Foundation::LPARAM; use windows::Win32::Foundation::LPARAM;
@@ -32,7 +31,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;
@@ -68,13 +66,29 @@ use windows::Win32::UI::WindowsAndMessaging::WM_CREATE;
use windows::Win32::UI::WindowsAndMessaging::WM_DESTROY; use windows::Win32::UI::WindowsAndMessaging::WM_DESTROY;
use windows::Win32::UI::WindowsAndMessaging::WM_PAINT; use windows::Win32::UI::WindowsAndMessaging::WM_PAINT;
use windows::Win32::UI::WindowsAndMessaging::WNDCLASSW; use windows::Win32::UI::WindowsAndMessaging::WNDCLASSW;
use windows_core::BOOL;
use windows_core::PCWSTR; use windows_core::PCWSTR;
use windows_numerics::Matrix3x2;
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 => {
+14 -2
View File
@@ -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>);
+1 -1
View File
@@ -13,11 +13,11 @@ use windows::core::HRESULT;
use windows::core::HSTRING; use windows::core::HSTRING;
use windows::core::PCWSTR; use windows::core::PCWSTR;
use windows::core::PWSTR; use windows::core::PWSTR;
use windows::Win32::Foundation::BOOL;
use windows::Win32::Foundation::HWND; use windows::Win32::Foundation::HWND;
use windows::Win32::Foundation::RECT; use windows::Win32::Foundation::RECT;
use windows::Win32::Foundation::SIZE; use windows::Win32::Foundation::SIZE;
use windows::Win32::UI::Shell::Common::IObjectArray; use windows::Win32::UI::Shell::Common::IObjectArray;
use windows_core::BOOL;
type DesktopID = GUID; type DesktopID = GUID;
+1 -1
View File
@@ -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;
}; };
+11 -11
View File
@@ -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(())
+16 -24
View File
@@ -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;
@@ -12,7 +12,6 @@ use windows::core::Result as WindowsCrateResult;
use windows::core::PCWSTR; use windows::core::PCWSTR;
use windows::core::PWSTR; use windows::core::PWSTR;
use windows::Win32::Foundation::CloseHandle; use windows::Win32::Foundation::CloseHandle;
use windows::Win32::Foundation::BOOL;
use windows::Win32::Foundation::COLORREF; use windows::Win32::Foundation::COLORREF;
use windows::Win32::Foundation::HANDLE; use windows::Win32::Foundation::HANDLE;
use windows::Win32::Foundation::HINSTANCE; use windows::Win32::Foundation::HINSTANCE;
@@ -140,6 +139,7 @@ use windows::Win32::UI::WindowsAndMessaging::WS_EX_TOOLWINDOW;
use windows::Win32::UI::WindowsAndMessaging::WS_EX_TOPMOST; use windows::Win32::UI::WindowsAndMessaging::WS_EX_TOPMOST;
use windows::Win32::UI::WindowsAndMessaging::WS_POPUP; use windows::Win32::UI::WindowsAndMessaging::WS_POPUP;
use windows::Win32::UI::WindowsAndMessaging::WS_SYSMENU; use windows::Win32::UI::WindowsAndMessaging::WS_SYSMENU;
use windows_core::BOOL;
use crate::core::Rect; use crate::core::Rect;
@@ -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 {
+1 -1
View File
@@ -8,7 +8,6 @@ use crate::window_manager_event::WindowManagerEvent;
use crate::windows_api::WindowsApi; use crate::windows_api::WindowsApi;
use crate::winevent::WinEvent; use crate::winevent::WinEvent;
use crate::winevent_listener; use crate::winevent_listener;
use windows::Win32::Foundation::BOOL;
use windows::Win32::Foundation::HWND; use windows::Win32::Foundation::HWND;
use windows::Win32::Foundation::LPARAM; use windows::Win32::Foundation::LPARAM;
use windows::Win32::Foundation::WPARAM; use windows::Win32::Foundation::WPARAM;
@@ -21,6 +20,7 @@ use windows::Win32::UI::WindowsAndMessaging::OBJID_WINDOW;
use windows::Win32::UI::WindowsAndMessaging::WS_CHILD; use windows::Win32::UI::WindowsAndMessaging::WS_CHILD;
use windows::Win32::UI::WindowsAndMessaging::WS_EX_NOACTIVATE; use windows::Win32::UI::WindowsAndMessaging::WS_EX_NOACTIVATE;
use windows::Win32::UI::WindowsAndMessaging::WS_EX_TOOLWINDOW; use windows::Win32::UI::WindowsAndMessaging::WS_EX_TOOLWINDOW;
use windows_core::BOOL;
pub extern "system" fn enum_window(hwnd: HWND, lparam: LPARAM) -> BOOL { pub extern "system" fn enum_window(hwnd: HWND, lparam: LPARAM) -> BOOL {
let containers = unsafe { &mut *(lparam.0 as *mut VecDeque<Container>) }; let containers = unsafe { &mut *(lparam.0 as *mut VecDeque<Container>) };
+1 -2
View File
@@ -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;
}; };