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

Data Structures

interface  SessionViewListener
 

Public Member Functions

 SessionView (Context context)
 
 SessionView (Context context, AttributeSet attrs)
 
 SessionView (Context context, AttributeSet attrs, int defStyle)
 
boolean onHoverEvent (MotionEvent event)
 
void setScaleGestureDetector (ScaleGestureDetector scaleGestureDetector)
 
void setSessionViewListener (SessionViewListener sessionViewListener)
 
void addInvalidRegion (Rect invalidRegion)
 
void invalidateRegion ()
 
void onSurfaceChange (SessionState session)
 
float getZoom ()
 
void setZoom (float factor)
 
boolean isAtMaxZoom ()
 
boolean isAtMinZoom ()
 
boolean zoomIn (float factor)
 
boolean zoomOut (float factor)
 
void setTouchPointerPadding (int width, int height)
 
int getTouchPointerPaddingWidth ()
 
int getTouchPointerPaddingHeight ()
 
void onMeasure (int widthMeasureSpec, int heightMeasureSpec)
 
void onDraw (@NonNull Canvas canvas)
 
boolean onTouchEvent (MotionEvent event)
 
boolean onGenericMotionEvent (MotionEvent event)
 
void setRemoteCursor (int[] pixels, int width, int height, int hotX, int hotY)
 
void setDefaultCursor ()
 
InputConnection onCreateInputConnection (EditorInfo outAttrs)
 

Static Public Attributes

static final float MAX_SCALE_FACTOR = 3.0f
 
static final float MIN_SCALE_FACTOR = 0.75f
 

Detailed Description

Definition at line 41 of file SessionView.java.

Constructor & Destructor Documentation

◆ SessionView() [1/3]

com.freerdp.freerdpcore.presentation.SessionView.SessionView ( Context  context)
inline

Definition at line 71 of file SessionView.java.

72 {
73 super(context);
74 initSessionView(context);
75 }

◆ SessionView() [2/3]

com.freerdp.freerdpcore.presentation.SessionView.SessionView ( Context  context,
AttributeSet  attrs 
)
inline

Definition at line 77 of file SessionView.java.

78 {
79 super(context, attrs);
80 initSessionView(context);
81 }

◆ SessionView() [3/3]

com.freerdp.freerdpcore.presentation.SessionView.SessionView ( Context  context,
AttributeSet  attrs,
int  defStyle 
)
inline

Definition at line 83 of file SessionView.java.

84 {
85 super(context, attrs, defStyle);
86 initSessionView(context);
87 }

Member Function Documentation

◆ addInvalidRegion()

void com.freerdp.freerdpcore.presentation.SessionView.addInvalidRegion ( Rect  invalidRegion)
inline

Definition at line 134 of file SessionView.java.

135 {
136 // correctly transform invalid region depending on current scaling
137 invalidRegionF.set(invalidRegion);
138 scaleMatrix.mapRect(invalidRegionF);
139 invalidRegionF.roundOut(invalidRegion);
140
141 invalidRegions.add(invalidRegion);
142 }

◆ getTouchPointerPaddingHeight()

int com.freerdp.freerdpcore.presentation.SessionView.getTouchPointerPaddingHeight ( )
inline

Definition at line 229 of file SessionView.java.

230 {
231 return touchPointerPaddingHeight;
232 }

◆ getTouchPointerPaddingWidth()

int com.freerdp.freerdpcore.presentation.SessionView.getTouchPointerPaddingWidth ( )
inline

Definition at line 224 of file SessionView.java.

225 {
226 return touchPointerPaddingWidth;
227 }

◆ getZoom()

float com.freerdp.freerdpcore.presentation.SessionView.getZoom ( )
inline

Definition at line 164 of file SessionView.java.

165 {
166 return scaleFactor;
167 }

◆ invalidateRegion()

void com.freerdp.freerdpcore.presentation.SessionView.invalidateRegion ( )
inline

Definition at line 144 of file SessionView.java.

145 {
146 invalidate(invalidRegions.pop());
147 }

◆ isAtMaxZoom()

boolean com.freerdp.freerdpcore.presentation.SessionView.isAtMaxZoom ( )
inline

Definition at line 181 of file SessionView.java.

182 {
183 return (scaleFactor > (MAX_SCALE_FACTOR - SCALE_FACTOR_DELTA));
184 }

◆ isAtMinZoom()

boolean com.freerdp.freerdpcore.presentation.SessionView.isAtMinZoom ( )
inline

Definition at line 186 of file SessionView.java.

187 {
188 return (scaleFactor < (MIN_SCALE_FACTOR + SCALE_FACTOR_DELTA));
189 }

◆ onCreateInputConnection()

InputConnection com.freerdp.freerdpcore.presentation.SessionView.onCreateInputConnection ( EditorInfo  outAttrs)
inline

Definition at line 538 of file SessionView.java.

