multivnc icon indicating copy to clipboard operation
multivnc copied to clipboard

Define, implement && document clear input event streams between classes

Open bk138 opened this issue 4 years ago • 4 comments

For instance, right now VncCanvas receives pointer events, sends them to PointerInputHandler which processes them and sends them back to VncCanvas which in turn sends them to VNCConn.

Keyboard handling is kinda separate through VncCanvasActivity...

  • [ ] make a plan
    • [ ] create VncClientView class containing VncCanvas and TouchPointView
    • [ ] move pointerInputHandler from activity into this container class
    • [ ] make MouseButtonView take a ref to VncClientView
    • [ ] make VncCanvas and TouchPointView subclass a common superclass that VncClientView can call common methods like redraw() on
    • [ ] rename classes to nice scheme
    • [ ] maybe put in subpackage of ui
    • [ ] later on refactor all processPointerEvent() methods of containing VncClientView into PointerInputHandler directly
  • [ ] Don't forget to have a look at #162 and its fix again.

bk138 avatar Feb 20 '21 22:02 bk138

Don't forget to have a look at #162 and its fix again.

bk138 avatar Feb 18 '22 11:02 bk138

Status Quo is as follows:

VncCanvasActivity

layout

  • VncCanvas
  • TouchPointView
  • Zoom+Keyboard
  • Mouse Button Views

fields+methods

  • inputHandler
  • menu handling
  • most of the key and keyboard receiving

TouchPointView

  • onTouchEvent
    • goes to inputHandler in VncCanvasActivity set via setInputHandler()

VncCanvas

  • activity field as backlink
  • vncConn member, set from initializeVncCanvas()
  • inputHandler set from initializeVncCanvas()
  • :exclamation: mouseX, mouseY
  • :exclamation: scaling
  • onTouchEvent
    • goes to inputHandler in VncCanvasActivity
  • onGenericMotionEvent
    • goes to inputHandler in VncCanvasActivity
    • :exclamation: not in TouchPointView
  • processPointerEvent
  • processMouseEvent
  • processKeyEvent
    • called from VncCanvasActivity
  • all the auth callback dialogs, #228

MouseButtonView

  • get and set mouseX, mouseY from VncCanvas :exclamation:
  • canvas.vncConn.sendPointerEvent() :exclamation:
  • canvas.redraw() :exclamation:
  • canvas.panToMouse() :exclamation:

PointerInputHandler

  • :exclamation: has activity field as backlink
    • uses this as Context, OK
    • and canvas.scaling, :exclamation:
    • and canvas.notificationToast, :exclamation:
    • and canvas.sendMetaKey, :exclamation:
    • and mouseButtons :exclamation:
    • and canvas.processPointerEvent :exclamation:
    • and canvas.mouseX and Y :exclamation:
    • and loads more ....

bk138 avatar Aug 18 '23 20:08 bk138

main problems and possible solutions

  • MouseButtonView
    • has canvas knowledge to get and set cursor pos and trigger a redraw
    • circumvents PointerInputHandler
    • :bulb: could have onMove interface which is implemented by canvas and direct PointerInputHandler ref, but also needs to get cursor pos :no_entry:
  • PointerInputHandler
    • has canvas knowledge
    • sends input back to canvas which sends it to VNCConn
  • VncCanvas
    • has too much functionality wrt input and scaling and ... which TouchPointView lacks
    • :bulb: move up to common base class w/ TouchPointView -> not good as we need one location for cursor coords
    • :bulb: or move up to containing object ( activity? fragment? ) -> not good as OnTouch OnGenericMotion etc are View methods :no_entry:

bk138 avatar Aug 21 '23 10:08 bk138

https://stackoverflow.com/questions/7449799/how-are-android-touch-events-delivered/46862320#46862320

bk138 avatar Aug 21 '23 12:08 bk138

https://developer.android.com/reference/android/view/ViewGroup

bk138 avatar Aug 21 '23 13:08 bk138