Skip to content

Commit

Permalink
fux: avoid running the focus hack if the first focus attempt succeedes (
Browse files Browse the repository at this point in the history
#722)

* Avoid running the focus hack code if the first attempt to set the foreground window succeeded.

* Added .change file

* Accepted PR suggestion

* Delete windows-set-foreground-short-circuit.md
  • Loading branch information
RandomEngy authored Apr 8, 2023
1 parent 62db431 commit 1bd483c
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/platform_impl/windows/window.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1267,7 +1267,9 @@ unsafe fn taskbar_mark_fullscreen(handle: HWND, fullscreen: bool) {

unsafe fn force_window_active(handle: HWND) {
// Try to focus the window without the hack first.
SetForegroundWindow(handle);
if SetForegroundWindow(handle).as_bool() {
return;
}

// In some situations, calling SetForegroundWindow could not bring up the window,
// This is a little hack which can "steal" the foreground window permission.
Expand Down

0 comments on commit 1bd483c

Please sign in to comment.