Compare commits

...

3 Commits

Author SHA1 Message Date
copilot-swe-agent[bot]
b562f5df3a Add disable option for Gliding Cursor feature
Co-authored-by: vanzue <69313318+vanzue@users.noreply.github.com>
2025-09-24 07:49:00 +00:00
copilot-swe-agent[bot]
ed57f2d107 Initial analysis complete - Add plan to implement gliding cursor disable option
Co-authored-by: vanzue <69313318+vanzue@users.noreply.github.com>
2025-09-24 07:42:48 +00:00
copilot-swe-agent[bot]
1e9c7ec526 Initial plan 2025-09-24 07:38:38 +00:00
6 changed files with 64 additions and 3 deletions

View File

@@ -33,6 +33,7 @@ namespace
const wchar_t JSON_KEY_AUTO_ACTIVATE[] = L"auto_activate";
const wchar_t JSON_KEY_GLIDE_TRAVEL_SPEED[] = L"gliding_travel_speed";
const wchar_t JSON_KEY_GLIDE_DELAY_SPEED[] = L"gliding_delay_speed";
const wchar_t JSON_KEY_GLIDING_CURSOR_ENABLED[] = L"gliding_cursor_enabled";
}
extern "C" IMAGE_DOS_HEADER __ImageBase;
@@ -106,6 +107,9 @@ private:
// Gliding cursor state machine
std::atomic<int> m_glideState{ 0 }; // 0..4 like the AHK script
// Gliding cursor enabled state
bool m_glidingCursorEnabled = true;
// Timer configuration: 10ms tick, speeds are defined per 200ms base window
static constexpr int kTimerTickMs = 10;
static constexpr int kBaseSpeedTickMs = 200; // mapping period for configured pixel counts
@@ -387,6 +391,11 @@ private:
void HandleGlidingHotkey()
{
if (!m_glidingCursorEnabled)
{
return;
}
auto s = m_state;
if (!s)
{
@@ -734,6 +743,17 @@ private:
m_state->slowVSpeed = 5;
}
}
try
{
// Parse Gliding Cursor Enabled
auto jsonPropertiesObject = settingsObject.GetNamedObject(JSON_KEY_PROPERTIES).GetNamedObject(JSON_KEY_GLIDING_CURSOR_ENABLED);
m_glidingCursorEnabled = jsonPropertiesObject.GetNamedBoolean(JSON_KEY_VALUE);
}
catch (...)
{
Logger::info("Failed to initialize gliding cursor enabled from settings. Using default true.");
m_glidingCursorEnabled = true;
}
}
else
{

View File

@@ -58,6 +58,9 @@ namespace Microsoft.PowerToys.Settings.UI.Library
[JsonPropertyName("gliding_delay_speed")]
public IntProperty GlidingDelaySpeed { get; set; }
[JsonPropertyName("gliding_cursor_enabled")]
public BoolProperty GlidingCursorEnabled { get; set; }
public MousePointerCrosshairsProperties()
{
ActivationShortcut = DefaultActivationShortcut;
@@ -74,6 +77,7 @@ namespace Microsoft.PowerToys.Settings.UI.Library
AutoActivate = new BoolProperty(false);
GlidingTravelSpeed = new IntProperty(25);
GlidingDelaySpeed = new IntProperty(5);
GlidingCursorEnabled = new BoolProperty(true);
}
}
}

View File

