FreeRDP
Loading...
Searching...
No Matches
com.freerdp.freerdpcore.presentation.SessionInputManager Class Reference
Inheritance diagram for com.freerdp.freerdpcore.presentation.SessionInputManager:
Collaboration diagram for com.freerdp.freerdpcore.presentation.SessionInputManager:

Public Member Functions

 SessionInputManager (Context context, ScrollView2D scrollView, SessionView sessionView, TouchPointerView touchPointerView, ExtendedKeyboardView keyboard)
void attachSession (long instance, Bitmap surface)
void setBitmap (Bitmap bitmap)
ScaleGestureDetector.OnScaleGestureListener getPinchZoomListener ()
void setScreenSize (int width, int height)
void toggleKeyboard ()
void hideKeyboards ()
boolean handleKeyboardBack ()
boolean isSoftInputActive ()
void onImeVisibilityChanged (boolean visible)
void cancelPendingEvents ()
boolean onGenericMotionEvent (MotionEvent e)
boolean onAndroidKeyEvent (KeyEvent event)
boolean onAndroidKeyLongPress (int keyCode)
boolean handleBackAsAltF4 ()
void toggleTouchPointer ()
void onSessionViewBeginTouch ()
void onSessionViewEndTouch ()
void onSessionViewLeftTouch (int x, int y, boolean down)
void onSessionViewMiddleTouch (int x, int y, boolean down)
void onSessionViewRightTouch (int x, int y, boolean down)
void onSessionViewMove (int x, int y)
void onSessionViewMouseMove (int x, int y)
void onSessionViewScroll (boolean down)
void onSessionViewHScroll (boolean right)
void onTouchPointerClose ()
void onTouchPointerLeftClick (int x, int y, boolean down)
void onTouchPointerRightClick (int x, int y, boolean down)
void onTouchPointerMiddleClick (int x, int y, boolean down)
void onTouchPointerMove (int x, int y)
void onTouchPointerMoveEnd ()
void onTouchPointerScroll (int amount)
void onTouchPointerHScroll (int amount)
void onTouchPointerToggleKeyboard ()
void onTouchPointerResetScrollZoom ()
void processVirtualKey (int virtualKeyCode, boolean down)
void processUnicodeKey (int unicodeKey)
boolean isUnicodeInputSupported ()
void processKeyAsUnicode (int virtualKeyCode, int unicodeKey, int modmask)
void switchKeyboard (int keyboardType)
void modifiersChanged ()
void onKey (int keycode)
void onKeyLock (int keycode)
int getModifierState (int keycode)
void onExpandedChanged (boolean expanded)

Detailed Description

Definition at line 31 of file SessionInputManager.java.

Constructor & Destructor Documentation

◆ SessionInputManager()

com.freerdp.freerdpcore.presentation.SessionInputManager.SessionInputManager ( Context context,
ScrollView2D scrollView,
SessionView sessionView,
TouchPointerView touchPointerView,
ExtendedKeyboardView keyboard )
inline

Definition at line 66 of file SessionInputManager.java.

68 {
69 this.context = context;
70 this.scrollView = scrollView;
71 this.sessionView = sessionView;
72 this.touchPointerView = touchPointerView;
73 this.keyboard = keyboard;
74 this.handler = new InputHandler();
75
76 this.keyboardMapper = new KeyboardMapper();
77 this.keyboardMapper.init(context);
78
79 keyboard.setListener(this);
80 }

Member Function Documentation

◆ attachSession()

void com.freerdp.freerdpcore.presentation.SessionInputManager.attachSession ( long instance,
Bitmap surface )
inline

Definition at line 83 of file SessionInputManager.java.

84 {
85 this.instance = instance;
86 this.bitmap = surface;
87 this.lastMoveSentTime = 0;
88 keyboardMapper.reset(this);
89 }

◆ cancelPendingEvents()

void com.freerdp.freerdpcore.presentation.SessionInputManager.cancelPendingEvents ( )
inline

Definition at line 201 of file SessionInputManager.java.

202 {
203 handler.removeMessages(MSG_SEND_MOVE_EVENT);
204 }

◆ getModifierState()

