This patch adds a new screen gesture: you will be able to send "ctrl-p" and "ctrl-n" by horizontally swiping your finger left or right on the bottom of the screen. It is useful if you want to switch through the windows in irssi. See: http://code.google.com/p/connectbot/wiki/ScreenGestures diff -ru connectbot.orig/src/org/connectbot/ConsoleActivity.java connectbot/src/org/connectbot/ConsoleActivity.java --- connectbot.orig/src/org/connectbot/ConsoleActivity.java 2011-01-07 16:10:41.000000000 +0100 +++ connectbot/src/org/connectbot/ConsoleActivity.java 2010-12-22 12:04:45.000000000 +0100 @@ -388,6 +388,7 @@ // detect fling gestures to switch between terminals final GestureDetector detect = new GestureDetector(new GestureDetector.SimpleOnGestureListener() { + private float totalX = 0; private float totalY = 0; @Override @@ -397,6 +398,10 @@ final float disty = e2.getRawY() - e1.getRawY(); final int goalwidth = flip.getWidth() / 2; + // top of the screen only + if(e2.getY() > flip.getHeight() / 2.0) + return false; + // need to slide across half of display to trigger console change // make sure user kept a steady hand horizontally if (Math.abs(disty) < (flip.getHeight() / 4)) { @@ -428,6 +433,7 @@ // if releasing then reset total scroll if (e2.getAction() == MotionEvent.ACTION_UP) { + totalX = 0; totalY = 0; } @@ -467,6 +473,33 @@ } + // activate consider if within y tolerance + } else if(Math.abs(e1.getY() - e2.getY()) < ViewConfiguration.getTouchSlop() * 4) { + + View flip = findCurrentView(R.id.console_flip); + if(flip == null) return false; + TerminalView terminal = (TerminalView)flip; + + totalX += distanceX; + int moved = (int)(totalX / (flip.getWidth() / 10)); + + // bottom of the screen + if (e2.getY() > flip.getHeight() / 2.0) { + + // send keys + if(moved > 1) { + ((vt320)terminal.bridge.buffer).write('n' - 0x60); // ctrl-n + terminal.bridge.tryKeyVibrate(); + totalX = 0; + return true; + } else if (moved < -1) { + ((vt320)terminal.bridge.buffer).write('p' - 0x60); // ctrl-p + terminal.bridge.tryKeyVibrate(); + totalX = 0; + return true; + } + + } } return false;