Question

I'm going to answer my own question here.

The question is: how do I prevent Droid VNC Server from buffering key events and not sending them to Android's input system until there's a pointer (mouse / gesture / tap etc.) event?

I am using a custom build of Droid VNC Server from Droid VNC Server on GitHub on Android x86.

The problem I was finding is I would type a series of characters on the keyboard in some editable text field but they wouldn't appear until I touched somewhere on the screen (being careful not to let the text field lose focus) thus causing a mouse event.

Was it helpful?

Solution

In /jni/vnc/inputMethods/input.c there's a method keyEvent where I added one line of code to flush the key events in 'realtime':

void keyEvent(rfbBool down, rfbKeySym key, rfbClientPtr cl)
{
....
if (key && down)
{
....
}
// Added this to "flush" out key events as they come in achieving real-time
// character input on Android
suinput_write(inputfd, EV_SYN, SYN_REPORT, 0);
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top