int com.freerdp.freerdpcore.presentation.SessionInputManager.getModifierState ( int keycode)
inline

Implements com.freerdp.freerdpcore.presentation.ExtendedKeyboardView.Listener.

Definition at line 535 of file SessionInputManager.java.

536 {
537 return keyboardMapper.getModifierState(keycode);
538 }

◆ getPinchZoomListener()

ScaleGestureDetector.OnScaleGestureListener com.freerdp.freerdpcore.presentation.SessionInputManager.getPinchZoomListener ( )
inline

Definition at line 98 of file SessionInputManager.java.

99 {
100 return pinchZoomListener;
101 }

◆ handleBackAsAltF4()

boolean com.freerdp.freerdpcore.presentation.SessionInputManager.handleBackAsAltF4 ( )
inline

Definition at line 249 of file SessionInputManager.java.

250 {
251 if (instance == 0)
252 return false;
253 if (!ApplicationSettingsActivity.getUseBackAsAltf4(context))
254 return false;
255 keyboardMapper.sendAltF4();
256 return true;
257 }

◆ handleKeyboardBack()

boolean com.freerdp.freerdpcore.presentation.SessionInputManager.handleKeyboardBack ( )
inline

Definition at line 137 of file SessionInputManager.java.

138 {
139 if (keyboard.getVisibility() != View.VISIBLE)
140 return false;
141
142 if (keyboard.isExpanded())
143 {
144 keyboard.setExpanded(false, false);
145 // deliberately no IME here, so the next back press hides the bar as well
146 refreshSystemBars();
147 scrollView.requestApplyInsets();
148 return true;
149 }
150
151 hideKeyboards();
152 return true;
153 }

◆ hideKeyboards()

void com.freerdp.freerdpcore.presentation.SessionInputManager.hideKeyboards ( )
inline

Definition at line 126 of file SessionInputManager.java.

127 {
128 keyboard.setExpanded(false, false);
129 keyboard.setVisibility(View.GONE);
130 setSoftInputState(false);
131 keyboardMapper.clearlAllModifiers();
132 // the IME dismiss animation may re-show the nav bar after the refresh above
133 scrollView.post(this::refreshSystemBars);
134 }

◆ isSoftInputActive()

boolean com.freerdp.freerdpcore.presentation.SessionInputManager.isSoftInputActive ( )
inline

Definition at line 156 of file SessionInputManager.java.

157 {
158 return keyboard.getVisibility() == View.VISIBLE && (softInputRequested || softInputVisible);
159 }

◆ isUnicodeInputSupported()

boolean com.freerdp.freerdpcore.presentation.SessionInputManager.isUnicodeInputSupported ( )
inline

Implements com.freerdp.freerdpcore.utils.KeyboardMapper.KeyProcessingListener.

Definition at line 487 of file SessionInputManager.java.

488 {
489 return instance != 0 && LibFreeRDP.isUnicodeInputSupported(instance);
490 }

◆ modifiersChanged()

void com.freerdp.freerdpcore.presentation.SessionInputManager.modifiersChanged ( )
inline

Implements com.freerdp.freerdpcore.utils.KeyboardMapper.KeyProcessingListener.

Definition at line 517 of file SessionInputManager.java.

518 {
519 keyboard.refreshModifiers();
520 }

◆ onAndroidKeyEvent()

boolean com.freerdp.freerdpcore.presentation.SessionInputManager.onAndroidKeyEvent ( KeyEvent event)
inline

Definition at line 224 of file SessionInputManager.java.

225 {
226 if (instance == 0)
227 return false;
228 // Read on every key, so a change in the settings applies without reconnecting.
229 keyboardMapper.setPhysicalKeyboardDeviceLayout(
230 ApplicationSettingsActivity.getPhysicalKeyboardDeviceLayout(context));
231 return keyboardMapper.processAndroidKeyEvent(event);
232 }

◆ onAndroidKeyLongPress()

boolean com.freerdp.freerdpcore.presentation.SessionInputManager.onAndroidKeyLongPress ( int keyCode)
inline

Definition at line 236 of file SessionInputManager.java.

