From: gmungoc Date: Thu, 1 Sep 2016 09:53:37 +0000 (+0100) Subject: JAL-2077 force defer right-click handling to mouseReleased on Windows X-Git-Tag: Release_2_10_0~57 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=99e8c69c6a6f4ea5e63d61b40376bb98fb1ae9a7;p=jalview.git JAL-2077 force defer right-click handling to mouseReleased on Windows --- diff --git a/src/jalview/gui/AnnotationPanel.java b/src/jalview/gui/AnnotationPanel.java index 60c9547..04590ba 100755 --- a/src/jalview/gui/AnnotationPanel.java +++ b/src/jalview/gui/AnnotationPanel.java @@ -532,6 +532,10 @@ public class AnnotationPanel extends JPanel implements AwtRenderPanelI, } } + /* + * isPopupTrigger fires in mousePressed on Mac, + * not until mouseRelease on Windows + */ if (evt.isPopupTrigger() && activeRow != -1) { showPopupMenu(y, evt.getX()); diff --git a/src/jalview/gui/IdPanel.java b/src/jalview/gui/IdPanel.java index e5870df..2aa7bf5 100755 --- a/src/jalview/gui/IdPanel.java +++ b/src/jalview/gui/IdPanel.java @@ -26,6 +26,7 @@ import jalview.datamodel.SequenceGroup; import jalview.datamodel.SequenceI; import jalview.io.SequenceAnnotationReport; import jalview.util.MessageManager; +import jalview.util.Platform; import jalview.util.UrlLink; import jalview.viewmodel.AlignmentViewport; @@ -322,6 +323,14 @@ public class IdPanel extends JPanel implements MouseListener, return; } + /* + * defer right-mouse click handling to mouse up on Mac + * (where isPopupTrigger() will answer true) + */ + if (SwingUtilities.isRightMouseButton(e) && !Platform.isAMac()) + { + return; + } if ((av.getSelectionGroup() == null) || (!jalview.util.Platform.isControlDown(e) diff --git a/src/jalview/gui/ScalePanel.java b/src/jalview/gui/ScalePanel.java index bb2e0d7..2efcbff 100755 --- a/src/jalview/gui/ScalePanel.java +++ b/src/jalview/gui/ScalePanel.java @@ -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();