Skip to content

Commit

Permalink
Fix deadlock on exit button
Browse files Browse the repository at this point in the history
  • Loading branch information
jacob-pro committed Jan 20, 2024
1 parent ec7ea81 commit b636ccc
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "solar-screen-brightness"
version = "2.2.0"
version = "2.3.0"
authors = ["Jacob Halsey <jacob@jhalsey.com>"]
edition = "2021"
build = "build.rs"
Expand Down
10 changes: 5 additions & 5 deletions src/event_watcher/windows.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ use windows::Win32::Foundation::{HWND, LPARAM, LRESULT, WPARAM};
use windows::Win32::System::LibraryLoader::GetModuleHandleW;
use windows::Win32::System::RemoteDesktop::WTSRegisterSessionNotification;
use windows::Win32::UI::WindowsAndMessaging::{
CreateWindowExW, DefWindowProcA, DispatchMessageA, GetMessageA, PostQuitMessage,
CreateWindowExW, DefWindowProcA, DispatchMessageW, GetMessageW, PostQuitMessage,
RegisterClassW, RegisterWindowMessageW, SendMessageW, SetWindowLongPtrW, CW_USEDEFAULT,
GWLP_USERDATA, MSG, WINDOW_EX_STYLE, WINDOW_STYLE, WM_APP, WM_DISPLAYCHANGE,
WM_WTSSESSION_CHANGE, WNDCLASSW, WTS_SESSION_LOCK, WTS_SESSION_UNLOCK,
Expand Down Expand Up @@ -81,11 +81,11 @@ impl EventWatcher {
WTSRegisterSessionNotification(hwnd, 0).unwrap();

let mut message = MSG::default();
while GetMessageA(&mut message, hwnd, 0, 0).into() {
DispatchMessageA(&message);
while GetMessageW(&mut message, None, 0, 0).into() {
DispatchMessageW(&message);
}
}
log::info!("EventWatcher thread exiting");
log::debug!("EventWatcher thread exiting");
});

let hwnd = rx.recv().unwrap();
Expand Down Expand Up @@ -126,7 +126,7 @@ unsafe extern "system" fn wndproc(
.unwrap();
}
EXIT_LOOP => {
log::info!("Received EXIT_LOOP message");
log::debug!("Received EXIT_LOOP message");
PostQuitMessage(0);
}
WM_WTSSESSION_CHANGE => match wparam.0 as u32 {
Expand Down

0 comments on commit b636ccc

Please sign in to comment.