237 {
238 if (instance == 0)
239 return false;
240 if (keyCode == KeyEvent.KEYCODE_BACK)
241 {
242 LibFreeRDP.disconnect(instance);
243 return true;
244 }
245 return false;
246 }

◆ onExpandedChanged()

void com.freerdp.freerdpcore.presentation.SessionInputManager.onExpandedChanged ( boolean expanded)
inline

Implements com.freerdp.freerdpcore.presentation.ExtendedKeyboardView.Listener.

Definition at line 540 of file SessionInputManager.java.

541 {
542 // the expanded panel replaces the system IME; collapsing brings it back
543 setSoftInputState(!expanded);
544 }

◆ onGenericMotionEvent()

boolean com.freerdp.freerdpcore.presentation.SessionInputManager.onGenericMotionEvent ( MotionEvent e)
inline

Definition at line 207 of file SessionInputManager.java.

208 {
209 if (instance == 0)
210 return false;
211 if (e.getAction() != MotionEvent.ACTION_SCROLL)
212 return false;
213
214 final float vScroll = e.getAxisValue(MotionEvent.AXIS_VSCROLL);
215 final float hScroll = e.getAxisValue(MotionEvent.AXIS_HSCROLL);
216 if (vScroll != 0)
217 onSessionViewScroll(vScroll > 0);
218 if (hScroll != 0)
219 onSessionViewHScroll(hScroll > 0);
220 return true;
221 }

◆ onImeVisibilityChanged()

void com.freerdp.freerdpcore.presentation.SessionInputManager.onImeVisibilityChanged ( boolean visible)
inline

Definition at line 163 of file SessionInputManager.java.

164 {
165 if (visible == softInputVisible)
166 return;
167 softInputVisible = visible;
168 if (!visible)
169 softInputRequested = false;
170 refreshSystemBars();
171 }

◆ onKey()

void com.freerdp.freerdpcore.presentation.SessionInputManager.onKey ( int keycode)
inline

Implements com.freerdp.freerdpcore.presentation.ExtendedKeyboardView.Listener.

Definition at line 525 of file SessionInputManager.java.

526 {
527 keyboardMapper.processCustomKeyEvent(keycode);
528 }

◆ onKeyLock()

void com.freerdp.freerdpcore.presentation.SessionInputManager.onKeyLock ( int keycode)
inline

Implements com.freerdp.freerdpcore.presentation.ExtendedKeyboardView.Listener.

Definition at line 530 of file SessionInputManager.java.

531 {
532 keyboardMapper.processCustomKeyLock(keycode);
533 }

◆ onSessionViewBeginTouch()

void com.freerdp.freerdpcore.presentation.SessionInputManager.onSessionViewBeginTouch ( )
inline

Implements com.freerdp.freerdpcore.presentation.SessionView.SessionViewListener.

Definition at line 325 of file SessionInputManager.java.

326 {
327 scrollView.setScrollEnabled(false);
328 }

◆ onSessionViewEndTouch()

void com.freerdp.freerdpcore.presentation.SessionInputManager.onSessionViewEndTouch ( )
inline

Implements com.freerdp.freerdpcore.presentation.SessionView.SessionViewListener.

Definition at line 330 of file SessionInputManager.java.

331 {
332 scrollView.setScrollEnabled(true);
333 }

◆ onSessionViewHScroll()

void com.freerdp.freerdpcore.presentation.SessionInputManager.onSessionViewHScroll ( boolean right)
inline

Implements com.freerdp.freerdpcore.presentation.SessionView.SessionViewListener.

Definition at line 380 of file SessionInputManager.java.

381 {
382 if (instance == 0)
383 return;
384 LibFreeRDP.sendCursorEvent(instance, 0, 0, Mouse.getHScrollEvent(context, right));
385 }

◆ onSessionViewLeftTouch()

void com.freerdp.freerdpcore.presentation.SessionInputManager.onSessionViewLeftTouch ( int x,
int y,
boolean down )
inline

Implements com.freerdp.freerdpcore.presentation.SessionView.SessionViewListener.

Definition at line 335 of file SessionInputManager.java.

