Skip to content

Commit

Permalink
fix(config): make win32 calls for windows ffm
Browse files Browse the repository at this point in the history
This commit ensures that the required calls are made to the system to
enable and disable the Windows focus-follows-mouse implementation when
users make changes to the focus_follows_mouse option in the static
config file.

fix #603
  • Loading branch information
LGUG2Z committed Nov 30, 2023
1 parent 8e9d63c commit 8afad72
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions komorebi/src/static_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ use crate::monitor::Monitor;
use crate::ring::Ring;
use crate::window_manager::WindowManager;
use crate::window_manager_event::WindowManagerEvent;
use crate::windows_api::WindowsApi;
use crate::workspace::Workspace;
use crate::ALT_FOCUS_HACK;
use crate::BORDER_COLOUR_CURRENT;
Expand Down Expand Up @@ -801,6 +802,14 @@ impl StaticConfig {
already_moved_window_handles: Arc::new(Mutex::new(HashSet::new())),
};

match value.focus_follows_mouse {
None => WindowsApi::disable_focus_follows_mouse()?,
Some(FocusFollowsMouseImplementation::Windows) => {
WindowsApi::enable_focus_follows_mouse()?;
}
Some(FocusFollowsMouseImplementation::Komorebi) => {}
};

let bytes = SocketMessage::ReloadStaticConfiguration(path.clone()).as_bytes()?;

wm.hotwatch.watch(path, move |event| match event {
Expand Down Expand Up @@ -944,6 +953,15 @@ impl StaticConfig {
}

wm.work_area_offset = value.global_work_area_offset;

match value.focus_follows_mouse {
None => WindowsApi::disable_focus_follows_mouse()?,
Some(FocusFollowsMouseImplementation::Windows) => {
WindowsApi::enable_focus_follows_mouse()?;
}
Some(FocusFollowsMouseImplementation::Komorebi) => {}
};

wm.focus_follows_mouse = value.focus_follows_mouse;

Ok(())
Expand Down

0 comments on commit 8afad72

Please sign in to comment.