JAL-2077 force defer right-click handling to mouseReleased on Windows
[jalview.git] / src / jalview / gui / ScalePanel.java
index bb2e0d7..2efcbff 100755 (executable)
@@ -43,6 +43,7 @@ import java.util.List;
 import javax.swing.JMenuItem;
 import javax.swing.JPanel;
 import javax.swing.JPopupMenu;
+import javax.swing.SwingUtilities;
 import javax.swing.ToolTipManager;
 
 /**
@@ -100,6 +101,15 @@ public class ScalePanel extends JPanel implements MouseMotionListener,
   @Override
   public void mousePressed(MouseEvent evt)
   {
+    /*
+     * defer right-mouse click handling to mouse up on Mac
+     * (where isPopupTrigger() will answer true)
+     */
+    if (SwingUtilities.isRightMouseButton(evt) && !Platform.isAMac())
+    {
+      return;
+    }
+
     int x = (evt.getX() / av.getCharWidth()) + av.getStartRes();
     final int res;
 
@@ -222,6 +232,11 @@ public class ScalePanel extends JPanel implements MouseMotionListener,
    */
   protected void leftMouseButtonPressed(MouseEvent evt, final int res)
   {
+    /*
+     * Ctrl-click/Cmd-click adds to the selection
+     * Shift-click extends the selection
+     */
+    // TODO Problem: right-click on Windows not reported until mouseReleased?!?
     if (!Platform.isControlDown(evt) && !evt.isShiftDown())
     {
       av.getColumnSelection().clear();