diff options
author | Jeremy Klein <jlklein@google.com> | 2015-07-29 15:52:30 -0700 |
---|---|---|
committer | Jeremy Klein <jlklein@google.com> | 2015-07-29 17:21:54 -0700 |
commit | 0fe8bd4b1c0f7b5971dd64dd18ebb2326ddb393e (patch) | |
tree | 35f78a54a460b31915ca5f8b20e3008cb426abef /app | |
parent | 625122d39150a0c0f4717c3e00c2b0c3b8fd074b (diff) | |
download | connectbot-0fe8bd4b1c0f7b5971dd64dd18ebb2326ddb393e.tar.gz connectbot-0fe8bd4b1c0f7b5971dd64dd18ebb2326ddb393e.tar.bz2 connectbot-0fe8bd4b1c0f7b5971dd64dd18ebb2326ddb393e.zip |
Make clicking the mouse wheel paste.
Diffstat (limited to 'app')
-rw-r--r-- | app/src/main/java/org/connectbot/ConsoleActivity.java | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/app/src/main/java/org/connectbot/ConsoleActivity.java b/app/src/main/java/org/connectbot/ConsoleActivity.java index 4e4c4e2..179da72 100644 --- a/app/src/main/java/org/connectbot/ConsoleActivity.java +++ b/app/src/main/java/org/connectbot/ConsoleActivity.java @@ -559,13 +559,23 @@ public class ConsoleActivity extends Activity { public boolean onTouch(View v, MotionEvent event) { - // Automatically start copy mode if using a mouse. + // Handle mouse-specific actions. if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH && MotionEventCompat.getSource(event) == InputDevice.SOURCE_MOUSE && - event.getAction() == MotionEvent.ACTION_DOWN && - // Ignore right clicks. - event.getButtonState() == MotionEvent.BUTTON_PRIMARY) { - startCopyMode(); + event.getAction() == MotionEvent.ACTION_DOWN) { + switch(event.getButtonState()) { + case MotionEvent.BUTTON_PRIMARY: + // Automatically start copy mode if using a mouse. + startCopyMode(); + break; + case MotionEvent.BUTTON_SECONDARY: + // Let the context menu show on right click. + return false; + case MotionEvent.BUTTON_TERTIARY: + // Middle click pastes. + pasteIntoTerminal(); + return true; + } } // when copying, highlight the area |