Skip to content

Commit

Permalink
Disable the block original mouse input checkbox on linux
Browse files Browse the repository at this point in the history
Add tooltip to Simulated Keystroke type to point out mode 6 doesn't work properly on linux
  • Loading branch information
FaithBeam committed Oct 26, 2024
1 parent 9d4006d commit d6074cf
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ public class SimulatedKeystrokesDialogViewModel : DialogBase, IDisposable
private string _description;
private readonly string _title;
private int _caretIndex;
private bool _blockOriginalMouseInput = true;
private bool _blockOriginalMouseInput;
private bool _blockOriginalMouseInputEnabled;
private short _x;
private short _y;
private int _autoRepeatDelay;
Expand Down Expand Up @@ -58,6 +59,9 @@ public SimulatedKeystrokesDialogViewModel(
_customKeys = currentMapping.Keys ?? string.Empty;
_autoRepeatDelay = currentMapping.AutoRepeatDelay ?? 33;
_autoRepeatRandomizeDelayChecked = currentMapping.AutoRepeatRandomizeDelayEnabled ?? false;
_blockOriginalMouseInput =
!OperatingSystem.IsLinux() && (currentMapping.BlockOriginalMouseInput ?? true);
_blockOriginalMouseInputEnabled = !OperatingSystem.IsLinux();
SimulatedKeystrokesType =
currentMapping.SimulatedKeystrokeType ?? new MouseButtonPressedActionTypeVm();
_autoRepeatEnabled =
Expand Down Expand Up @@ -167,6 +171,12 @@ public bool BlockOriginalMouseInput
set => this.RaiseAndSetIfChanged(ref _blockOriginalMouseInput, value);
}

public bool BlockOriginalMouseInputEnabled
{
get => _blockOriginalMouseInputEnabled;
set => this.RaiseAndSetIfChanged(ref _blockOriginalMouseInputEnabled, value);
}

public int AutoRepeatDelay
{
get => _autoRepeatDelay;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public abstract class BaseButtonMappingVm : ReactiveObject, IEquatable<BaseButto
private int? _autoAutoRepeatDelay;
private bool? _autoRepeatRandomizeDelayEnabled;
private bool _state;
private bool _blockOriginalMouseInput;
private bool? _blockOriginalMouseInput;
private BaseSimulatedKeystrokeTypeVm? _simulatedKeystrokeTypeVm;
private bool _selected;
private bool _hasSettingsPopped;
Expand Down Expand Up @@ -96,7 +96,7 @@ public BaseSimulatedKeystrokeTypeVm? SimulatedKeystrokeType
get => _simulatedKeystrokeTypeVm;
set => this.RaiseAndSetIfChanged(ref _simulatedKeystrokeTypeVm, value);
}
public bool BlockOriginalMouseInput
public bool? BlockOriginalMouseInput
{
get => _blockOriginalMouseInput;
set => this.RaiseAndSetIfChanged(ref _blockOriginalMouseInput, value);
Expand Down
2 changes: 1 addition & 1 deletion YMouseButtonControl.DataAccess/Models/ButtonMapping.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public abstract class ButtonMapping
public int? AutoRepeatDelay { get; set; }
public bool? AutoRepeatRandomizeDelayEnabled { get; set; }
public bool Selected { get; set; }
public bool BlockOriginalMouseInput { get; set; }
public bool? BlockOriginalMouseInput { get; set; }
public ButtonMappingType ButtonMappingType { get; set; }
}

Expand Down
32 changes: 26 additions & 6 deletions YMouseButtonControl/Views/Dialogs/SimulatedKeystrokesDialog.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
VerticalContentAlignment="Center" />

<Grid Grid.Row="1" ColumnDefinitions="*,Auto">
<TextBox Text="{Binding CustomKeys}"
<TextBox VerticalContentAlignment="Center" Text="{Binding CustomKeys}"
CaretIndex="{Binding CaretIndex, Mode=TwoWay}" />
<SplitButton Grid.Column="1"
Content="\{\}"
Expand Down Expand Up @@ -91,26 +91,46 @@
ItemsSource="{Binding SimulatedKeystrokesTypes}"
SelectedItem="{Binding SimulatedKeystrokesType}"
HorizontalAlignment="Stretch" />
<ToolTip.Tip>
<TextBlock>
Mode 6 (repeat while mouse down) does not work on Linux.
</TextBlock>
</ToolTip.Tip>
</Grid>

<Grid Grid.Row="3" ColumnDefinitions="*,Auto">
<CheckBox IsChecked="{Binding BlockOriginalMouseInput}" Content="Block original mouse input" />
<!-- Checkbox surrounded with grid to allow tooltip to show even when the control is disabled -->
<Grid>
<CheckBox IsEnabled="{Binding BlockOriginalMouseInputEnabled}"
IsChecked="{Binding BlockOriginalMouseInput}" Content="Block original mouse input">
</CheckBox>
<ToolTip.Tip>
<TextBlock>
Suppress the original mouse click or not.
<LineBreak />
Windows and macOS only.
</TextBlock>
</ToolTip.Tip>
</Grid>
<StackPanel Grid.Column="1">
<Label Content="Auto Repeat Delay" />
<NumericUpDown Value="{Binding AutoRepeatDelay}" IsEnabled="{Binding AutoRepeatEnabled}" VerticalContentAlignment="Center" Minimum="0" FormatString="0">
<NumericUpDown Value="{Binding AutoRepeatDelay}" IsEnabled="{Binding AutoRepeatEnabled}"
VerticalContentAlignment="Center" Minimum="0" FormatString="0">
<ToolTip.Tip>
<TextBlock>
The delay in milliseconds before repeating. 33 is the default.
<LineBreak/>
<LineBreak />
The lower the number, the quicker the repeat. The higher the number, the slower the repeat.
</TextBlock>
</ToolTip.Tip>
</NumericUpDown>
</StackPanel>
</Grid>

<Grid Grid.Row="4">
<CheckBox Content="Randomize auto repeat delay 0%-10%" IsEnabled="{Binding AutoRepeatRandomizeDelayEnabled}" IsChecked="{Binding AutoRepeatRandomizeDelayChecked}" />
<CheckBox Content="Randomize auto repeat delay 0%-10%"
IsEnabled="{Binding AutoRepeatRandomizeDelayEnabled}"
IsChecked="{Binding AutoRepeatRandomizeDelayChecked}" />
</Grid>

<Grid Grid.Row="5">
Expand Down

0 comments on commit d6074cf

Please sign in to comment.