539 {
540 outAttrs.actionLabel = null;
541 outAttrs.inputType = InputType.TYPE_NULL;
542 outAttrs.imeOptions = EditorInfo.IME_ACTION_NONE | EditorInfo.IME_FLAG_NO_EXTRACT_UI |
543 EditorInfo.IME_FLAG_NO_FULLSCREEN;
544 return new BaseInputConnection(this, false);
545 }

◆ onDraw()

void com.freerdp.freerdpcore.presentation.SessionView.onDraw ( @NonNull Canvas  canvas)
inline

Definition at line 241 of file SessionView.java.

242 {
243 super.onDraw(canvas);
244
245 canvas.save();
246 canvas.concat(scaleMatrix);
247 canvas.drawColor(Color.BLACK);
248 if (surface != null)
249 {
250 surface.draw(canvas);
251 }
252 canvas.restore();
253 }

◆ onGenericMotionEvent()

boolean com.freerdp.freerdpcore.presentation.SessionView.onGenericMotionEvent ( MotionEvent  event)
inline

Definition at line 300 of file SessionView.java.

301 {
302 final boolean isPointer = event.isFromSource(InputDevice.SOURCE_CLASS_POINTER);
303 if (!isPointer)
304 return false;
305
306 final boolean isMouse = event.isFromSource(InputDevice.SOURCE_MOUSE);
307 int action = event.getActionMasked();
308
309 if (isMouse && (action == MotionEvent.ACTION_BUTTON_PRESS ||
310 action == MotionEvent.ACTION_BUTTON_RELEASE))
311 {
312 boolean down = action == MotionEvent.ACTION_BUTTON_PRESS;
313 MotionEvent mapped = mapTouchEvent(event);
314 int x = (int)mapped.getX();
315 int y = (int)mapped.getY();
316 mapped.recycle();
317
318 switch (event.getActionButton())
319 {
320 case MotionEvent.BUTTON_PRIMARY:
321 if (down)
322 sessionViewListener.onSessionViewBeginTouch();
323 sessionViewListener.onSessionViewLeftTouch(x, y, down);
324 if (!down)
325 sessionViewListener.onSessionViewEndTouch();
326 return true;
327 case MotionEvent.BUTTON_SECONDARY:
328 if (down)
329 sessionViewListener.onSessionViewBeginTouch();
330 sessionViewListener.onSessionViewRightTouch(x, y, down);
331 return true;
332 case MotionEvent.BUTTON_TERTIARY:
333 sessionViewListener.onSessionViewMiddleTouch(x, y, down);
334 return true;
335 default:
336 return true; // consume unknown buttons silently
337 }
338 }
339
340 if (action == MotionEvent.ACTION_SCROLL)
341 {
342 float vScroll = event.getAxisValue(MotionEvent.AXIS_VSCROLL);
343 float hScroll = event.getAxisValue(MotionEvent.AXIS_HSCROLL);
344 if (vScroll != 0)
345 sessionViewListener.onSessionViewScroll(vScroll > 0);
346 if (hScroll != 0)
347 sessionViewListener.onSessionViewHScroll(hScroll > 0);
348 return true;
349 }
350
351 return false;
352 }

◆ onHoverEvent()

boolean com.freerdp.freerdpcore.presentation.SessionView.onHoverEvent ( MotionEvent  event)
inline

Definition at line 107 of file SessionView.java.

108 {
109 if (event.getAction() == MotionEvent.ACTION_HOVER_MOVE)
110 {
111 // Handle hover move event
112 float x = event.getX();
113 float y = event.getY();
114 // Perform actions based on the hover position (x, y)
115 MotionEvent mappedEvent = mapTouchEvent(event);
116 sessionViewListener.onSessionViewMouseMove((int)mappedEvent.getX(),
117 (int)mappedEvent.getY());
118 mappedEvent.recycle();
119 }
120 // Return true to indicate that you've handled the event
121 return true;
122 }

◆ onMeasure()

void com.freerdp.freerdpcore.presentation.SessionView.onMeasure ( int  widthMeasureSpec,
int  heightMeasureSpec 
)
inline

Definition at line 234 of file SessionView.java.

235 {
236 Log.v(TAG, width + "x" + height);
237 this.setMeasuredDimension((int)(width * scaleFactor) + touchPointerPaddingWidth,
238 (int)(height * scaleFactor) + touchPointerPaddingHeight);
239 }

◆ onSurfaceChange()

void com.freerdp.freerdpcore.presentation.SessionView.onSurfaceChange ( SessionState  session)
inline

Definition at line 149 of file SessionView.java.

150 {
151 surface = session.getSurface();
152 Bitmap bitmap = surface.getBitmap();
153 width = bitmap.getWidth();
154 height = bitmap.getHeight();
155 surface.setBounds(0, 0, width, height);
156
157 setMinimumWidth(width);
158 setMinimumHeight(height);
159
160 requestLayout();
161 currentSession = session;
162 }

◆ onTouchEvent()

boolean com.freerdp.freerdpcore.presentation.SessionView.onTouchEvent ( MotionEvent  event)
inline

