zocker-160 / pyQVNCWidget

VNC Widget for Python using PyQt5
GNU General Public License v3.0
14 stars 7 forks source link

need a few more examples #1

Closed ken3 closed 2 years ago

ken3 commented 2 years ago

I'm very interested in this widget. I want to send mouse/key events to the vnc server. I see RFBClient class has keyEvent() and pointerEvent() methods, but I don't know how to get the RFBClient instance from my application. Cloud you help me?

zocker-160 commented 2 years ago

thanks for reaching out, this implementation currently is still a work in progress (see TODO in readme), since it does suffer from stability problems.

I am currently in the middle of creating a complete rewrite of the RFB implementation without the need for python-twisted and it already works way more stable, it is just not done yet.

If you are interested, I can push it to a secondary branch and work from there.

Currently key and pointer events are implemented on the RFB side of thinks, it is however not implemented in the QT code, meaning that in order to make that work we would need to find a way to capture pointer events and coordinates from the QTWidget to the RFB client and vice versa.

I already found a way to capture keypress events, so that should not be as hard to implement.

EDIT: reading from RFB clipboard is also implemented, but also here the QT part is missing currently.

zocker-160 commented 2 years ago

I just pushed version 0.2.1 which is not only a complete rewrite of the rfb implementation without python-twisted, but it also implements basic keyboard and pointer inputs.

I also added an example implementation to the readme.

Is that was you were asking for, any more suggestions?

ken3 commented 2 years ago

Great! It's almost the one I expected. But the mouse event handling does not seems to be correct.

self.pointerEvent(*self._getRemoteRel(ev), ev.button())

I guess RFBClient.pointerEvent should receive buttonmask(bitfield) insted of button number (see my previous PR).

zocker-160 commented 2 years ago

oh thanks for letting me know, I indeed made a mistake since I did not know, that the bitfield of VNC is different to the one used in QT - I will fix asap

for the record:

bitfield QT VNC
00000000 nothing pressed nothing pressed
00000001 LMB LMB
00000010 RMB MMB
00000100 MMB RMB

pressing MMB (middle mouse button) does therefore do a right click with the current implementation.

zocker-160 commented 2 years ago

I just pushed 0.2.2, which should solve this issue.

Now the only missing part is add mouse tracking

ken3 commented 2 years ago

I tried 0.2.2, and I added mouse tracking feature. Please see my another PR.

zocker-160 commented 2 years ago

thank you for the PR, I did some very small changes and pushed it as 0.2.3

ken3 commented 2 years ago

Thank you for merging.