aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorooa113y <13thSlayer@gmail.com>2021-06-23 23:51:29 +0300
committerGitHub <noreply@github.com>2021-06-23 22:51:29 +0200
commit9efe124fc58db84b27b155cf8fa986a51f30a093 (patch)
tree44c0bace9cc9b068fc86d7a2fadc64fc616eff80
parent7cf3ce7ed2dc4af4ed1ae9ba8d67d0941c847d76 (diff)
Unbind input on middle click (#2358)
* Unbind input on middle click * Clear _middleMousePressed unconditionally * Remove unneded initialization code * Swap conditions * CR fixes
-rw-r--r--Ryujinx/Ui/Windows/ControllerWindow.cs11
1 files changed, 9 insertions, 2 deletions
diff --git a/Ryujinx/Ui/Windows/ControllerWindow.cs b/Ryujinx/Ui/Windows/ControllerWindow.cs
index 89afbae2..7a49c7ba 100644
--- a/Ryujinx/Ui/Windows/ControllerWindow.cs
+++ b/Ryujinx/Ui/Windows/ControllerWindow.cs
@@ -105,13 +105,13 @@ namespace Ryujinx.Ui.Windows
private IGamepadDriver _gtk3KeyboardDriver;
private IGamepad _selectedGamepad;
private bool _mousePressed;
+ private bool _middleMousePressed;
public ControllerWindow(MainWindow mainWindow, PlayerIndex controllerId) : this(mainWindow, new Builder("Ryujinx.Ui.Windows.ControllerWindow.glade"), controllerId) { }
private ControllerWindow(MainWindow mainWindow, Builder builder, PlayerIndex controllerId) : base(builder.GetObject("_controllerWin").Handle)
{
_mainWindow = mainWindow;
- _mousePressed = false;
_selectedGamepad = null;
// NOTE: To get input in this window, we need to bind a custom keyboard driver instead of using the InputManager one as the main window isn't focused...
@@ -852,11 +852,17 @@ namespace Ryujinx.Ui.Windows
Application.Invoke(delegate
{
- if (pressedButton != "")
+ if (_middleMousePressed)
+ {
+ button.Label = "Unbound";
+ }
+ else if (pressedButton != "")
{
button.Label = pressedButton;
}
+ _middleMousePressed = false;
+
ButtonPressEvent -= MouseClick;
keyboard.Dispose();
@@ -883,6 +889,7 @@ namespace Ryujinx.Ui.Windows
private void MouseClick(object sender, ButtonPressEventArgs args)
{
_mousePressed = true;
+ _middleMousePressed = args.Event.Button == 2;
}
private void SetProfiles()