@@ -389,15 +389,26 @@
x:Uid="MouseUtils_GlidingCursor"
HeaderIcon="{ui:FontIcon Glyph=&#xECE7;}"
IsEnabled="{x:Bind ViewModel.IsMousePointerCrosshairsEnabled, Mode=OneWay}">
<controls:ShortcutControl MinWidth="{StaticResource SettingActionControlMinWidth}" HotkeySettings="{x:Bind Path=ViewModel.GlidingCursorActivationShortcut, Mode=TwoWay}" />
<ToggleSwitch
x:Uid="ToggleSwitch"
IsOn="{x:Bind ViewModel.GlidingCursorEnabled, Mode=TwoWay}" />
<tkcontrols:SettingsExpander.Items>
<tkcontrols:SettingsCard x:Uid="MouseUtils_GlidingCursor_InitialSpeed">
<tkcontrols:SettingsCard
x:Uid="MouseUtils_GlidingCursor_Shortcut"
IsEnabled="{x:Bind ViewModel.GlidingCursorEnabled, Mode=OneWay}">
<controls:ShortcutControl MinWidth="{StaticResource SettingActionControlMinWidth}" HotkeySettings="{x:Bind Path=ViewModel.GlidingCursorActivationShortcut, Mode=TwoWay}" />
</tkcontrols:SettingsCard>
<tkcontrols:SettingsCard
x:Uid="MouseUtils_GlidingCursor_InitialSpeed"
IsEnabled="{x:Bind ViewModel.GlidingCursorEnabled, Mode=OneWay}">
<Slider
Maximum="60"
Minimum="5"
Value="{x:Bind ViewModel.GlidingCursorTravelSpeed, Mode=TwoWay}" />
</tkcontrols:SettingsCard>
<tkcontrols:SettingsCard x:Uid="MouseUtils_GlidingCursor_DelaySpeed">
<tkcontrols:SettingsCard
x:Uid="MouseUtils_GlidingCursor_DelaySpeed"
IsEnabled="{x:Bind ViewModel.GlidingCursorEnabled, Mode=OneWay}">
<Slider
Maximum="60"
Minimum="5"

View File

@@ -2914,6 +2914,12 @@ Right-click to remove the key combination, thereby deactivating the shortcut.</v
<data name="MouseUtils_GlidingCursor_DelaySpeed.Description" xml:space="preserve">
<value>Speed after slowing down the line with a second shortcut press</value>
</data>
<data name="MouseUtils_GlidingCursor_Shortcut.Header" xml:space="preserve">
<value>Activation shortcut</value>
</data>
<data name="MouseUtils_GlidingCursor_Shortcut.Description" xml:space="preserve">
<value>Shortcut to activate gliding cursor</value>
</data>
<data name="FancyZones_Radio_Custom_Colors.Content" xml:space="preserve">
<value>Custom colors</value>
</data>

View File

@@ -102,6 +102,7 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
_mousePointerCrosshairsIsFixedLengthEnabled = MousePointerCrosshairsSettingsConfig.Properties.CrosshairsIsFixedLengthEnabled.Value;
_mousePointerCrosshairsFixedLength = MousePointerCrosshairsSettingsConfig.Properties.CrosshairsFixedLength.Value;
_mousePointerCrosshairsAutoActivate = MousePointerCrosshairsSettingsConfig.Properties.AutoActivate.Value;
_glidingCursorEnabled = MousePointerCrosshairsSettingsConfig.Properties.GlidingCursorEnabled.Value;
int isEnabled = 0;
@@ -949,6 +950,24 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
}
}
public bool GlidingCursorEnabled
{
get
{
return _glidingCursorEnabled;
}
set
{
if (value != _glidingCursorEnabled)
{
_glidingCursorEnabled = value;
MousePointerCrosshairsSettingsConfig.Properties.GlidingCursorEnabled.Value = value;
NotifyMousePointerCrosshairsPropertyChanged();
}
}
}
public void NotifyMousePointerCrosshairsPropertyChanged([CallerMemberName] string propertyName = null)
{
OnPropertyChanged(propertyName);
@@ -1012,6 +1031,7 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
private bool _mousePointerCrosshairsIsFixedLengthEnabled;
private int _mousePointerCrosshairsFixedLength;
private bool _mousePointerCrosshairsAutoActivate;
private bool _glidingCursorEnabled;
private bool _isAnimationEnabledBySystem;
}
}

0
tools/build/build-essentials.cmd Normal file → Executable file
View File