336 {
337 if (instance == 0)
338 return;
339 cancelDelayedMoveEvent();
340 LibFreeRDP.sendCursorEvent(instance, x, y, Mouse.getLeftButtonEvent(context, down));
341 }

◆ onSessionViewMiddleTouch()

void com.freerdp.freerdpcore.presentation.SessionInputManager.onSessionViewMiddleTouch ( int x,
int y,
boolean down )
inline

Implements com.freerdp.freerdpcore.presentation.SessionView.SessionViewListener.

Definition at line 343 of file SessionInputManager.java.

344 {
345 if (instance == 0)
346 return;
347 cancelDelayedMoveEvent();
348 LibFreeRDP.sendCursorEvent(instance, x, y, Mouse.getMiddleButtonEvent(down));
349 }

◆ onSessionViewMouseMove()

void com.freerdp.freerdpcore.presentation.SessionInputManager.onSessionViewMouseMove ( int x,
int y )
inline

Implements com.freerdp.freerdpcore.presentation.SessionView.SessionViewListener.

Definition at line 366 of file SessionInputManager.java.

367 {
368 if (instance == 0)
369 return;
370 LibFreeRDP.sendCursorEvent(instance, x, y, Mouse.getMoveEvent());
371 }

◆ onSessionViewMove()

void com.freerdp.freerdpcore.presentation.SessionInputManager.onSessionViewMove ( int x,
int y )
inline

Implements com.freerdp.freerdpcore.presentation.SessionView.SessionViewListener.

Definition at line 359 of file SessionInputManager.java.

360 {
361 if (instance == 0)
362 return;
363 sendDelayedMoveEvent(x, y);
364 }

◆ onSessionViewRightTouch()

void com.freerdp.freerdpcore.presentation.SessionInputManager.onSessionViewRightTouch ( int x,
int y,
boolean down )
inline

Implements com.freerdp.freerdpcore.presentation.SessionView.SessionViewListener.

Definition at line 351 of file SessionInputManager.java.

352 {
353 if (instance == 0)
354 return;
355 cancelDelayedMoveEvent();
356 LibFreeRDP.sendCursorEvent(instance, x, y, Mouse.getRightButtonEvent(context, down));
357 }

◆ onSessionViewScroll()

void com.freerdp.freerdpcore.presentation.SessionInputManager.onSessionViewScroll ( boolean down)
inline

Implements com.freerdp.freerdpcore.presentation.SessionView.SessionViewListener.

Definition at line 373 of file SessionInputManager.java.

374 {
375 if (instance == 0)
376 return;
377 LibFreeRDP.sendCursorEvent(instance, 0, 0, Mouse.getScrollEvent(context, down));
378 }

◆ onTouchPointerClose()

void com.freerdp.freerdpcore.presentation.SessionInputManager.onTouchPointerClose ( )
inline

Implements com.freerdp.freerdpcore.presentation.TouchPointerView.TouchPointerListener.

Definition at line 390 of file SessionInputManager.java.

391 {
392 touchPointerView.setVisibility(View.INVISIBLE);
393 sessionView.setTouchPointerPadding(0, 0);
394 }

◆ onTouchPointerHScroll()

void com.freerdp.freerdpcore.presentation.SessionInputManager.onTouchPointerHScroll ( int amount)
inline

Implements com.freerdp.freerdpcore.presentation.TouchPointerView.TouchPointerListener.

Definition at line 446 of file SessionInputManager.java.

447 {
448 if (instance == 0)
449 return;
450 LibFreeRDP.sendCursorEvent(instance, 0, 0, Mouse.getHScrollEvent(context, amount));
451 }

◆ onTouchPointerLeftClick()

void com.freerdp.freerdpcore.presentation.SessionInputManager.onTouchPointerLeftClick ( int x,
int y,
boolean down )
inline

Implements com.freerdp.freerdpcore.presentation.TouchPointerView.TouchPointerListener.

Definition at line 396 of file SessionInputManager.java.

397 {
398 if (instance == 0)
399 return;
400 Point p = mapScreenCoordToSessionCoord(x, y);
401 LibFreeRDP.sendCursorEvent(instance, p.x, p.y, Mouse.getLeftButtonEvent(context, down));
402 }

