Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ineffective nocursor argument #206

Open
Willard-Robbins opened this issue Dec 22, 2021 · 2 comments
Open

ineffective nocursor argument #206

Willard-Robbins opened this issue Dec 22, 2021 · 2 comments
Labels

Comments

@Willard-Robbins
Copy link

vncdotool version 1.0.0
python version 3.10

The VNC server is an old binary. I believe it came from Real VNC.

I'm passing the output screenshot of vncdotool to OpenCV to confirm on-screen UI elements. I would like the screenshot to exclude the cursor so that it does not interfere with template matching. Despite using the nocursor argument, my screenshots still contain the cursor... Am I missing something?

    vnc_client = api.connect(host, password=None)
    vnc_client.timeout = 10
    vnc_client.nocursor = True  # Appears to be ineffective. Want to remove the cursor from screenshots to prevent occlusion.
    vnc_client.captureScreen('screenshot.png')  # Resulting screenshot contains the cursor.
@pmhahn pmhahn added the bug label Feb 4, 2023
@pmhahn
Copy link
Collaborator

pmhahn commented Feb 4, 2023

nocursor onyl works when client-side rendering is negotiated with the server: In that case the cursor shape and position are sent to the client, which is then supposed to merge the cursor shape into the screen before displaying it to the user.
Without the extension the server will handle that and will instead sent the screen with the cursor already merged in, which the client cannot undo.
Please check if your server does the merging — in which case this issue would be invalid — or the client is supposed to do it. Sadly there is no easy way in vncdotool to see, if PSEUDO_CURSOR = -239 is negotiated: If you're experienced with pdb you can add a break _handleDecodePsuedoCursor or you might want to use wireshark to see, if you an updateRectangle with that encoding is received by the client — or use another VNC client, which is more verbose.

@pevogam
Copy link
Contributor

pevogam commented Apr 3, 2023

I just want to add that before closing this issue it might be worth it to add some of @pmhahn's explanation in the documentation. At first I looked at the nocursor and pseudocursor options in https://vncdotool.readthedocs.io/en/latest/modules.html?highlight=cursor#vncdotool.client.VNCDoToolClient.cursor (since my initial guess for nocursor from just looking at the source code had no effect as above) but there are no docstrings explaining the meaning of either of these, even a single short sentence might be quite helpful. Then also adding the above detail could be very helpful so that other users don't have to look up the issues on Github to figure this out.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants