Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OSX: scrolling only goes down #2

Closed
yifanlu opened this issue Mar 6, 2019 · 24 comments
Closed

OSX: scrolling only goes down #2

yifanlu opened this issue Mar 6, 2019 · 24 comments
Assignees
Labels
Type: Bug Something isn't working
Milestone

Comments

@yifanlu
Copy link

yifanlu commented Mar 6, 2019

On OSX 10.14.1, when you use the mouse's touch scroll or the touchpad's touch scroll, it will only scroll down regardless of the direction you are scrolling. If mouse scroll direction is set to "Natural" then it's a bit better as upward scrolling works somewhat but it's still buggy because it seems to "resist" the scroll.

@yifanlu yifanlu added the Type: Bug Something isn't working label Mar 6, 2019
@GGG-KILLER
Copy link

GGG-KILLER commented Mar 6, 2019

This is happening on Windows 10 as well, with both scrolling direction configurations.

@JujharSingh
Copy link

I'm also getting this issue on Windows 10 on my Surface Pro 3 trackpad.

@captainGeech42
Copy link

Can confirm with MBP 2018 trackpad, macOS 10.14.1

@captainGeech42
Copy link

One thing of note is that the scrolling behaves correctly on the symbol tree, program trees, and data type manager. Just the asm and decomp views appear to be misbehaving.

@EthanArbuckle
Copy link

+1

@captainGeech42
Copy link

Another thing I found out is if you scroll really fast, it will let you scroll up. Not sure how/why the scroll velocity is a differentiator, but that's a possible workaround. Only tested this on Mac trackpad.

@GGG-KILLER
Copy link

Can confirm that is a possible "workaround" on Windows 10 as well.

@nneonneo
Copy link
Contributor

nneonneo commented Mar 6, 2019

FIXED!

