コード例 #1
0
ファイル: SessionActivity.java プロジェクト: bailli/FreeRDP
  @Override
  public void onTouchPointerMove(int x, int y) {
    Point p = mapScreenCoordToSessionCoord(x, y);
    LibFreeRDP.sendCursorEvent(session.getInstance(), p.x, p.y, Mouse.getMoveEvent());

    if (autoScrollTouchPointer && !uiHandler.hasMessages(UIHandler.SCROLLING_REQUESTED)) {
      Log.v(TAG, "Starting auto-scroll");
      uiHandler.sendEmptyMessageDelayed(UIHandler.SCROLLING_REQUESTED, SCROLLING_TIMEOUT);
    }
  }
コード例 #2
0
ファイル: SessionActivity.java プロジェクト: bailli/FreeRDP
  @Override
  public void OnGraphicsUpdate(int x, int y, int width, int height) {
    LibFreeRDP.updateGraphics(session.getInstance(), bitmap, x, y, width, height);

    sessionView.addInvalidRegion(new Rect(x, y, x + width, y + height));

    /* since sessionView can only be modified from the UI thread
     * any modifications to it need to be scheduled */

    uiHandler.sendEmptyMessage(UIHandler.REFRESH_SESSIONVIEW);
  }
コード例 #3
0
ファイル: SessionActivity.java プロジェクト: bailli/FreeRDP
  private void sendDelayedMoveEvent(int x, int y) {
    if (uiHandler.hasMessages(UIHandler.SEND_MOVE_EVENT)) {
      uiHandler.removeMessages(UIHandler.SEND_MOVE_EVENT);
      discardedMoveEvents++;
    } else discardedMoveEvents = 0;

    if (discardedMoveEvents > MAX_DISCARDED_MOVE_EVENTS)
      LibFreeRDP.sendCursorEvent(session.getInstance(), x, y, Mouse.getMoveEvent());
    else
      uiHandler.sendMessageDelayed(
          Message.obtain(null, UIHandler.SEND_MOVE_EVENT, x, y), SEND_MOVE_EVENT_TIMEOUT);
  }
コード例 #4
0
ファイル: SessionActivity.java プロジェクト: bailli/FreeRDP
  @Override
  public void onSessionViewLeftTouch(int x, int y, boolean down) {
    if (!down) cancelDelayedMoveEvent();

    LibFreeRDP.sendCursorEvent(
        session.getInstance(),
        x,
        y,
        toggleMouseButtons ? Mouse.getRightButtonEvent(down) : Mouse.getLeftButtonEvent(down));

    if (!down) toggleMouseButtons = false;
  }
コード例 #5
0
ファイル: SessionActivity.java プロジェクト: bailli/FreeRDP
  private void connect(BookmarkBase bookmark) {
    session = GlobalApp.createSession(bookmark);
    session.setUIEventListener(this);

    // set writeable data directory
    LibFreeRDP.setDataDirectory(session.getInstance(), getFilesDir().toString());

    BookmarkBase.ScreenSettings screenSettings = session.getBookmark().getActiveScreenSettings();
    Log.v(TAG, "Screen Resolution: " + screenSettings.getResolutionString());
    if (screenSettings.isAutomatic()) {
      if ((getResources().getConfiguration().screenLayout & Configuration.SCREENLAYOUT_SIZE_MASK)
          >= Configuration.SCREENLAYOUT_SIZE_LARGE) {
        // large screen device i.e. tablet: simply use screen info
        screenSettings.setHeight(screen_height);
        screenSettings.setWidth(screen_width);
      } else {
        // small screen device i.e. phone:
        // Automatic uses the largest side length of the screen and makes a 16:10 resolution setting
        // out of it
        int screenMax = (screen_width > screen_height) ? screen_width : screen_height;
        screenSettings.setHeight(screenMax);
        screenSettings.setWidth((int) ((float) screenMax * 1.6f));
      }
    }

    progressDialog = new ProgressDialog(this);
    progressDialog.setTitle(bookmark.getLabel());
    progressDialog.setMessage(getResources().getText(R.string.dlg_msg_connecting));
    progressDialog.setButton(
        ProgressDialog.BUTTON_NEGATIVE,
        "Cancel",
        new DialogInterface.OnClickListener() {
          @Override
          public void onClick(DialogInterface dialog, int which) {
            connectCancelledByUser = true;
            LibFreeRDP.cancelConnection(session.getInstance());
          }
        });
    progressDialog.setCancelable(false);
    progressDialog.show();

    Thread thread =
        new Thread(
            new Runnable() {
              public void run() {
                session.connect();
              }
            });
    thread.start();
  }
