gujjwal00 / avnc

VNC Client for Android
GNU General Public License v3.0
600 stars 57 forks source link

only last tap registered when tapping rapidly #224

Closed NANASHI0X74 closed 2 months ago

NANASHI0X74 commented 4 months ago

I noticed that when I rapidly tap things, the server only registers one click, even if I tap on two locations on screen. Is this intentional and if yes is it configurable in any way?

gujjwal00 commented 4 months ago

That's not intentional. Which operating system are running on remote server?

NANASHI0X74 commented 4 months ago

nixOS, sway desktop, wayvnc server

although I don't have this problem with other vnc clients when I use tigervnc on my laptop and rapidly click there

NANASHI0X74 commented 4 months ago

https://github.com/gujjwal00/avnc/assets/17546398/508387ea-fd3a-40a2-986a-22b621868600

Here, I recorded an example

gujjwal00 commented 4 months ago

Thanks, the video is very helpful.

gujjwal00 commented 4 months ago

I am unable to reproduce the problem on my side. Does this issue happen with all apps/games running on remote server?

Please try enabling delayed click events: Long press on the server => Edit => Advanced => Enable Send delayed click events

gujjwal00 commented 3 months ago

Any updates @NANASHI0X74 ?

NANASHI0X74 commented 3 months ago

Hi, yes- I just had the same behavior with a graphics program called pinta:

https://github.com/gujjwal00/avnc/assets/17546398/b0e38aaf-02dd-44d1-965b-dbdb2ce8c204

The behavior is the same with delayed click events enabled or disabled, I couldn't really notice a difference.

NANASHI0X74 commented 3 months ago

On my laptop I mainly use tigervnc's vncviewer, where this problem doesn't manifest.

If it helps: The connection in both cases is in my local network at home- wifi on the client (phone or laptop) end and ethernet on the server end. The server runs sway and wayvnc

gujjwal00 commented 3 months ago

Can you please post a screenshot of Input Settings in AVNC?

gujjwal00 commented 3 months ago

One more thing: please go to AVNC Settings => Tools => Touch test. Tap rapidly in the grey area, just like you are doing in previous video with pinta. Copy & paste the logs here. Thanks.

gujjwal00 commented 3 months ago

Never mind, I was able to reproduce it with pinta. Although, the root cause may the way gesture detection works in Android. Let me investigate a bit more.

gujjwal00 commented 3 months ago

As far as I can tell, there are two cases here:

  1. Rapid taps at/near single point - In this case 2 consecutive taps will be treated as double-tap by Android's gesture detector. If you tap 6 times, there will be 3 double-taps. If you tap 7 times, there will be 3 double-taps followed by 1 single-tap. For double-taps, AVNC will send a double-click event (or whatever you have set in settings).
  2. Rapid taps at different points: In this case, taps aren't happening as same point, so gesture detector will not generate double-taps. But it will also not generate single-taps if taps are happening quicker than a threshold (~ 300 millisecond, known as double-tap timeout). So only the last tap will trigger single-tap.

To test this, I ran xev | grep -n ButtonPress but I don't know if that works under Wayland. You can sort of use pinta to test this theory: If you zoom-in in pinta to make touches larger, you can see that touch caused by rapid tapping at some point is darker than what is caused by single tap. You can also test the second case by rapidly tapping by both thumbs at far ends of the screen. Only the last tap will be registered.

Unfortunately, this is not something I can fix. The timeout is necessary for gesture detection to work.

NANASHI0X74 commented 3 months ago

ahh, that does make sense. 🤔 is it worth considering adding an option in the input settings->double tap to turn off detection for that gesture or to make the "None" Option behave that way?

gujjwal00 commented 3 months ago

That option only controls what happens in response to double-tap. The detection is done by Android framework APIs.

gujjwal00 commented 2 months ago

Closing since this is not something I can change.