diff --git a/src/Docking/docking/widgets/fieldpanel/FieldPanel.java b/src/Docking/docking/widgets/fieldpanel/FieldPanel.java
index 7194951..4e097fd 100644
--- a/src/Docking/docking/widgets/fieldpanel/FieldPanel.java
+++ b/src/Docking/docking/widgets/fieldpanel/FieldPanel.java
@@ -1420,6 +1420,8 @@ public class FieldPanel extends JPanel
         @Override
         public void mouseWheelMoved(MouseWheelEvent e) {
             int wheelRotation = e.getWheelRotation();
+            if (wheelRotation == 0)
+                return;
             int scrollAmount = (wheelRotation < 0) ? -40 : 40;
             if (hoverHandler.isHoverShowing()) {
                 hoverHandler.scroll(scrollAmount);

Attached is the fixed Docking.jar - replace Ghidra/Framework/Docking/lib/Docking.jar with this copy. (Compressed again as a .zip so it can be attached).

Tested and working on macOS 10.14.3, Java 11.0.2.

Docking.jar.zip

@nneonneo
Copy link
Contributor

nneonneo commented Mar 6, 2019

Second fixed version that uses floating points, which makes it support flinging/high-speed motions and smooth scroll. Scrolling is now buttery-smooth with my trackpad. Use the other one if this one somehow doesn't work.

diff --git a/src/Docking/docking/widgets/fieldpanel/FieldPanel.java b/src/Docking/docking/widgets/fieldpanel/FieldPanel.java
index 7194951..2d72151 100644
--- a/src/Docking/docking/widgets/fieldpanel/FieldPanel.java
+++ b/src/Docking/docking/widgets/fieldpanel/FieldPanel.java
@@ -1419,8 +1419,10 @@ public class FieldPanel extends JPanel
     public class BigFieldPanelMouseWheelListener implements MouseWheelListener {
         @Override
         public void mouseWheelMoved(MouseWheelEvent e) {
-            int wheelRotation = e.getWheelRotation();
-            int scrollAmount = (wheelRotation < 0) ? -40 : 40;
+            double wheelRotation = e.getPreciseWheelRotation();
+            int scrollAmount = (int)(wheelRotation * 40);
+            if (scrollAmount == 0)
+                return;
             if (hoverHandler.isHoverShowing()) {
                 hoverHandler.scroll(scrollAmount);
             }

Docking.jar.zip

@mehdideveloper
Copy link

Thanks for the fixes; They don't work on my systems for some reason (MacBook Pro 2015 and 2018, latest macOS). Replacing the Docking.jar does not change the behaviour :/

@nneonneo
Copy link
Contributor

nneonneo commented Mar 6, 2019

Did you restart Ghidra completely after replacing the file?

@OothecaPickle
Copy link

OothecaPickle commented Mar 6, 2019

@nneonneo how do i build Docking.jar with all the stuff from Docking-src.zip myself?

@nneonneo
Copy link
Contributor

nneonneo commented Mar 6, 2019

@OothecaPickle I didn't build the whole .jar, I just found the file that needed patching and replaced it.

Here's my command, assuming the source is in src/Docking and you're in that directory:

javac -cp $(printf "%s:" $(find ../.. -name '*.jar')) docking/widgets/fieldpanel/FieldPanel.java 
jar -uf ../../Ghidra/Framework/Docking/lib/Docking.jar $(find . -name '*.class')

@mehdideveloper
Copy link

Did you restart Ghidra completely after replacing the file?

Yes

@OothecaPickle
Copy link

OothecaPickle commented Mar 6, 2019

@nneonneo your patch works great for me on my MacBook Air on 10.12.6 and i was able to compile with those commands. thanks! :)

@OothecaPickle
Copy link

after further testing, it only works some of the time, but still, better than before!

@nneonneo
Copy link
Contributor

nneonneo commented Mar 7, 2019

Interesting that the fix doesn’t work all the time. What sorts of things are you seeing when it doesn’t work, @OothecaPickle?

@OothecaPickle
Copy link

@nneonneo if i scroll quickly, scrolling up works fine, but if i scroll slowly it scrolls down.

@ryanmkurtz ryanmkurtz self-assigned this Mar 7, 2019
@ghost
Copy link

ghost commented Mar 7, 2019

Those changes work for me (although I clearly was in a different dir when I built the jar and had to change that a bit), scrolling works perfectly for me now regardless of speed.

@OothecaPickle
Copy link

@6661696c are you using a trackpad or magic mouse?

@ghost
Copy link

ghost commented Mar 7, 2019

Trackpad on 2017 MacBook Pro running 10.14.3.

@ryanmkurtz
Copy link
Collaborator

Thanks for the suggested fix...it will be included in the next release!

@jiva
Copy link

jiva commented Mar 9, 2019

Second fixed version that uses floating points, which makes it support flinging/high-speed motions and smooth scroll. Scrolling is now buttery-smooth with my trackpad. Use the other one if this one somehow doesn't work.

diff --git a/src/Docking/docking/widgets/fieldpanel/FieldPanel.java b/src/Docking/docking/widgets/fieldpanel/FieldPanel.java
index 7194951..2d72151 100644
--- a/src/Docking/docking/widgets/fieldpanel/FieldPanel.java
+++ b/src/Docking/docking/widgets/fieldpanel/FieldPanel.java
@@ -1419,8 +1419,10 @@ public class FieldPanel extends JPanel
     public class BigFieldPanelMouseWheelListener implements MouseWheelListener {
         @Override
         public void mouseWheelMoved(MouseWheelEvent e) {
-            int wheelRotation = e.getWheelRotation();
-            int scrollAmount = (wheelRotation < 0) ? -40 : 40;
+            double wheelRotation = e.getPreciseWheelRotation();
+            int scrollAmount = (int)(wheelRotation * 40);
+            if (scrollAmount == 0)
+                return;
             if (hoverHandler.isHoverShowing()) {
                 hoverHandler.scroll(scrollAmount);
             }

Docking.jar.zip

This works nicely - thanks for the fix!

Does your sideways scroll work on MacOS? Mine doesn't seem to work properly.

@dirac-comb
Copy link

dirac-comb commented Mar 10, 2019

@jiva Looks like it would take quite a bit of effort to make that work, the layout handler doesn't support horizontal scrolling and the java API being used here doesn't understand that touchpad scrolling exists :/

kant2002 added a commit to kant2002/Ghidra that referenced this issue Mar 24, 2019
kant2002 added a commit to kant2002/Ghidra that referenced this issue Mar 26, 2019
kant2002 added a commit to kant2002/Ghidra that referenced this issue Mar 26, 2019
kant2002 added a commit to kant2002/Ghidra that referenced this issue Mar 26, 2019
NationalSecurityAgency/ghidra#2

Signed-off-by: Andrii Kurdiumov <kant2002@gmail.com>
boricj added a commit to boricj/ghidra that referenced this issue Oct 31, 2023
* reformat Unix Aout loader

* rename UnixAoutRelocation class

* rename UnixAoutSymbol class

* rework Unix Aout loader
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Bug Something isn't working
Projects
None yet
Development

No branches or pull requests