◆ onTouchPointerMiddleClick()

void com.freerdp.freerdpcore.presentation.SessionInputManager.onTouchPointerMiddleClick ( int x,
int y,
boolean down )
inline

Implements com.freerdp.freerdpcore.presentation.TouchPointerView.TouchPointerListener.

Definition at line 412 of file SessionInputManager.java.

413 {
414 if (instance == 0)
415 return;
416 Point p = mapScreenCoordToSessionCoord(x, y);
417 LibFreeRDP.sendCursorEvent(instance, p.x, p.y, Mouse.getMiddleButtonEvent(down));
418 }

◆ onTouchPointerMove()

void com.freerdp.freerdpcore.presentation.SessionInputManager.onTouchPointerMove ( int x,
int y )
inline

Implements com.freerdp.freerdpcore.presentation.TouchPointerView.TouchPointerListener.

Definition at line 420 of file SessionInputManager.java.

421 {
422 if (instance == 0)
423 return;
424 Point p = mapScreenCoordToSessionCoord(x, y);
425 LibFreeRDP.sendCursorEvent(instance, p.x, p.y, Mouse.getMoveEvent());
426
427 if (ApplicationSettingsActivity.getAutoScrollTouchPointer(context) &&
428 !handler.hasMessages(MSG_SCROLLING_REQUESTED))
429 {
430 handler.sendEmptyMessageDelayed(MSG_SCROLLING_REQUESTED, SCROLLING_TIMEOUT);
431 }
432 }

◆ onTouchPointerMoveEnd()

void com.freerdp.freerdpcore.presentation.SessionInputManager.onTouchPointerMoveEnd ( )
inline

Implements com.freerdp.freerdpcore.presentation.TouchPointerView.TouchPointerListener.

Definition at line 434 of file SessionInputManager.java.

435 {
436 handler.removeMessages(MSG_SCROLLING_REQUESTED);
437 }

◆ onTouchPointerResetScrollZoom()

void com.freerdp.freerdpcore.presentation.SessionInputManager.onTouchPointerResetScrollZoom ( )
inline

Implements com.freerdp.freerdpcore.presentation.TouchPointerView.TouchPointerListener.

Definition at line 458 of file SessionInputManager.java.

459 {
460 sessionView.setZoom(1.0f);
461 scrollView.scrollTo(0, 0);
462 }

◆ onTouchPointerRightClick()

void com.freerdp.freerdpcore.presentation.SessionInputManager.onTouchPointerRightClick ( int x,
int y,
boolean down )
inline

Implements com.freerdp.freerdpcore.presentation.TouchPointerView.TouchPointerListener.

Definition at line 404 of file SessionInputManager.java.

405 {
406 if (instance == 0)
407 return;
408 Point p = mapScreenCoordToSessionCoord(x, y);
409 LibFreeRDP.sendCursorEvent(instance, p.x, p.y, Mouse.getRightButtonEvent(context, down));
410 }

◆ onTouchPointerScroll()

void com.freerdp.freerdpcore.presentation.SessionInputManager.onTouchPointerScroll ( int amount)
inline

Implements com.freerdp.freerdpcore.presentation.TouchPointerView.TouchPointerListener.

Definition at line 439 of file SessionInputManager.java.

440 {
441 if (instance == 0)
442 return;
443 LibFreeRDP.sendCursorEvent(instance, 0, 0, Mouse.getScrollEvent(context, amount));
444 }

◆ onTouchPointerToggleKeyboard()

void com.freerdp.freerdpcore.presentation.SessionInputManager.onTouchPointerToggleKeyboard ( )
inline

Implements com.freerdp.freerdpcore.presentation.TouchPointerView.TouchPointerListener.

Definition at line 453 of file SessionInputManager.java.

454 {
455 toggleKeyboard();
456 }

◆ processKeyAsUnicode()

void com.freerdp.freerdpcore.presentation.SessionInputManager.processKeyAsUnicode ( int virtualKeyCode,
int unicodeKey,
int modmask )
inline

Implements com.freerdp.freerdpcore.utils.KeyboardMapper.KeyProcessingListener.