Definition at line 276 of file SessionView.java.

277 {
278 // Physical mouse events: bypass gesture detector entirely.
279 // Buttons are handled in onGenericMotionEvent; hover moves in onHoverEvent.
280 // Only ACTION_MOVE with a button held (drag) needs handling here.
281 if (event.isFromSource(InputDevice.SOURCE_MOUSE))
282 {
283 int action = event.getActionMasked();
284 if (action == MotionEvent.ACTION_MOVE && event.getButtonState() != 0)
285 {
286 MotionEvent mapped = mapTouchEvent(event);
287 sessionViewListener.onSessionViewMouseMove((int)mapped.getX(), (int)mapped.getY());
288 mapped.recycle();
289 return true;
290 }
291 return true;
292 }
293
294 boolean res = gestureDetector.onTouchEvent(event);
295 res |= doubleGestureDetector.onTouchEvent(event);
296 return res;
297 }

◆ setDefaultCursor()

void com.freerdp.freerdpcore.presentation.SessionView.setDefaultCursor ( )
inline

Definition at line 403 of file SessionView.java.

404 {
405 setPointerIcon(PointerIcon.getSystemIcon(getContext(), PointerIcon.TYPE_ARROW));
406 }

◆ setRemoteCursor()

void com.freerdp.freerdpcore.presentation.SessionView.setRemoteCursor ( int[]  pixels,
int  width,
int  height,
int  hotX,
int  hotY 
)
inline

Definition at line 375 of file SessionView.java.

376 {
377 if (pixels == null || width == 0 || height == 0)
378 {
379 cursorPixels = null;
380 setPointerIcon(PointerIcon.getSystemIcon(getContext(), PointerIcon.TYPE_NULL));
381 return;
382 }
383 cursorPixels = pixels;
384 cursorWidth = width;
385 cursorHeight = height;
386 cursorHotX = hotX;
387 cursorHotY = hotY;
388 applyScaledCursor();
389 }

◆ setScaleGestureDetector()

void com.freerdp.freerdpcore.presentation.SessionView.setScaleGestureDetector ( ScaleGestureDetector  scaleGestureDetector)
inline

Definition at line 124 of file SessionView.java.

125 {
126 doubleGestureDetector.setScaleGestureDetector(scaleGestureDetector);
127 }

◆ setSessionViewListener()

void com.freerdp.freerdpcore.presentation.SessionView.setSessionViewListener ( SessionViewListener  sessionViewListener)
inline

Definition at line 129 of file SessionView.java.

130 {
131 this.sessionViewListener = sessionViewListener;
132 }

◆ setTouchPointerPadding()

void com.freerdp.freerdpcore.presentation.SessionView.setTouchPointerPadding ( int  width,
int  height 
)
inline

Definition at line 217 of file SessionView.java.

218 {
219 touchPointerPaddingWidth = width;
220 touchPointerPaddingHeight = height;
221 requestLayout();
222 }

◆ setZoom()

void com.freerdp.freerdpcore.presentation.SessionView.setZoom ( float  factor)
inline

Definition at line 169 of file SessionView.java.

170 {
171 scaleFactor = factor;
172 scaleMatrix.setScale(scaleFactor, scaleFactor);
173 invScaleMatrix.setScale(1.0f / scaleFactor, 1.0f / scaleFactor);
174
175 if (cursorPixels != null)
176 applyScaledCursor();
177
178 requestLayout();
179 }

◆ zoomIn()

boolean com.freerdp.freerdpcore.presentation.SessionView.zoomIn ( float  factor)
inline

Definition at line 191 of file SessionView.java.

192 {
193 boolean res = true;
194 scaleFactor += factor;
195 if (scaleFactor > (MAX_SCALE_FACTOR - SCALE_FACTOR_DELTA))
196 {
197 scaleFactor = MAX_SCALE_FACTOR;
198 res = false;
199 }
200 setZoom(scaleFactor);
201 return res;
202 }

◆ zoomOut()

boolean com.freerdp.freerdpcore.presentation.SessionView.zoomOut ( float  factor)
inline

Definition at line 204 of file SessionView.java.

205 {
206 boolean res = true;
207 scaleFactor -= factor;
208 if (scaleFactor < (MIN_SCALE_FACTOR + SCALE_FACTOR_DELTA))
209 {
210 scaleFactor = MIN_SCALE_FACTOR;
211 res = false;
212 }
213 setZoom(scaleFactor);
214 return res;
215 }

Field Documentation

◆ MAX_SCALE_FACTOR

final float com.freerdp.freerdpcore.presentation.SessionView.MAX_SCALE_FACTOR = 3.0f
static

Definition at line 43 of file SessionView.java.

◆ MIN_SCALE_FACTOR

final float com.freerdp.freerdpcore.presentation.SessionView.MIN_SCALE_FACTOR = 0.75f
static

Definition at line 44 of file SessionView.java.


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