/** Overriding {@link View#onGenericMotionEvent(MotionEvent)}. */ @Override public boolean onGenericMotionEvent(MotionEvent event) { if (mEmulator != null && event.isFromSource(InputDevice.SOURCE_MOUSE) && event.getAction() == MotionEvent.ACTION_SCROLL) { // Handle mouse wheel scrolling. boolean up = event.getAxisValue(MotionEvent.AXIS_VSCROLL) > 0.0f; doScroll(event, up ? -3 : 3); return true; } return false; }
@Override public boolean onScroll(MotionEvent e, float distanceX, float distanceY) { if (mEmulator == null || mIsSelectingText) return true; if (mEmulator.isMouseTrackingActive() && e.isFromSource(InputDevice.SOURCE_MOUSE)) { // If moving with mouse pointer while pressing button, report that instead of scroll. // This means that we never report moving with button press-events for touch input, // since we cannot just start sending these events without a starting press event, // which we do not do for touch input, only mouse in onTouchEvent(). sendMouseEventCode(e, TerminalEmulator.MOUSE_LEFT_BUTTON_MOVED, true); } else { scrolledWithFinger = true; distanceY += mScrollRemainder; int deltaRows = (int) (distanceY / mRenderer.mFontLineSpacing); mScrollRemainder = distanceY - deltaRows * mRenderer.mFontLineSpacing; doScroll(e, deltaRows); } return true; }
@Override public boolean onSingleTapUp(MotionEvent e) { if (mEmulator == null) return true; if (mIsSelectingText) { toggleSelectingText(null); return true; } requestFocus(); if (!mEmulator.isMouseTrackingActive()) { if (!e.isFromSource(InputDevice.SOURCE_MOUSE)) { mClient.onSingleTapUp(e); return true; } } return false; }
} else if (ev.isFromSource(InputDevice.SOURCE_MOUSE)) { if (ev.isButtonPressed(MotionEvent.BUTTON_SECONDARY)) { if (action == MotionEvent.ACTION_DOWN) showContextMenu();
final boolean eventFromMouse = ev.isFromSource(InputDevice.SOURCE_MOUSE);
/** Overriding {@link View#onGenericMotionEvent(MotionEvent)}. */ @Override public boolean onGenericMotionEvent(MotionEvent event) { if (mEmulator != null && event.isFromSource(InputDevice.SOURCE_MOUSE) && event.getAction() == MotionEvent.ACTION_SCROLL) { // Handle mouse wheel scrolling. boolean up = event.getAxisValue(MotionEvent.AXIS_VSCROLL) > 0.0f; doScroll(event, up ? -3 : 3); return true; } return false; }
@Override public boolean onScroll(MotionEvent e, float distanceX, float distanceY) { if (mEmulator == null || mIsSelectingText) return true; if (mEmulator.isMouseTrackingActive() && e.isFromSource(InputDevice.SOURCE_MOUSE)) { // If moving with mouse pointer while pressing button, report that instead of scroll. // This means that we never report moving with button press-events for touch input, // since we cannot just start sending these events without a starting press event, // which we do not do for touch input, only mouse in onTouchEvent(). sendMouseEventCode(e, TerminalEmulator.MOUSE_LEFT_BUTTON_MOVED, true); } else { scrolledWithFinger = true; distanceY += mScrollRemainder; int deltaRows = (int) (distanceY / mRenderer.mFontLineSpacing); mScrollRemainder = distanceY - deltaRows * mRenderer.mFontLineSpacing; doScroll(e, deltaRows); } return true; }
@Override public boolean dispatchGenericMotionEvent(MotionEvent event) { // Check that the event came from a joystick since a generic motion event // could be almost anything. if (event.isFromSource(InputDevice.SOURCE_CLASS_JOYSTICK) && event.getAction() == MotionEvent.ACTION_MOVE) { // Update device state for visualization and logging. InputDeviceState state = getInputDeviceState(event.getDeviceId()); if (state != null && state.onJoystickMotion(event)) { mSummaryAdapter.show(state); } } return super.dispatchGenericMotionEvent(event); }
@Override public boolean dispatchGenericMotionEvent(MotionEvent event) { // Check that the event came from a joystick since a generic motion event // could be almost anything. if (event.isFromSource(InputDevice.SOURCE_CLASS_JOYSTICK) && event.getAction() == MotionEvent.ACTION_MOVE) { // Update device state for visualization and logging. InputDeviceState state = getInputDeviceState(event.getDeviceId()); if (state != null && state.onJoystickMotion(event)) { mSummaryAdapter.show(state); } } return super.dispatchGenericMotionEvent(event); }
@Override public boolean onSingleTapUp(MotionEvent e) { if (mEmulator == null) return true; if (mIsSelectingText) { toggleSelectingText(null); return true; } requestFocus(); if (!mEmulator.isMouseTrackingActive()) { if (!e.isFromSource(InputDevice.SOURCE_MOUSE)) { mClient.onSingleTapUp(e); return true; } } return false; }
} else if (ev.isFromSource(InputDevice.SOURCE_MOUSE)) { if (ev.isButtonPressed(MotionEvent.BUTTON_SECONDARY)) { if (action == MotionEvent.ACTION_DOWN) showContextMenu();
final boolean eventFromMouse = ev.isFromSource(InputDevice.SOURCE_MOUSE);
if (event.isFromSource(InputDevice.SOURCE_CLASS_JOYSTICK) && event.getAction() == MotionEvent.ACTION_MOVE) {
if (event.isFromSource(InputDevice.SOURCE_CLASS_JOYSTICK) && event.getAction() == MotionEvent.ACTION_MOVE) {