1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-05-05 22:28:57 +02:00

Bug 2146: Keyboard preferences: mouse can select wrong item

Steps to reproduce:
1. Open preferences
2. Select the keyboard category
3. Scroll down the list by any amount
4. Select an item using the mouse. The list scrolls to the top and the wrong item is selected.

The problem occurs because if the list of shortcuts is currently not the focus, then after a left mouse click, KeyView::OnSetFocus() is called, and setting the selection in that function interferes with the mouse selection.

Fix: In KeyView::OnSetFocus(), if there has been a left down event, don't select anything.
This commit is contained in:
David Bailes 2019-06-29 13:47:33 +01:00
parent 748c8d63d8
commit 4b437b8cb9
2 changed files with 13 additions and 2 deletions

View File

@ -1346,8 +1346,13 @@ KeyView::OnSetFocus(wxFocusEvent & event)
{
if (mLines.size() > 0)
{
// if no selection, select first line, if there is one
SelectNode(LineToIndex(0));
// If mThereHasBeenALeftDown is true, then there is mouse
// selection in progress, so don't select anything here
// as this interferes with the mouse selection. (Bug 2146)
if (!mThereHasBeenALeftDown) {
// if no selection, select first line
SelectNode(LineToIndex(0));
}
}
else
{
@ -1373,6 +1378,8 @@ KeyView::OnKillFocus(wxFocusEvent & event)
{
RefreshRow(GetSelection());
}
mThereHasBeenALeftDown = false;
}
//
@ -1618,6 +1625,8 @@ KeyView::OnKeyDown(wxKeyEvent & event)
void
KeyView::OnLeftDown(wxMouseEvent & event)
{
mThereHasBeenALeftDown = true;
// Only check if for tree view
if (mViewType != ViewByTree)
{

View File

@ -164,6 +164,8 @@ private:
int mCommandWidth;
wxCoord mKeyWidth;
bool mThereHasBeenALeftDown{};
#if wxUSE_ACCESSIBILITY
KeyViewAx *mAx;
#endif