diff options
author | Jeremy Klein <jlklein@google.com> | 2015-07-23 16:25:18 -0700 |
---|---|---|
committer | Jeremy Klein <jlklein@google.com> | 2015-07-24 10:13:25 -0700 |
commit | e492134e9b1e0cd63e396eda7ff08d46c276ff4c (patch) | |
tree | 1c17a8c634e9708a73aea05ec00713b4a5df899a | |
parent | 99da64bd41bf918a0884a7051983ba6df61b3cb4 (diff) | |
download | connectbot-e492134e9b1e0cd63e396eda7ff08d46c276ff4c.tar.gz connectbot-e492134e9b1e0cd63e396eda7ff08d46c276ff4c.tar.bz2 connectbot-e492134e9b1e0cd63e396eda7ff08d46c276ff4c.zip |
Add mouse wheel scroll support.
-rw-r--r-- | app/app.iml | 6 | ||||
-rw-r--r-- | app/build.gradle | 2 | ||||
-rw-r--r-- | app/src/main/java/org/connectbot/TerminalView.java | 20 |
3 files changed, 24 insertions, 4 deletions
diff --git a/app/app.iml b/app/app.iml index 2b8fc3e..bde98ae 100644 --- a/app/app.iml +++ b/app/app.iml @@ -69,6 +69,7 @@ <excludeFolder url="file://$MODULE_DIR$/build/intermediates/dependency-cache" /> <excludeFolder url="file://$MODULE_DIR$/build/intermediates/dex" /> <excludeFolder url="file://$MODULE_DIR$/build/intermediates/dex-cache" /> + <excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/support-v4/22.2.1/jars" /> <excludeFolder url="file://$MODULE_DIR$/build/intermediates/incremental" /> <excludeFolder url="file://$MODULE_DIR$/build/intermediates/jacoco" /> <excludeFolder url="file://$MODULE_DIR$/build/intermediates/javaResources" /> @@ -82,12 +83,11 @@ <excludeFolder url="file://$MODULE_DIR$/build/intermediates/rs" /> <excludeFolder url="file://$MODULE_DIR$/build/intermediates/symbols" /> <excludeFolder url="file://$MODULE_DIR$/build/outputs" /> - <excludeFolder url="file://$MODULE_DIR$/build/test-results" /> <excludeFolder url="file://$MODULE_DIR$/build/tmp" /> </content> <orderEntry type="jdk" jdkName="Android API 22 Platform" jdkType="Android SDK" /> <orderEntry type="sourceFolder" forTests="false" /> - <orderEntry type="library" exported="" name="support-v4-22.0.0" level="project" /> - <orderEntry type="library" exported="" name="support-annotations-22.0.0" level="project" /> + <orderEntry type="library" exported="" name="support-v4-22.2.1" level="project" /> + <orderEntry type="library" exported="" name="support-annotations-22.2.1" level="project" /> </component> </module>
\ No newline at end of file diff --git a/app/build.gradle b/app/build.gradle index deb9817..3df0ece 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -46,7 +46,7 @@ android { } dependencies { - compile "com.android.support:support-v4:22.0.+" + compile "com.android.support:support-v4:22.2.+" } buildTypes { diff --git a/app/src/main/java/org/connectbot/TerminalView.java b/app/src/main/java/org/connectbot/TerminalView.java index 88fa90d..261407c 100644 --- a/app/src/main/java/org/connectbot/TerminalView.java +++ b/app/src/main/java/org/connectbot/TerminalView.java @@ -39,7 +39,10 @@ import android.graphics.PixelXorXfermode; import android.graphics.RectF; import android.net.Uri; import android.os.AsyncTask; +import android.support.v4.view.MotionEventCompat; +import android.view.InputDevice; import android.view.KeyEvent; +import android.view.MotionEvent; import android.view.View; import android.view.ViewGroup.LayoutParams; import android.view.accessibility.AccessibilityEvent; @@ -319,6 +322,23 @@ public class TerminalView extends View implements FontSizeChangedListener { }; } + @Override + public boolean onGenericMotionEvent(MotionEvent event) { + if ((MotionEventCompat.getSource(event) & InputDevice.SOURCE_CLASS_POINTER) != 0) { + switch (event.getAction()) { + case MotionEvent.ACTION_SCROLL: + // Process scroll wheel movement: + float yDistance = MotionEventCompat.getAxisValue(event, MotionEvent.AXIS_VSCROLL); + if (yDistance != 0) { + int base = bridge.buffer.getWindowBase(); + bridge.buffer.setWindowBase(base - Math.round(yDistance)); + return true; + } + } + } + return super.onGenericMotionEvent(event); + } + public void propagateConsoleText(char[] rawText, int length) { if (mAccessibilityActive) { synchronized (mAccessibilityLock) { |