From a8d48325d5e6fe0466502b865c82317b6f7410a2 Mon Sep 17 00:00:00 2001 From: a1xd <68629610+a1xd@users.noreply.github.com> Date: Mon, 6 Sep 2021 23:24:51 -0400 Subject: get grapher building --- grapher/Models/Mouse/MouseWatcher.cs | 20 ++------------------ 1 file changed, 2 insertions(+), 18 deletions(-) (limited to 'grapher/Models/Mouse') diff --git a/grapher/Models/Mouse/MouseWatcher.cs b/grapher/Models/Mouse/MouseWatcher.cs index c5c2ae5..c36ceb4 100644 --- a/grapher/Models/Mouse/MouseWatcher.cs +++ b/grapher/Models/Mouse/MouseWatcher.cs @@ -691,7 +691,6 @@ namespace grapher.Models.Mouse AccelCharts = accelCharts; SettingsManager = setMngr; MouseData = new MouseData(); - DeviceHandles = new List(); RAWINPUTDEVICE device = new RAWINPUTDEVICE(); device.WindowHandle = ContainingForm.Handle; @@ -722,10 +721,6 @@ namespace grapher.Models.Mouse private Stopwatch Stopwatch { get; } - private List DeviceHandles { get; } - - private bool AnyDevice { get; set; } - private double PollTime { get => 1000 / SettingsManager.PollRateField.Data; @@ -735,16 +730,6 @@ namespace grapher.Models.Mouse #region Methods - public void UpdateHandles(string devID) - { - DeviceHandles.Clear(); - AnyDevice = string.IsNullOrEmpty(devID); - if (!AnyDevice) - { - RawInputInterop.AddHandlesFromID(devID, DeviceHandles); - } - } - public void UpdateLastMove() { MouseData.Get(out var x, out var y); @@ -758,7 +743,7 @@ namespace grapher.Models.Mouse _ = GetRawInputData(message.LParam, RawInputCommand.Input, out rawInput, ref size, Marshal.SizeOf(typeof(RAWINPUTHEADER))); bool relative = !rawInput.Data.Mouse.Flags.HasFlag(RawMouseFlags.MoveAbsolute); - bool deviceMatch = AnyDevice || DeviceHandles.Contains(rawInput.Header.Device); + bool deviceMatch = SettingsManager.ActiveHandles.Contains(rawInput.Header.Device); if (relative && deviceMatch && (rawInput.Data.Mouse.LastX != 0 || rawInput.Data.Mouse.LastY != 0)) { @@ -772,8 +757,7 @@ namespace grapher.Models.Mouse // strip negative directional multipliers, charts calculated from positive input - Vec2 dirMults = SettingsManager.ActiveSettings.baseSettings - .directionalMultipliers; + Vec2 dirMults = SettingsManager.ActiveProfile.directionalMultipliers; if (dirMults.x > 0 && x < 0) { -- cgit v1.2.3 From 94ce1542b03090b81a4250f7f799895c58ab286c Mon Sep 17 00:00:00 2001 From: a1xd <68629610+a1xd@users.noreply.github.com> Date: Sat, 18 Sep 2021 05:34:59 -0400 Subject: rename directional multipliers changes profile layout --- grapher/Models/Mouse/MouseWatcher.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'grapher/Models/Mouse') diff --git a/grapher/Models/Mouse/MouseWatcher.cs b/grapher/Models/Mouse/MouseWatcher.cs index c36ceb4..91eebb8 100644 --- a/grapher/Models/Mouse/MouseWatcher.cs +++ b/grapher/Models/Mouse/MouseWatcher.cs @@ -757,7 +757,11 @@ namespace grapher.Models.Mouse // strip negative directional multipliers, charts calculated from positive input - Vec2 dirMults = SettingsManager.ActiveProfile.directionalMultipliers; + Vec2 dirMults = new Vec2 + { + x = SettingsManager.ActiveProfile.lrSensRatio, + y = SettingsManager.ActiveProfile.udSensRatio + }; if (dirMults.x > 0 && x < 0) { -- cgit v1.2.3 From 79c6a885fc732a0fff0fe694a86ed6450b00794b Mon Sep 17 00:00:00 2001 From: a1xd <68629610+a1xd@users.noreply.github.com> Date: Thu, 23 Sep 2021 00:21:57 -0400 Subject: add indicator to last move on normalized dev read --- grapher/Models/Mouse/MouseWatcher.cs | 29 +++++++++++++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) (limited to 'grapher/Models/Mouse') diff --git a/grapher/Models/Mouse/MouseWatcher.cs b/grapher/Models/Mouse/MouseWatcher.cs index 91eebb8..723f97b 100644 --- a/grapher/Models/Mouse/MouseWatcher.cs +++ b/grapher/Models/Mouse/MouseWatcher.cs @@ -692,6 +692,9 @@ namespace grapher.Models.Mouse SettingsManager = setMngr; MouseData = new MouseData(); + LastMoveDisplayFormat = Constants.MouseMoveDefaultFormat; + LastMoveNormalized = false; + RAWINPUTDEVICE device = new RAWINPUTDEVICE(); device.WindowHandle = ContainingForm.Handle; device.UsagePage = HIDUsagePage.Generic; @@ -721,6 +724,10 @@ namespace grapher.Models.Mouse private Stopwatch Stopwatch { get; } + private string LastMoveDisplayFormat { get; set; } + + private bool LastMoveNormalized { get; set; } + private double PollTime { get => 1000 / SettingsManager.PollRateField.Data; @@ -733,7 +740,7 @@ namespace grapher.Models.Mouse public void UpdateLastMove() { MouseData.Get(out var x, out var y); - Display.Text = $"Last (x, y): ({x}, {y})"; + Display.Text = string.Format(LastMoveDisplayFormat, x, y); } public void ReadMouseMove(Message message) @@ -743,7 +750,25 @@ namespace grapher.Models.Mouse _ = GetRawInputData(message.LParam, RawInputCommand.Input, out rawInput, ref size, Marshal.SizeOf(typeof(RAWINPUTHEADER))); bool relative = !rawInput.Data.Mouse.Flags.HasFlag(RawMouseFlags.MoveAbsolute); - bool deviceMatch = SettingsManager.ActiveHandles.Contains(rawInput.Header.Device); + + bool deviceMatch = false; + foreach (var (handle, normalized) in SettingsManager.ActiveNormTaggedHandles) + { + if (handle == rawInput.Header.Device) + { + deviceMatch = true; + + if (normalized != LastMoveNormalized) + { + LastMoveDisplayFormat = normalized ? + Constants.MouseMoveNormalizedFormat : + Constants.MouseMoveDefaultFormat; + LastMoveNormalized = normalized; + } + + break; + } + } if (relative && deviceMatch && (rawInput.Data.Mouse.LastX != 0 || rawInput.Data.Mouse.LastY != 0)) { -- cgit v1.2.3 From f9323128aeffbfd2fe2931d6e5ad29acd394d878 Mon Sep 17 00:00:00 2001 From: a1xd <68629610+a1xd@users.noreply.github.com> Date: Thu, 23 Sep 2021 03:11:17 -0400 Subject: change MouseMoveNormalizedFormat --- grapher/Models/Mouse/MouseWatcher.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'grapher/Models/Mouse') diff --git a/grapher/Models/Mouse/MouseWatcher.cs b/grapher/Models/Mouse/MouseWatcher.cs index 723f97b..fb34dd6 100644 --- a/grapher/Models/Mouse/MouseWatcher.cs +++ b/grapher/Models/Mouse/MouseWatcher.cs @@ -761,8 +761,8 @@ namespace grapher.Models.Mouse if (normalized != LastMoveNormalized) { LastMoveDisplayFormat = normalized ? - Constants.MouseMoveNormalizedFormat : - Constants.MouseMoveDefaultFormat; + Constants.MouseMoveNormalizedFormat : + Constants.MouseMoveDefaultFormat; LastMoveNormalized = normalized; } -- cgit v1.2.3