mirror of
https://github.com/LGUG2Z/komorebi.git
synced 2026-06-25 03:36:18 +02:00
Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 11428e62e3 |
@@ -21,7 +21,7 @@ jobs:
|
|||||||
cargo-deny:
|
cargo-deny:
|
||||||
runs-on: ubuntu-22.04
|
runs-on: ubuntu-22.04
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v6
|
- uses: actions/checkout@v7
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
- uses: EmbarkStudios/cargo-deny-action@v2
|
- uses: EmbarkStudios/cargo-deny-action@v2
|
||||||
@@ -43,7 +43,7 @@ jobs:
|
|||||||
RUSTFLAGS: -Ctarget-feature=+crt-static -Dwarnings
|
RUSTFLAGS: -Ctarget-feature=+crt-static -Dwarnings
|
||||||
GH_TOKEN: ${{ github.token }}
|
GH_TOKEN: ${{ github.token }}
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v6
|
- uses: actions/checkout@v7
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
- run: rustup toolchain install stable --profile minimal
|
- run: rustup toolchain install stable --profile minimal
|
||||||
@@ -82,7 +82,7 @@ jobs:
|
|||||||
env:
|
env:
|
||||||
GH_TOKEN: ${{ github.token }}
|
GH_TOKEN: ${{ github.token }}
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v6
|
- uses: actions/checkout@v7
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
- shell: bash
|
- shell: bash
|
||||||
@@ -129,7 +129,7 @@ jobs:
|
|||||||
env:
|
env:
|
||||||
GH_TOKEN: ${{ github.token }}
|
GH_TOKEN: ${{ github.token }}
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v6
|
- uses: actions/checkout@v7
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
- shell: bash
|
- shell: bash
|
||||||
@@ -171,7 +171,7 @@ jobs:
|
|||||||
env:
|
env:
|
||||||
GH_TOKEN: ${{ github.token }}
|
GH_TOKEN: ${{ github.token }}
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v6
|
- uses: actions/checkout@v7
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
- shell: bash
|
- shell: bash
|
||||||
|
|||||||
Generated
+482
-337
File diff suppressed because it is too large
Load Diff
@@ -41,30 +41,6 @@ use crate::windows_api::WindowsApi;
|
|||||||
use crate::winevent::WinEvent;
|
use crate::winevent::WinEvent;
|
||||||
use crate::workspace::WorkspaceLayer;
|
use crate::workspace::WorkspaceLayer;
|
||||||
|
|
||||||
fn should_skip_focus_change(foreground_hwnd: Option<isize>, window_hwnd: isize) -> bool {
|
|
||||||
matches!(foreground_hwnd, Some(hwnd) if hwnd != window_hwnd)
|
|
||||||
}
|
|
||||||
|
|
||||||
#[cfg(test)]
|
|
||||||
mod focus_change_tests {
|
|
||||||
use super::should_skip_focus_change;
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn skips_focus_change_from_background_window() {
|
|
||||||
assert!(should_skip_focus_change(Some(1), 2));
|
|
||||||
}
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn allows_focus_change_for_foreground_window() {
|
|
||||||
assert!(!should_skip_focus_change(Some(1), 1));
|
|
||||||
}
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn allows_focus_change_when_foreground_unknown() {
|
|
||||||
assert!(!should_skip_focus_change(None, 1));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[tracing::instrument]
|
#[tracing::instrument]
|
||||||
pub fn listen_for_events(wm: Arc<Mutex<WindowManager>>) {
|
pub fn listen_for_events(wm: Arc<Mutex<WindowManager>>) {
|
||||||
let receiver = wm.lock().incoming_events.clone();
|
let receiver = wm.lock().incoming_events.clone();
|
||||||
@@ -365,13 +341,6 @@ impl WindowManager {
|
|||||||
already_moved_window_handles.remove(&window.hwnd);
|
already_moved_window_handles.remove(&window.hwnd);
|
||||||
}
|
}
|
||||||
WindowManagerEvent::FocusChange(_, window) => {
|
WindowManagerEvent::FocusChange(_, window) => {
|
||||||
if should_skip_focus_change(WindowsApi::foreground_window().ok(), window.hwnd) {
|
|
||||||
tracing::debug!(
|
|
||||||
"ignoring stale focus change for hwnd {} as it is not the foreground window",
|
|
||||||
window.hwnd
|
|
||||||
);
|
|
||||||
return Ok(());
|
|
||||||
}
|
|
||||||
// don't want to trigger the full workspace updates when there are no managed
|
// don't want to trigger the full workspace updates when there are no managed
|
||||||
// containers - this makes floating windows on empty workspaces go into very
|
// containers - this makes floating windows on empty workspaces go into very
|
||||||
// annoying focus change loops which prevents users from interacting with them
|
// annoying focus change loops which prevents users from interacting with them
|
||||||
|
|||||||
Reference in New Issue
Block a user