chore(deps): bump windows-rs from 0.54 to 0.57

This is the highest we can go right now because this change which went
into 0.58 absolutely fucks our shit up:
https://github.com/microsoft/windows-rs/pull/3111
This commit is contained in:
LGUG2Z
2024-09-25 08:58:10 -07:00
parent d110e12a62
commit 167ec92811
10 changed files with 110 additions and 157 deletions

View File

@@ -47,6 +47,7 @@ which = { workspace = true }
widestring = "1"
win32-display-data = { workspace = true }
windows = { workspace = true }
windows-core = { workspace = true }
windows-implement = { workspace = true }
windows-interface = { workspace = true }
winput = "0.2"

View File

@@ -103,7 +103,8 @@ impl Border {
tracing::debug!("border window event processing thread shutdown");
break;
};
TranslateMessage(&msg);
// TODO: error handling
let _ = TranslateMessage(&msg);
DispatchMessageW(&msg);
}
@@ -191,27 +192,35 @@ impl Border {
match STYLE.load() {
BorderStyle::System => {
if *WINDOWS_11 {
RoundRect(hdc, 0, 0, rect.right, rect.bottom, 20, 20);
// TODO: error handling
let _ =
RoundRect(hdc, 0, 0, rect.right, rect.bottom, 20, 20);
} else {
Rectangle(hdc, 0, 0, rect.right, rect.bottom);
// TODO: error handling
let _ = Rectangle(hdc, 0, 0, rect.right, rect.bottom);
}
}
BorderStyle::Rounded => {
RoundRect(hdc, 0, 0, rect.right, rect.bottom, 20, 20);
// TODO: error handling
let _ = RoundRect(hdc, 0, 0, rect.right, rect.bottom, 20, 20);
}
BorderStyle::Square => {
Rectangle(hdc, 0, 0, rect.right, rect.bottom);
// TODO: error handling
let _ = Rectangle(hdc, 0, 0, rect.right, rect.bottom);
}
}
DeleteObject(hpen);
DeleteObject(hbrush);
// TODO: error handling
let _ = DeleteObject(hpen);
// TODO: error handling
let _ = DeleteObject(hbrush);
}
Err(error) => {
tracing::error!("could not get border rect: {}", error.to_string())
}
}
EndPaint(window, &ps);
// TODO: error handling
let _ = EndPaint(window, &ps);
LRESULT(0)
}
WM_DESTROY => {

View File

@@ -10,13 +10,13 @@ use interfaces::IServiceProvider;
use std::ffi::c_void;
use windows::core::Interface;
use windows::Win32::Foundation::HWND;
use windows::Win32::System::Com::CoCreateInstance;
use windows::Win32::System::Com::CoInitializeEx;
use windows::Win32::System::Com::CoUninitialize;
use windows::Win32::System::Com::CLSCTX_ALL;
use windows::Win32::System::Com::COINIT_APARTMENTTHREADED;
use windows_core::Interface;
struct ComInit();

View File

@@ -77,7 +77,8 @@ impl Hidden {
tracing::debug!("hidden window event processing thread shutdown");
break;
};
TranslateMessage(&msg);
// TODO: error handling
let _ = TranslateMessage(&msg);
DispatchMessageW(&msg);
}

View File

@@ -134,7 +134,8 @@ impl Stackbar {
tracing::debug!("stackbar window event processing thread shutdown");
break;
};
TranslateMessage(&msg);
// TODO: error handling
let _ = TranslateMessage(&msg);
DispatchMessageW(&msg);
std::thread::sleep(Duration::from_millis(10))
@@ -232,16 +233,29 @@ impl Stackbar {
match STYLE.load() {
BorderStyle::System => {
if *WINDOWS_11 {
RoundRect(hdc, rect.left, rect.top, rect.right, rect.bottom, 20, 20);
// TODO: error handling
let _ = RoundRect(
hdc,
rect.left,
rect.top,
rect.right,
rect.bottom,
20,
20,
);
} else {
Rectangle(hdc, rect.left, rect.top, rect.right, rect.bottom);
// TODO: error handling
let _ = Rectangle(hdc, rect.left, rect.top, rect.right, rect.bottom);
}
}
BorderStyle::Rounded => {
RoundRect(hdc, rect.left, rect.top, rect.right, rect.bottom, 20, 20);
// TODO: error handling
let _ =
RoundRect(hdc, rect.left, rect.top, rect.right, rect.bottom, 20, 20);
}
BorderStyle::Square => {
Rectangle(hdc, rect.left, rect.top, rect.right, rect.bottom);
// TODO: error handling
let _ = Rectangle(hdc, rect.left, rect.top, rect.right, rect.bottom);
}
}
@@ -267,9 +281,12 @@ impl Stackbar {
}
ReleaseDC(self.hwnd(), hdc);
DeleteObject(hpen);
DeleteObject(hbrush);
DeleteObject(hfont);
// TODO: error handling
let _ = DeleteObject(hpen);
// TODO: error handling
let _ = DeleteObject(hbrush);
// TODO: error handling
let _ = DeleteObject(hfont);
}
Ok(())

View File

@@ -456,7 +456,10 @@ impl WindowsApi {
pub fn show_window(hwnd: HWND, command: SHOW_WINDOW_CMD) {
// BOOL is returned but does not signify whether or not the operation was succesful
// https://docs.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-showwindow
unsafe { ShowWindow(hwnd, command) };
// TODO: error handling
unsafe {
let _ = ShowWindow(hwnd, command);
};
}
pub fn minimize_window(hwnd: HWND) {
@@ -597,7 +600,8 @@ impl WindowsApi {
pub fn round_rect(hdc: HDC, rect: &Rect, border_radius: i32) {
unsafe {
RoundRect(
// TODO: error handling
let _ = RoundRect(
hdc,
rect.left,
rect.top,
@@ -610,7 +614,8 @@ impl WindowsApi {
}
pub fn rectangle(hdc: HDC, rect: &Rect) {
unsafe {
Rectangle(hdc, rect.left, rect.top, rect.right, rect.bottom);
// TODO: error handling
let _ = Rectangle(hdc, rect.left, rect.top, rect.right, rect.bottom);
}
}
fn set_cursor_pos(x: i32, y: i32) -> Result<()> {

View File

@@ -43,7 +43,8 @@ pub fn start() {
tracing::debug!("windows event processing thread shutdown");
break;
};
TranslateMessage(&msg);
// TODO: error handling
let _ = TranslateMessage(&msg);
DispatchMessageW(&msg);
}