From 764f4ad81e744ce2b1949c6e97a46c0cb40debc8 Mon Sep 17 00:00:00 2001 From: SuuperW Date: Fri, 15 Jan 2021 17:42:49 -0600 Subject: [PATCH] InputRoll: fix right-click cell selection (use OnMouseMove instead of a separate logic that was being used purely because MouseMove wasn't being triggered, display the new selection so the user knows what's up, invoke SelectedIndexChanged event) --- .../CustomControls/InputRoll/InputRoll.cs | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/src/BizHawk.Client.EmuHawk/CustomControls/InputRoll/InputRoll.cs b/src/BizHawk.Client.EmuHawk/CustomControls/InputRoll/InputRoll.cs index 26530e28ab..3774432011 100644 --- a/src/BizHawk.Client.EmuHawk/CustomControls/InputRoll/InputRoll.cs +++ b/src/BizHawk.Client.EmuHawk/CustomControls/InputRoll/InputRoll.cs @@ -1195,21 +1195,22 @@ namespace BizHawk.Client.EmuHawk if (AllowRightClickSelection && e.Button == MouseButtons.Right) { - if (!IsHoveringOnColumnCell && CurrentCell != null) - { - _currentX = e.X; - _currentY = e.Y; - Cell newCell = CalculatePointedCell(_currentX.Value, _currentY.Value); - newCell.RowIndex += FirstVisibleRow; + // In the case that we have a context menu already open, we must manually update the CurrentCell as MouseMove isn't triggered while it is open. + if (CurrentCell == null) + OnMouseMove(e); + if (!IsHoveringOnColumnCell) + { // If this cell is not currently selected, clear and select - if (!_selectedItems.Contains(newCell)) + if (!_selectedItems.Contains(CurrentCell)) { _selectedItems.Clear(); SelectCell(CurrentCell); + + Refresh(); + + SelectedIndexChanged?.Invoke(this, new EventArgs()); } - - CellChanged(newCell); } }