jmeter-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From vladimirsitni...@apache.org
Subject [jmeter] branch master updated: Use (ctrl|meta)+shift+wheel for font zoom rather than ctrl+zoom
Date Tue, 29 Oct 2019 09:12:08 GMT
This is an automated email from the ASF dual-hosted git repository.

vladimirsitnikov pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/jmeter.git


The following commit(s) were added to refs/heads/master by this push:
     new 38eb2be  Use (ctrl|meta)+shift+wheel for font zoom rather than ctrl+zoom
38eb2be is described below

commit 38eb2be8fb147461f47709f2c85e957518099edb
Author: Vladimir Sitnikov <sitnikov.vladimir@gmail.com>
AuthorDate: Tue Oct 29 12:10:27 2019 +0300

    Use (ctrl|meta)+shift+wheel for font zoom rather than ctrl+zoom
---
 .../main/java/org/apache/jmeter/gui/MainFrame.java  | 21 ++++++++++++++++++++-
 1 file changed, 20 insertions(+), 1 deletion(-)

diff --git a/src/core/src/main/java/org/apache/jmeter/gui/MainFrame.java b/src/core/src/main/java/org/apache/jmeter/gui/MainFrame.java
index 27316e8..c120107 100644
--- a/src/core/src/main/java/org/apache/jmeter/gui/MainFrame.java
+++ b/src/core/src/main/java/org/apache/jmeter/gui/MainFrame.java
@@ -38,6 +38,7 @@ import java.awt.dnd.DropTargetEvent;
 import java.awt.dnd.DropTargetListener;
 import java.awt.event.ActionEvent;
 import java.awt.event.ActionListener;
+import java.awt.event.InputEvent;
 import java.awt.event.KeyEvent;
 import java.awt.event.MouseEvent;
 import java.awt.event.WindowAdapter;
@@ -50,6 +51,7 @@ import java.util.HashSet;
 import java.util.List;
 import java.util.Set;
 import java.util.concurrent.atomic.AtomicInteger;
+import java.util.regex.Pattern;
 
 import javax.swing.AbstractAction;
 import javax.swing.Action;
@@ -130,6 +132,13 @@ public class MainFrame extends JFrame implements TestStateListener, Remoteable,
 
     private static final Logger log = LoggerFactory.getLogger(MainFrame.class);
 
+    private static final String OS_NAME = System.getProperty("os.name");// $NON-NLS-1$
+
+    private static final boolean IS_MAC =
+            Pattern.compile("mac os x|darwin|osx", Pattern.CASE_INSENSITIVE)
+                    .matcher(OS_NAME)
+                    .find();
+
     /** The menu bar. */
     private JMeterMenuBar menuBar;
 
@@ -224,8 +233,18 @@ public class MainFrame extends JFrame implements TestStateListener, Remoteable,
         initTopLevelDndHandler();
         setDefaultCloseOperation(DO_NOTHING_ON_CLOSE);
 
+        int ctrlShiftMask = (IS_MAC ? InputEvent.META_DOWN_MASK : InputEvent.CTRL_DOWN_MASK)
|
+                InputEvent.SHIFT_DOWN_MASK;
+
         addMouseWheelListener(e -> {
-            if (e.isControlDown()) {
+            if (e.getWheelRotation() == 0) {
+                // Nothing to do here. This happens when scroll event is delivered from a
touchbar
+                // or MagicMouse. There's getPreciseWheelRotation, however it looks like
there's no
+                // trivial and consistent way to use that
+                // See https://github.com/JetBrains/intellij-community/blob/21c99af7c78fc82aefc4d05646389f4991b08b38/bin/idea.properties#L133-L156
+                return;
+            }
+            if ((e.getModifiersEx() & ctrlShiftMask) == ctrlShiftMask) {
                 final float scale = 1.1f;
                 int rotation = e.getWheelRotation();
                 if (rotation > 0) { // DOWN


Mime
View raw message