Skip to content

Commit

Permalink
Fix Mouse issues
Browse files Browse the repository at this point in the history
  • Loading branch information
csutorasa committed Nov 10, 2019
1 parent 8041493 commit 799123a
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 3 deletions.
7 changes: 7 additions & 0 deletions XOutput/UI/Windows/AutoConfigureViewModel.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Windows.Threading;
using XOutput.Devices;
using XOutput.Devices.Input;
using XOutput.Devices.Input.Mouse;
using XOutput.Devices.Mapper;
using XOutput.Devices.XInput;
using XOutput.Tools;
Expand All @@ -24,6 +26,7 @@ public class AutoConfigureViewModel : ViewModelBase<AutoConfigureModel>
private XInputTypes xInputType;
private readonly InputSource[] inputTypes;
private DateTime lastTime;
public Func<bool> IsMouseOverButtons { get; set; }

public AutoConfigureViewModel(AutoConfigureModel model, IEnumerable<IInputDevice> inputDevices, InputMapper mapper, XInputTypes[] valuesToRead) : base(model)
{
Expand Down Expand Up @@ -79,6 +82,10 @@ protected void ReadReferenceValues()
/// </summary>
private void ReadValues(object sender, DeviceInputChangedEventArgs e)
{
if(e.Device is Mouse && (IsMouseOverButtons?.Invoke() ?? false))
{
return;
}
var inputDevice = e.Device;
InputSource maxType = null;
double maxDiff = 0;
Expand Down
6 changes: 3 additions & 3 deletions XOutput/UI/Windows/AutoConfigureWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,10 @@
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Button Margin="5 0" Padding="10" Grid.Row="3" Grid.Column="1" Click="DisableClick"
<Button Margin="5 0" Padding="10" Grid.Row="3" Grid.Column="1" Click="DisableClick" Name="DisableButton"
Content="{Binding LanguageModel.Data, Converter={StaticResource LanguageConverter}, ConverterParameter='Disable'}"/>
<Button Margin="5 0" Padding="10" Grid.Row="3" Grid.Column="2" Click="SaveClick"
IsEnabled="{Binding Model.MaxType, Converter={StaticResource NotNullToBoolConverter}}"
<Button Margin="5 0" Padding="10" Grid.Row="3" Grid.Column="2" Click="SaveClick" Name="SaveButton"
IsEnabled="{Binding Model.MaxType, Converter={StaticResource NotNullToBoolConverter}}"
Content="{Binding LanguageModel.Data, Converter={StaticResource LanguageConverter}, ConverterParameter='Save'}"/>
<Button Margin="5 0" Padding="10" Grid.Row="3" Grid.Column="3" Click="CancelClick"
Content="{Binding LanguageModel.Data, Converter={StaticResource LanguageConverter}, ConverterParameter='Cancel'}" />
Expand Down
5 changes: 5 additions & 0 deletions XOutput/UI/Windows/AutoConfigureWindow.xaml.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using System;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Input;
using System.Windows.Threading;

namespace XOutput.UI.Windows
Expand All @@ -27,6 +28,10 @@ private async void WindowLoaded(object sender, RoutedEventArgs e)
{
await Task.Delay(100);
viewModel.Initialize();
viewModel.IsMouseOverButtons = () =>
{
return DisableButton.IsMouseOver || SaveButton.IsMouseOver;
};
if (timed)
{
timer.Interval = TimeSpan.FromMilliseconds(25);
Expand Down

0 comments on commit 799123a

Please sign in to comment.