Skip to content

Commit b774e13

Browse files
authored
Fix the foreground style for find my mouse (#42865)
<!-- Enter a brief description/summary of your PR here. What does it fix/what does it change/how was it tested (even manually, if necessary)? --> ## Summary of the Pull Request Find my mouse should use full transparent window <!-- Please review the items on the PR checklist before submitting--> ## PR Checklist - [X] Closes: #42758 - [ ] **Communication:** I've discussed this with core contributors already. If the work hasn't been agreed, this work might be rejected - [ ] **Tests:** Added/updated and all pass - [ ] **Localization:** All end-user-facing strings can be localized - [ ] **Dev docs:** Added/updated - [ ] **New binaries:** Added on the required places - [ ] [JSON for signing](https://github.com/microsoft/PowerToys/blob/main/.pipelines/ESRPSigning_core.json) for new binaries - [ ] [WXS for installer](https://github.com/microsoft/PowerToys/blob/main/installer/PowerToysSetup/Product.wxs) for new binaries and localization folder - [ ] [YML for CI pipeline](https://github.com/microsoft/PowerToys/blob/main/.pipelines/ci/templates/build-powertoys-steps.yml) for new test projects - [ ] [YML for signed pipeline](https://github.com/microsoft/PowerToys/blob/main/.pipelines/release.yml) - [ ] **Documentation updated:** If checked, please file a pull request on [our docs repo](https://github.com/MicrosoftDocs/windows-uwp/tree/docs/hub/powertoys) and link it here: #xxx <!-- Provide a more detailed description of the PR, other things fixed, or any additional comments/features here --> ## Detailed Description of the Pull Request / Additional comments <!-- Describe how you validated the behavior. Add automated tests wherever possible, but list manual validation steps taken as well --> ## Validation Steps Performed https://github.com/user-attachments/assets/75c73eb3-04bb-438c-8823-3c9f18923cc6
1 parent e256e79 commit b774e13

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

‎src/modules/MouseUtils/FindMyMouse/FindMyMouse.cpp‎

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ bool SuperSonar<D>::Initialize(HINSTANCE hinst)
189189
return false;
190190
}
191191

192-
DWORD exStyle = WS_EX_TOOLWINDOW | Shim()->GetExtendedStyle();
192+
DWORD exStyle = WS_EX_TRANSPARENT | WS_EX_LAYERED | WS_EX_TOOLWINDOW | Shim()->GetExtendedStyle();
193193
HWND created = CreateWindowExW(exStyle, className, windowTitle, WS_POPUP, CW_USEDEFAULT, 0, CW_USEDEFAULT, 0, m_hwndOwner, nullptr, hinst, this);
194194
if (!created)
195195
{
@@ -269,10 +269,6 @@ LRESULT SuperSonar<D>::BaseWndProc(UINT message, WPARAM wParam, LPARAM lParam) n
269269

270270
case WM_NCHITTEST:
271271
return HTTRANSPARENT;
272-
273-
case WM_SETCURSOR:
274-
SetCursor(LoadCursor(nullptr, IDC_ARROW));
275-
return TRUE;
276272
}
277273

278274
if (message == WM_PRIV_SHORTCUT)
@@ -539,7 +535,7 @@ void SuperSonar<D>::StartSonar()
539535
Trace::MousePointerFocused();
540536
// Cover the entire virtual screen.
541537
// HACK: Draw with 1 pixel off. Otherwise, Windows glitches the task bar transparency when a transparent window fill the whole screen.
542-
SetWindowPos(m_hwnd, HWND_TOPMOST, GetSystemMetrics(SM_XVIRTUALSCREEN) + 1, GetSystemMetrics(SM_YVIRTUALSCREEN) + 1, GetSystemMetrics(SM_CXVIRTUALSCREEN) - 2, GetSystemMetrics(SM_CYVIRTUALSCREEN) - 2, SWP_NOACTIVATE);
538+
SetWindowPos(m_hwnd, HWND_TOPMOST, GetSystemMetrics(SM_XVIRTUALSCREEN) + 1, GetSystemMetrics(SM_YVIRTUALSCREEN) + 1, GetSystemMetrics(SM_CXVIRTUALSCREEN) - 2, GetSystemMetrics(SM_CYVIRTUALSCREEN) - 2, 0);
543539
m_sonarPos = ptNowhere;
544540
OnMouseTimer();
545541
UpdateMouseSnooping();

0 commit comments

Comments
 (0)