Skip to content

Commit

Permalink
chore(deps): bump windows-rs from 0.54 to 0.57
Browse files Browse the repository at this point in the history
This is the highest we can go right now because this change which went
into 0.58 absolutely fucks our shit up:
microsoft/windows-rs#3111
  • Loading branch information
LGUG2Z committed Sep 25, 2024
1 parent d110e12 commit 167ec92
Show file tree
Hide file tree
Showing 10 changed files with 110 additions and 157 deletions.
175 changes: 45 additions & 130 deletions Cargo.lock

Large diffs are not rendered by default.

9 changes: 5 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,15 @@ tracing-subscriber = { version = "0.3", features = ["env-filter"] }
paste = "1"
sysinfo = "0.31"
uds_windows = "1"
win32-display-data = { git = "https://github.com/LGUG2Z/win32-display-data", rev = "32a45cebf132c3d651ee22c0c40033a6b7edc945" }
windows-implement = { version = "0.53" }
windows-interface = { version = "0.53" }
win32-display-data = { git = "https://github.com/LGUG2Z/win32-display-data", rev = "790d56567bd15b4ba3d49ed1ac9701ede6fab4a3" }
windows-implement = { version = "0.57" }
windows-interface = { version = "0.57" }
windows-core = { version = "0.57" }
shadow-rs = "0.35"
which = "6"

[workspace.dependencies.windows]
version = "0.54"
version = "0.57"
features = [
"implement",
"Win32_System_Com",
Expand Down
1 change: 1 addition & 0 deletions komorebi/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
25 changes: 17 additions & 8 deletions komorebi/src/border_manager/border.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down Expand Up @@ -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 => {
Expand Down
2 changes: 1 addition & 1 deletion komorebi/src/com/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down
3 changes: 2 additions & 1 deletion komorebi/src/monitor_reconciliator/hidden.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down
33 changes: 25 additions & 8 deletions komorebi/src/stackbar_manager/stackbar.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down Expand Up @@ -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);
}
}

Expand All @@ -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(())
Expand Down
11 changes: 8 additions & 3 deletions komorebi/src/windows_api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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,
Expand All @@ -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<()> {
Expand Down
3 changes: 2 additions & 1 deletion komorebi/src/winevent_listener.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down
5 changes: 4 additions & 1 deletion komorebic/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2589,7 +2589,10 @@ Stop-Process -Name:komorebi -ErrorAction SilentlyContinue
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);
};
}

fn remove_transparency(hwnd: HWND) {
Expand Down

0 comments on commit 167ec92

Please sign in to comment.