double click fix

This commit is contained in:
Radek Davidek 2026-01-20 18:29:10 +01:00
parent d15f1544d1
commit a3f97f9369
3 changed files with 4 additions and 4 deletions

View File

@ -57,7 +57,7 @@ public class DriveSelector extends JDialog {
driveList.addMouseListener(new java.awt.event.MouseAdapter() { driveList.addMouseListener(new java.awt.event.MouseAdapter() {
@Override @Override
public void mouseClicked(java.awt.event.MouseEvent e) { public void mouseClicked(java.awt.event.MouseEvent e) {
if (e.getClickCount() == 2) { if (e.getClickCount() >= 2 && e.getClickCount() % 2 == 0) {
int index = driveList.locationToIndex(e.getPoint()); int index = driveList.locationToIndex(e.getPoint());
if (index >= 0) { if (index >= 0) {
selectedDrive = drives.get(index).getRoot(); selectedDrive = drives.get(index).getRoot();

View File

@ -302,7 +302,7 @@ public class FilePanelTab extends JPanel {
// Single left-click should focus/select the item under cursor but // Single left-click should focus/select the item under cursor but
// should NOT toggle its marked state. This preserves keyboard // should NOT toggle its marked state. This preserves keyboard
// marking (Insert) while making mouse clicks act as simple focus. // marking (Insert) while making mouse clicks act as simple focus.
if (e.getClickCount() == 1 && javax.swing.SwingUtilities.isLeftMouseButton(e)) { if (e.getClickCount() % 2 == 1 && javax.swing.SwingUtilities.isLeftMouseButton(e)) {
boolean selected = false; boolean selected = false;
if (row >= 0) { if (row >= 0) {
// Convert brief layout coordinates to absolute index where needed // Convert brief layout coordinates to absolute index where needed
@ -336,7 +336,7 @@ public class FilePanelTab extends JPanel {
} }
// Double-click opens the item under cursor (directories) // Double-click opens the item under cursor (directories)
if (e.getClickCount() == 2) { if (e.getClickCount() >= 2 && e.getClickCount() % 2 == 0) {
openItemAtPoint(e.getPoint()); openItemAtPoint(e.getPoint());
} }

View File

@ -146,7 +146,7 @@ public class SearchDialog extends JDialog {
resultsTable.addMouseListener(new java.awt.event.MouseAdapter() { resultsTable.addMouseListener(new java.awt.event.MouseAdapter() {
@Override @Override
public void mouseClicked(java.awt.event.MouseEvent e) { public void mouseClicked(java.awt.event.MouseEvent e) {
if (e.getClickCount() == 2) { if (e.getClickCount() >= 2 && e.getClickCount() % 2 == 0) {
openSelectedFile(); openSelectedFile();
} }
} }