Skip to content

Comments

Fix the foreground style for find my mouse#42865

Merged
moooyo merged 1 commit intomainfrom
dev/vanzue/fmm-mouse-style
Oct 27, 2025
Merged

Fix the foreground style for find my mouse#42865
moooyo merged 1 commit intomainfrom
dev/vanzue/fmm-mouse-style

Conversation

@vanzue
Copy link
Contributor

@vanzue vanzue commented Oct 24, 2025

Summary of the Pull Request

Find my mouse should use full transparent window

PR Checklist

Detailed Description of the Pull Request / Additional comments

Validation Steps Performed

Find.my.mouse.cursor.style.fix.mp4

@vanzue vanzue added this to the PowerToys 0.96 milestone Oct 24, 2025
@moooyo moooyo merged commit b774e13 into main Oct 27, 2025
14 checks passed
@vanzue vanzue deleted the dev/vanzue/fmm-mouse-style branch October 27, 2025 01:33
@yeelam-gordon yeelam-gordon requested a review from Copilot November 7, 2025 01:47
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR modifies the FindMyMouse window configuration to improve mouse input transparency and adjust window behavior. The changes include adding window extended styles for mouse transparency and layered rendering, removing a cursor message handler, and modifying window positioning flags.

Key Changes

  • Added WS_EX_TRANSPARENT and WS_EX_LAYERED extended window styles at window creation
  • Removed WM_SETCURSOR message handler that set the cursor to arrow
  • Removed SWP_NOACTIVATE flag from SetWindowPos call in StartSonar()

// Cover the entire virtual screen.
// HACK: Draw with 1 pixel off. Otherwise, Windows glitches the task bar transparency when a transparent window fill the whole screen.
SetWindowPos(m_hwnd, HWND_TOPMOST, GetSystemMetrics(SM_XVIRTUALSCREEN) + 1, GetSystemMetrics(SM_YVIRTUALSCREEN) + 1, GetSystemMetrics(SM_CXVIRTUALSCREEN) - 2, GetSystemMetrics(SM_CYVIRTUALSCREEN) - 2, SWP_NOACTIVATE);
SetWindowPos(m_hwnd, HWND_TOPMOST, GetSystemMetrics(SM_XVIRTUALSCREEN) + 1, GetSystemMetrics(SM_YVIRTUALSCREEN) + 1, GetSystemMetrics(SM_CXVIRTUALSCREEN) - 2, GetSystemMetrics(SM_CYVIRTUALSCREEN) - 2, 0);
Copy link

Copilot AI Nov 7, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removing the SWP_NOACTIVATE flag will cause the window to activate when positioned, potentially stealing focus from the foreground application. The Find My Mouse overlay should remain non-intrusive and not activate. The flag should be restored, or replaced with SWP_NOACTIVATE to maintain the previous behavior of not activating the window.

Suggested change
SetWindowPos(m_hwnd, HWND_TOPMOST, GetSystemMetrics(SM_XVIRTUALSCREEN) + 1, GetSystemMetrics(SM_YVIRTUALSCREEN) + 1, GetSystemMetrics(SM_CXVIRTUALSCREEN) - 2, GetSystemMetrics(SM_CYVIRTUALSCREEN) - 2, 0);
SetWindowPos(m_hwnd, HWND_TOPMOST, GetSystemMetrics(SM_XVIRTUALSCREEN) + 1, GetSystemMetrics(SM_YVIRTUALSCREEN) + 1, GetSystemMetrics(SM_CXVIRTUALSCREEN) - 2, GetSystemMetrics(SM_CYVIRTUALSCREEN) - 2, SWP_NOACTIVATE);

Copilot uses AI. Check for mistakes.
}

DWORD exStyle = WS_EX_TOOLWINDOW | Shim()->GetExtendedStyle();
DWORD exStyle = WS_EX_TRANSPARENT | WS_EX_LAYERED | WS_EX_TOOLWINDOW | Shim()->GetExtendedStyle();
Copy link

Copilot AI Nov 7, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The WS_EX_LAYERED flag is not needed for CompositionSpotlight, which uses the Windows Composition API rather than layered window functions like SetLayeredWindowAttributes. This flag is only required by the legacy GdiSonar implementations that are not currently used. While this doesn't cause a functional issue, removing it would improve code clarity and avoid potential confusion about the window's rendering approach.

Suggested change
DWORD exStyle = WS_EX_TRANSPARENT | WS_EX_LAYERED | WS_EX_TOOLWINDOW | Shim()->GetExtendedStyle();
DWORD exStyle = WS_EX_TRANSPARENT | WS_EX_TOOLWINDOW | Shim()->GetExtendedStyle();

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Find My Mouse makes windows losing focus

3 participants