Definition at line 492 of file SessionInputManager.java.

493 {
494 if (instance == 0)
495 return;
496 LibFreeRDP.sendKeyAsUnicodeEvent(instance, virtualKeyCode, unicodeKey, modmask, true);
497 LibFreeRDP.sendKeyAsUnicodeEvent(instance, virtualKeyCode, unicodeKey, modmask, false);
498 }

◆ processUnicodeKey()

void com.freerdp.freerdpcore.presentation.SessionInputManager.processUnicodeKey ( int unicodeKey)
inline

Implements com.freerdp.freerdpcore.utils.KeyboardMapper.KeyProcessingListener.

Definition at line 474 of file SessionInputManager.java.

475 {
476 if (instance == 0)
477 return;
478 if (LibFreeRDP.isUnicodeInputSupported(instance))
479 {
480 LibFreeRDP.sendUnicodeKeyEvent(instance, unicodeKey, true);
481 LibFreeRDP.sendUnicodeKeyEvent(instance, unicodeKey, false);
482 }
483 else
484 keyboardMapper.processUnicodeFallback(unicodeKey);
485 }

◆ processVirtualKey()

void com.freerdp.freerdpcore.presentation.SessionInputManager.processVirtualKey ( int virtualKeyCode,
boolean down )
inline

Implements com.freerdp.freerdpcore.utils.KeyboardMapper.KeyProcessingListener.

Definition at line 467 of file SessionInputManager.java.

468 {
469 if (instance == 0)
470 return;
471 LibFreeRDP.sendKeyEvent(instance, virtualKeyCode, down);
472 }

◆ setBitmap()

void com.freerdp.freerdpcore.presentation.SessionInputManager.setBitmap ( Bitmap bitmap)
inline

Definition at line 92 of file SessionInputManager.java.

93 {
94 this.bitmap = bitmap;
95 }

◆ setScreenSize()

void com.freerdp.freerdpcore.presentation.SessionInputManager.setScreenSize ( int width,
int height )
inline

Definition at line 104 of file SessionInputManager.java.

105 {
106 this.screenWidth = width;
107 this.screenHeight = height;
108 }

◆ switchKeyboard()

void com.freerdp.freerdpcore.presentation.SessionInputManager.switchKeyboard ( int keyboardType)
inline

Implements com.freerdp.freerdpcore.utils.KeyboardMapper.KeyProcessingListener.

Definition at line 500 of file SessionInputManager.java.

501 {
502 switch (keyboardType)
503 {
504 case KeyboardMapper.KEYBOARD_TYPE_FUNCTIONKEYS:
505 keyboard.selectPage(ExtendedKeyboardView.PAGE_SPECIAL);
506 break;
507
508 case KeyboardMapper.KEYBOARD_TYPE_NUMPAD:
509 keyboard.selectPage(ExtendedKeyboardView.PAGE_NUM);
510 break;
511
512 default:
513 break;
514 }
515 }

◆ toggleKeyboard()

void com.freerdp.freerdpcore.presentation.SessionInputManager.toggleKeyboard ( )
inline

Definition at line 111 of file SessionInputManager.java.

112 {
113 if (keyboard.getVisibility() == View.VISIBLE)
114 {
115 hideKeyboards();
116 }
117 else
118 {
119 keyboard.setExpanded(false, false);
120 keyboard.setVisibility(View.VISIBLE);
121 setSoftInputState(true);
122 }
123 }

◆ toggleTouchPointer()

void com.freerdp.freerdpcore.presentation.SessionInputManager.toggleTouchPointer ( )
inline

Definition at line 260 of file SessionInputManager.java.

261 {
262 if (touchPointerView.getVisibility() == View.VISIBLE)
263 {
264 touchPointerView.setVisibility(View.INVISIBLE);
265 sessionView.setTouchPointerPadding(0, 0);
266 }
267 else
268 {
269 touchPointerView.setVisibility(View.VISIBLE);
270 sessionView.setTouchPointerPadding(touchPointerView.getPointerWidth(),
271 touchPointerView.getPointerHeight());
272 }
273 }

The documentation for this class was generated from the following file: