Skip to content

Commit a8cc60a

Browse files
committed
chore: trivial updates
1 parent 2e65797 commit a8cc60a

File tree

4 files changed

+6
-65
lines changed

4 files changed

+6
-65
lines changed

Cargo.lock

Lines changed: 0 additions & 56 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ log = "0.4.17"
1212
once_cell = "1.17.1"
1313
rust-ini = "0.18.0"
1414
simple-logging = "2.0.2"
15-
wchar = "0.11"
1615

1716
[dependencies.windows]
1817
version = "0.44.0"

src/app.rs

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@ use windows::Win32::UI::WindowsAndMessaging::{
2727
GetMessageW, GetWindowLongPtrW, LoadCursorW, PostQuitMessage, RegisterClassW,
2828
RegisterWindowMessageW, SetCursor, SetWindowLongPtrW, SetWindowPos, ShowWindow,
2929
TranslateMessage, CW_USEDEFAULT, DI_NORMAL, GWL_STYLE, HICON, HWND_TOPMOST, IDC_ARROW, MSG,
30-
SWP_SHOWWINDOW, SW_HIDE, WINDOW_STYLE, WM_COMMAND, WM_CREATE, WM_LBUTTONUP, WM_PAINT,
31-
WM_RBUTTONUP, WNDCLASSW, WS_CAPTION, WS_EX_TOOLWINDOW,
30+
SWP_SHOWWINDOW, SW_HIDE, WINDOW_STYLE, WM_COMMAND, WM_LBUTTONUP, WM_PAINT, WM_RBUTTONUP,
31+
WNDCLASSW, WS_CAPTION, WS_EX_TOOLWINDOW,
3232
};
3333

3434
pub const NAME: PCWSTR = w!("Window Switcher");
@@ -45,7 +45,7 @@ const WINDOW_BORDER_SIZE: i32 = 10;
4545
const ICON_BORDER_SIZE: i32 = 4;
4646

4747
pub fn start(config: &Config) -> Result<()> {
48-
debug!("start config={:?}", config);
48+
info!("start config={:?}", config);
4949
App::start(config)
5050
}
5151

@@ -156,6 +156,7 @@ impl App {
156156
.check_error()
157157
.map_err(|err| anyhow!("Failed to create windows, {err}"))?;
158158

159+
// hide caption
159160
let mut style = unsafe { GetWindowLongPtrW(hwnd, GWL_STYLE) } as u32;
160161
style &= !WS_CAPTION.0;
161162
unsafe { SetWindowLongPtrW(hwnd, GWL_STYLE, style as _) };
@@ -216,7 +217,6 @@ impl App {
216217
}
217218
}
218219
WM_USER_HOOTKEY => {
219-
debug!("Handle msg=WM_USER_HOTKEY");
220220
let app = get_app(hwnd)?;
221221
let hotkey_id = wparam.0 as u32;
222222
if hotkey_id == app.config.switch_windows_hotkey.id {
@@ -228,9 +228,6 @@ impl App {
228228
};
229229
}
230230
}
231-
WM_CREATE => {
232-
debug!("Handle msg=WM_CREATE");
233-
}
234231
WM_COMMAND => {
235232
let value = wparam.0 as u32;
236233
let kind = ((value >> 16) & 0xffff) as u16;
@@ -275,7 +272,7 @@ impl App {
275272
match windows.get(&module_path) {
276273
None => Ok(false),
277274
Some(windows) => {
278-
debug!("switch windows {:?}", windows);
275+
debug!("switch windows {module_path} {windows:?}");
279276
let windows_len = windows.len();
280277
if windows_len == 1 {
281278
return Ok(false);

src/trayicon.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@ impl TrayIcon {
9898

9999
impl Drop for TrayIcon {
100100
fn drop(&mut self) {
101+
debug!("trayicon destoryed");
101102
unsafe { Shell_NotifyIconW(NIM_DELETE, &self.data) };
102103
}
103104
}

0 commit comments

Comments
 (0)