From 29bceb272f4a3a73cea7acf58df38888da6d53fe Mon Sep 17 00:00:00 2001 From: YoshiRulz Date: Thu, 3 Dec 2020 18:35:24 +1000 Subject: [PATCH] Merge MouseWheelTracker from MainForm interface into InputManager --- src/BizHawk.Client.Common/Api/Classes/InputApi.cs | 9 +++------ src/BizHawk.Client.Common/IMainFormForApi.cs | 3 --- src/BizHawk.Client.Common/inputAdapters/InputManager.cs | 2 +- src/BizHawk.Client.EmuHawk/MainForm.cs | 3 ++- 4 files changed, 6 insertions(+), 11 deletions(-) diff --git a/src/BizHawk.Client.Common/Api/Classes/InputApi.cs b/src/BizHawk.Client.Common/Api/Classes/InputApi.cs index dd3eae3673..3839ea348f 100644 --- a/src/BizHawk.Client.Common/Api/Classes/InputApi.cs +++ b/src/BizHawk.Client.Common/Api/Classes/InputApi.cs @@ -9,13 +9,10 @@ namespace BizHawk.Client.Common private readonly InputManager _inputManager; - private readonly IMainFormForApi _mainForm; - - public InputApi(IMainFormForApi mainForm, IWindowCoordsTransformer displayManager, InputManager inputManager) + public InputApi(IWindowCoordsTransformer displayManager, InputManager inputManager) { _displayManager = displayManager; _inputManager = inputManager; - _mainForm = mainForm; } public Dictionary Get() @@ -27,7 +24,7 @@ namespace BizHawk.Client.Common public Dictionary GetMouse() { - var (pos, lmb, mmb, rmb, x1mb, x2mb) = _inputManager.GetMainFormMouseInfo(); + var (pos, scroll, lmb, mmb, rmb, x1mb, x2mb) = _inputManager.GetMainFormMouseInfo(); // TODO - need to specify whether in "emu" or "native" coordinate space. var p = _displayManager.UntransformPoint(pos); return new Dictionary @@ -39,7 +36,7 @@ namespace BizHawk.Client.Common ["Right"] = rmb, ["XButton1"] = x1mb, ["XButton2"] = x2mb, - ["Wheel"] = _mainForm.MouseWheelTracker + ["Wheel"] = scroll }; } } diff --git a/src/BizHawk.Client.Common/IMainFormForApi.cs b/src/BizHawk.Client.Common/IMainFormForApi.cs index bda8c412ac..389f54b792 100644 --- a/src/BizHawk.Client.Common/IMainFormForApi.cs +++ b/src/BizHawk.Client.Common/IMainFormForApi.cs @@ -26,9 +26,6 @@ namespace BizHawk.Client.Common /// only referenced from EmuClientApi bool IsTurboing { get; } - /// only referenced from InputApi - long MouseWheelTracker { get; } - /// only referenced from (HttpCommunication HTTP, MemoryMappedFiles MMF, SocketServer Sockets) NetworkingHelpers { get; } diff --git a/src/BizHawk.Client.Common/inputAdapters/InputManager.cs b/src/BizHawk.Client.Common/inputAdapters/InputManager.cs index 7e1fb464b3..84f6ef2b8d 100644 --- a/src/BizHawk.Client.Common/inputAdapters/InputManager.cs +++ b/src/BizHawk.Client.Common/inputAdapters/InputManager.cs @@ -47,7 +47,7 @@ namespace BizHawk.Client.Common public Controller ClientControls { get; set; } - public Func<(Point Pos, bool LMB, bool MMB, bool RMB, bool X1MB, bool X2MB)> GetMainFormMouseInfo { get; set; } + public Func<(Point Pos, long Scroll, bool LMB, bool MMB, bool RMB, bool X1MB, bool X2MB)> GetMainFormMouseInfo { get; set; } public void SyncControls(IEmulator emulator, IMovieSession session, Config config) { diff --git a/src/BizHawk.Client.EmuHawk/MainForm.cs b/src/BizHawk.Client.EmuHawk/MainForm.cs index 6f28d28626..82929cd4fd 100644 --- a/src/BizHawk.Client.EmuHawk/MainForm.cs +++ b/src/BizHawk.Client.EmuHawk/MainForm.cs @@ -290,6 +290,7 @@ namespace BizHawk.Client.EmuHawk var b = Control.MouseButtons; return ( Control.MousePosition, + MouseWheelTracker, (b & MouseButtons.Left) != 0, (b & MouseButtons.Middle) != 0, (b & MouseButtons.Right) != 0, @@ -799,7 +800,7 @@ namespace BizHawk.Client.EmuHawk /// public bool InvisibleEmulation { get; set; } - public long MouseWheelTracker { get; private set; } + private long MouseWheelTracker; private int? _pauseOnFrame; public int? PauseOnFrame // If set, upon completion of this frame, the client wil pause