Skip to content

Commit

Permalink
chore: fix typos
Browse files Browse the repository at this point in the history
  • Loading branch information
sigoden committed Feb 2, 2024
1 parent 6110fd0 commit 9e6f73a
Show file tree
Hide file tree
Showing 8 changed files with 16 additions and 16 deletions.
14 changes: 7 additions & 7 deletions src/app.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
use crate::config::Config;
use crate::foregound::ForegroundWatcher;
use crate::foreground::ForegroundWatcher;
use crate::keyboard::KeyboardListener;
use crate::startup::Startup;
use crate::trayicon::TrayIcon;
use crate::utils::{
check_error, create_hicon_from_resource, get_foreground_window, get_module_icon,
get_module_icon_ex, get_uwp_icon_data, get_window_user_data, is_iconic_window, list_windows,
set_foregound_window, set_window_user_data, CheckError,
set_foreground_window, set_window_user_data, CheckError,
};

use crate::painter::{GdiAAPainter, ICON_BORDER_SIZE, WINDOW_BORDER_SIZE};
Expand Down Expand Up @@ -57,7 +57,7 @@ pub struct App {
startup: Startup,
config: Config,
switch_windows_state: SwitchWindowsState,
switch_apps_state: Option<SwtichAppsState>,
switch_apps_state: Option<SwitchAppsState>,
uwp_icons: HashMap<String, Vec<u8>>,
painter: GdiAAPainter,
}
Expand Down Expand Up @@ -341,7 +341,7 @@ impl App {
cache: Some((module_path.clone(), state_id, index, state_windows)),
modifier_released: false,
};
set_foregound_window(hwnd);
set_foreground_window(hwnd);

Ok(true)
}
Expand Down Expand Up @@ -443,7 +443,7 @@ impl App {
1
};

self.switch_apps_state = Some(SwtichAppsState {
self.switch_apps_state = Some(SwitchAppsState {
apps,
index,
icon_size,
Expand Down Expand Up @@ -483,7 +483,7 @@ impl App {
let hwnd = self.hwnd;
if let Some(state) = self.switch_apps_state.take() {
if let Some((_, id)) = state.apps.get(state.index) {
set_foregound_window(*id);
set_foreground_window(*id);
}
for (hicon, _) in state.apps {
let _ = unsafe { DestroyIcon(hicon) };
Expand All @@ -509,7 +509,7 @@ struct SwitchWindowsState {
}

#[derive(Debug)]
pub struct SwtichAppsState {
pub struct SwitchAppsState {
pub apps: Vec<(HICON, HWND)>,
pub index: usize,
pub icon_size: i32,
Expand Down
File renamed without changes.
4 changes: 2 additions & 2 deletions src/keyboard.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use crate::{
app::{WM_USER_HOOTKEY, WM_USER_MODIFIER_KEYUP},
config::{Hotkey, SWITCH_WINDOWS_HOTKEY_ID},
foregound::IS_FOREGROUND_IN_BLACKLIST,
foreground::IS_FOREGROUND_IN_BLACKLIST,
};

use anyhow::{anyhow, Result};
Expand Down Expand Up @@ -51,7 +51,7 @@ impl KeyboardListener {

impl Drop for KeyboardListener {
fn drop(&mut self) {
debug!("keyboard listener destoryed");
debug!("keyboard listener destroyed");
if !self.hook.is_invalid() {
let _ = unsafe { UnhookWindowsHookEx(self.hook) };
}
Expand Down
2 changes: 1 addition & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ extern crate log;

mod app;
mod config;
mod foregound;
mod foreground;
mod keyboard;
mod painter;
mod startup;
Expand Down
2 changes: 1 addition & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ fn load_config() -> Result<Config> {
let folder = get_exe_folder()?;
let ini_file = folder.join("window-switcher.ini");
let conf =
Ini::load_from_file(ini_file).map_err(|err| anyhow!("Faile to load ini file, {err}"))?;
Ini::load_from_file(ini_file).map_err(|err| anyhow!("Failed to load ini file, {err}"))?;
Config::load(&conf)
}

Expand Down
6 changes: 3 additions & 3 deletions src/painter.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use crate::app::SwtichAppsState;
use crate::app::SwitchAppsState;
use windows::Win32::Foundation::{COLORREF, RECT};
use windows::Win32::Graphics::Gdi::{
BeginPaint, BitBlt, CreateCompatibleBitmap, CreateCompatibleDC, CreateSolidBrush, DeleteDC,
Expand Down Expand Up @@ -116,7 +116,7 @@ impl GdiAAPainter {
}

/// Draw state onto hdc in memory
pub fn paint(&mut self, state: &SwtichAppsState) {
pub fn paint(&mut self, state: &SwitchAppsState) {
self.paint0(state);
unsafe {
SetStretchBltMode(self.mem_hdc, HALFTONE);
Expand Down Expand Up @@ -155,7 +155,7 @@ impl GdiAAPainter {
}
}

fn paint0(&mut self, state: &SwtichAppsState) {
fn paint0(&mut self, state: &SwitchAppsState) {
unsafe {
// draw background
let rect = RECT {
Expand Down
2 changes: 1 addition & 1 deletion src/trayicon.rs
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ impl TrayIcon {

impl Drop for TrayIcon {
fn drop(&mut self) {
debug!("trayicon destoryed");
debug!("trayicon destroyed");
unsafe { Shell_NotifyIconW(NIM_DELETE, &self.data) };
}
}
2 changes: 1 addition & 1 deletion src/utils/window.rs
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ pub fn get_window_exe(hwnd: HWND) -> Option<String> {
module_path.split('\\').map(|v| v.to_string()).last()
}

pub fn set_foregound_window(hwnd: HWND) {
pub fn set_foreground_window(hwnd: HWND) {
unsafe {
if is_iconic_window(hwnd) {
ShowWindow(hwnd, SW_RESTORE);
Expand Down

0 comments on commit 9e6f73a

Please sign in to comment.