forked from Mirror/Ryujinx
Unbind input on middle click (#2358)
* Unbind input on middle click * Clear _middleMousePressed unconditionally * Remove unneded initialization code * Swap conditions * CR fixes
This commit is contained in:
parent
7cf3ce7ed2
commit
9efe124fc5
1 changed files with 9 additions and 2 deletions
|
@ -105,13 +105,13 @@ namespace Ryujinx.Ui.Windows
|
||||||
private IGamepadDriver _gtk3KeyboardDriver;
|
private IGamepadDriver _gtk3KeyboardDriver;
|
||||||
private IGamepad _selectedGamepad;
|
private IGamepad _selectedGamepad;
|
||||||
private bool _mousePressed;
|
private bool _mousePressed;
|
||||||
|
private bool _middleMousePressed;
|
||||||
|
|
||||||
public ControllerWindow(MainWindow mainWindow, PlayerIndex controllerId) : this(mainWindow, new Builder("Ryujinx.Ui.Windows.ControllerWindow.glade"), controllerId) { }
|
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)
|
private ControllerWindow(MainWindow mainWindow, Builder builder, PlayerIndex controllerId) : base(builder.GetObject("_controllerWin").Handle)
|
||||||
{
|
{
|
||||||
_mainWindow = mainWindow;
|
_mainWindow = mainWindow;
|
||||||
_mousePressed = false;
|
|
||||||
_selectedGamepad = null;
|
_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...
|
// 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
|
Application.Invoke(delegate
|
||||||
{
|
{
|
||||||
if (pressedButton != "")
|
if (_middleMousePressed)
|
||||||
|
{
|
||||||
|
button.Label = "Unbound";
|
||||||
|
}
|
||||||
|
else if (pressedButton != "")
|
||||||
{
|
{
|
||||||
button.Label = pressedButton;
|
button.Label = pressedButton;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_middleMousePressed = false;
|
||||||
|
|
||||||
ButtonPressEvent -= MouseClick;
|
ButtonPressEvent -= MouseClick;
|
||||||
keyboard.Dispose();
|
keyboard.Dispose();
|
||||||
|
|
||||||
|
@ -883,6 +889,7 @@ namespace Ryujinx.Ui.Windows
|
||||||
private void MouseClick(object sender, ButtonPressEventArgs args)
|
private void MouseClick(object sender, ButtonPressEventArgs args)
|
||||||
{
|
{
|
||||||
_mousePressed = true;
|
_mousePressed = true;
|
||||||
|
_middleMousePressed = args.Event.Button == 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void SetProfiles()
|
private void SetProfiles()
|
||||||
|
|
Loading…
Reference in a new issue