From 0fe8bd4b1c0f7b5971dd64dd18ebb2326ddb393e Mon Sep 17 00:00:00 2001 From: Jeremy Klein Date: Wed, 29 Jul 2015 15:52:30 -0700 Subject: Make clicking the mouse wheel paste. --- .../main/java/org/connectbot/ConsoleActivity.java | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) (limited to 'app/src/main/java/org') 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 -- cgit v1.2.3