コード例 #6
0
ファイル: SessionActivity.java プロジェクト: bailli/FreeRDP
  @Override
  public boolean onOptionsItemSelected(MenuItem item) {
    switch (item.getItemId()) {
      case R.id.session_touch_pointer:
        {
          // toggle touch pointer
          if (touchPointerView.getVisibility() == View.VISIBLE) {
            touchPointerView.setVisibility(View.INVISIBLE);
            sessionView.setTouchPointerPadding(0, 0);
          } else {
            touchPointerView.setVisibility(View.VISIBLE);
            sessionView.setTouchPointerPadding(
                touchPointerView.getPointerWidth(), touchPointerView.getPointerHeight());
          }
          break;
        }

      case R.id.session_sys_keyboard:
        {
          showKeyboard(!sysKeyboardVisible, false);
          break;
        }

      case R.id.session_ext_keyboard:
        {
          showKeyboard(false, !extKeyboardVisible);
          break;
        }

      case R.id.session_disconnect:
        {
          showKeyboard(false, false);
          LibFreeRDP.disconnect(session.getInstance());
          break;
        }
    }

    return true;
  }
コード例 #7
0
ファイル: SessionActivity.java プロジェクト: bailli/FreeRDP
 @Override
 public void processUnicodeKey(int unicodeKey) {
   LibFreeRDP.sendUnicodeKeyEvent(session.getInstance(), unicodeKey);
 }
コード例 #8
0
ファイル: SessionActivity.java プロジェクト: bailli/FreeRDP
 // ****************************************************************************
 // KeyboardMapper.KeyProcessingListener implementation
 @Override
 public void processVirtualKey(int virtualKeyCode, boolean down) {
   LibFreeRDP.sendKeyEvent(session.getInstance(), virtualKeyCode, down);
 }
コード例 #9
0
ファイル: SessionActivity.java プロジェクト: bailli/FreeRDP
    @Override
    public void handleMessage(Message msg) {
      switch (msg.what) {
        case GRAPHICS_CHANGED:
          {
            sessionView.onSurfaceChange(session);
            scrollView.requestLayout();
            break;
          }
        case REFRESH_SESSIONVIEW:
          {
            sessionView.invalidateRegion();
            break;
          }
        case DISPLAY_TOAST:
          {
            Toast errorToast =
                Toast.makeText(getApplicationContext(), msg.obj.toString(), Toast.LENGTH_LONG);
            errorToast.show();
            break;
          }
        case HIDE_ZOOMCONTROLS:
          {
            zoomControls.hide();
            break;
          }
        case SEND_MOVE_EVENT:
          {
            LibFreeRDP.sendCursorEvent(
                session.getInstance(), msg.arg1, msg.arg2, Mouse.getMoveEvent());
            break;
          }
        case SHOW_DIALOG:
          {
            // create and show the dialog
            ((Dialog) msg.obj).show();
            break;
          }
        case SCROLLING_REQUESTED:
          {
            int scrollX = 0;
            int scrollY = 0;
            float[] pointerPos = touchPointerView.getPointerPosition();

            if (pointerPos[0] > (screen_width - touchPointerView.getPointerWidth()))
              scrollX = SCROLLING_DISTANCE;
            else if (pointerPos[0] < 0) scrollX = -SCROLLING_DISTANCE;

            if (pointerPos[1] > (screen_height - touchPointerView.getPointerHeight()))
              scrollY = SCROLLING_DISTANCE;
            else if (pointerPos[1] < 0) scrollY = -SCROLLING_DISTANCE;

            scrollView.scrollBy(scrollX, scrollY);

            // see if we reached the min/max scroll positions
            if (scrollView.getScrollX() == 0
                || scrollView.getScrollX() == (sessionView.getWidth() - scrollView.getWidth()))
              scrollX = 0;
            if (scrollView.getScrollY() == 0
                || scrollView.getScrollY() == (sessionView.getHeight() - scrollView.getHeight()))
              scrollY = 0;

            if (scrollX != 0 || scrollY != 0)
              uiHandler.sendEmptyMessageDelayed(SCROLLING_REQUESTED, SCROLLING_TIMEOUT);
            else Log.v(TAG, "Stopping auto-scroll");
            break;
          }
      }
    }
コード例 #10
0
ファイル: SessionActivity.java プロジェクト: bailli/FreeRDP
 @Override
 public void onTouchPointerScroll(boolean down) {
   LibFreeRDP.sendCursorEvent(session.getInstance(), 0, 0, Mouse.getScrollEvent(down));
 }
コード例 #11
0
ファイル: SessionActivity.java プロジェクト: bailli/FreeRDP
 @Override
 public void onTouchPointerRightClick(int x, int y, boolean down) {
   Point p = mapScreenCoordToSessionCoord(x, y);
   LibFreeRDP.sendCursorEvent(session.getInstance(), p.x, p.y, Mouse.getRightButtonEvent(down));
 }