Skip to content

Add cursor dodge options for Always On Top#47235

Open
ozyours wants to merge 3 commits into
microsoft:mainfrom
ozyours:main
Open

Add cursor dodge options for Always On Top#47235
ozyours wants to merge 3 commits into
microsoft:mainfrom
ozyours:main

Conversation

@ozyours
Copy link
Copy Markdown

@ozyours ozyours commented Apr 27, 2026

Summary of the Pull Request

Adds a new Dodge Cursor feature to Always On Top.

This allows a pinned window to automatically move away when it blocks cursor interaction, making it easier to keep a window visible while still clicking content behind it.

PR Checklist

  • Closes: #xxx
  • 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
  • Documentation updated: If checked, please file a pull request on our docs repo and link it here: #xxx

Detailed Description of the Pull Request / Additional comments

This PR introduces Dodge Cursor for Always On Top.

The feature is intended for scenarios where an always-on-top window is useful, such as watching a video while working, but can become intrusive when it blocks interaction with underlying content. With Dodge Cursor enabled, the pinned window automatically dodges the cursor instead of requiring the user to manually move or unpin it.

Validation Steps Performed

  • Built the affected project(s) successfully
  • Launched PowerToys with the updated build
  • Enabled Always On Top and pinned a window
  • Verified the pinned window dodges the cursor when it blocks interaction
  • Performed basic manual regression checks around Always On Top behavior

@github-actions

This comment has been minimized.

Copy link
Copy Markdown
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

Adds a new “Dodge cursor” behavior to the Always On Top module, including Settings UI controls and new module-side logic to animate pinned windows to a different screen corner when the cursor gets close.

Changes:

  • Adds new Always On Top settings (enable, animation interval, corner padding) to the Settings UI model, XAML, and localized strings.
  • Extends Always On Top module settings schema/loader to read the new JSON settings keys (with clamping).
  • Implements a timer-driven cursor proximity check and window “dodge” animation logic in the Always On Top module.

Reviewed changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
src/settings-ui/Settings.UI/ViewModels/AlwaysOnTopViewModel.cs Adds view model properties backing cursor-dodge settings and clamps numeric inputs.
src/settings-ui/Settings.UI/Strings/en-us/Resources.resw Adds localized strings for the new cursor-dodge settings UI.
src/settings-ui/Settings.UI/SettingsXAML/Views/AlwaysOnTopPage.xaml Adds a SettingsExpander UI section for cursor-dodge toggles and numeric controls.
src/settings-ui/Settings.UI.Library/AlwaysOnTopProperties.cs Adds default values and JSON property names for the new cursor-dodge settings.
src/modules/alwaysontop/AlwaysOnTop/SettingsConstants.h Extends SettingId enum with cursor-dodge-related IDs for observer notifications.
src/modules/alwaysontop/AlwaysOnTop/Settings.h Adds cursor-dodge settings fields to the module’s Settings struct.
src/modules/alwaysontop/AlwaysOnTop/Settings.cpp Loads/clamps new cursor-dodge settings from JSON and notifies observers on changes.
src/modules/alwaysontop/AlwaysOnTop/AlwaysOnTop.h Adds per-window state needed for dodge animation and new helper method declarations.
src/modules/alwaysontop/AlwaysOnTop/AlwaysOnTop.cpp Implements timer setup, cursor polling, dodge scoring/selection, and animated window repositioning.

Comment thread src/modules/alwaysontop/AlwaysOnTop/AlwaysOnTop.cpp Outdated
Comment thread src/modules/alwaysontop/AlwaysOnTop/AlwaysOnTop.cpp
…pliance

- Fixes cursor dodge setting reactivity by observing CursorDodgeEnabled changes and routing them through SettingsUpdate.
- Removes unconditional startup timer creation for cursor dodge; timer is now started/stopped based on enableCursorDodge.
- Prevents a visual glitch when disabling cursor dodge mid-animation by finalizing active dodge animations to their target positions before clearing state.
- Keeps border overlays aligned after forced animation finalization.
- Marks local math helpers as constexpr (EaseOutCubic, Interpolate) to satisfy C++ analyzer rule C26497 under /WX.
- Verified with module-only build:
- AlwaysOnTop.vcxproj (Debug|x64) succeeds with 0 errors, 0 warnings.
@github-actions

This comment has been minimized.

@ozyours
Copy link
Copy Markdown
Author

ozyours commented Apr 28, 2026

@microsoft-github-policy-service agree

@niels9001 niels9001 added the Product-Always On Top Refers to the idea of a Always on Top Powertoy label Apr 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Product-Always On Top Refers to the idea of a Always on Top Powertoy

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants