bk138 / multivnc

MultiVNC is a cross-platform Multicast-enabled VNC viewer based on LibVNCClient. The desktop version runs on Unix, Mac OS X and Windows. There also is an Android version.
GNU General Public License v3.0
446 stars 65 forks source link

Function key on Gemini PDA Android device broken, can't enter dashes, underscores and more #19

Open ghost opened 5 years ago

ghost commented 5 years ago

When using multivnc on the Gemini PDA Android phone (which has a hardware keyboard where some different key characters are accessed via shift, but some others also via an additional function key) the function key doesn't work inside the vnc session, making it impossible to enter dashes, underscores and many other vital keys. It works fine in all other apps including e.g. termux

bk138 commented 5 years ago

that's kinda hard to debug without such a device. are you able to reproduce with an attachable hardware keyboard?

ghost commented 5 years ago

well the hardware keyboard is integrated, search "gemini pda" to get an idea (edit: in google images I mean). I don't have an actual external removable keyboard to try this, just the one that is integrated. if you want me to enable some debug log or try some debug build, I would be very happy to do so!

ghost commented 5 years ago

(I mean I do have other external keyboards, but they just don't have this function key modifier way of behaving where three instead of two important characters are mapped on many keys)

bk138 commented 5 years ago

Well then it'll definitely help if you build the app yourself and check logcat. https://github.com/bk138/multivnc/blob/master/android/app/src/main/java/com/coboltforge/dontmind/multivnc/VncCanvasActivity.java#L1006 is where keys are processed.

ghost commented 5 years ago

I don't have full android studio installed on any of my machines right now (I tend to use just the command line android SDK + NDK with python-for-android) so would you by any chance have either a debug build .apk lying around somewhere, or is there a runtime setting with which I could make the f-droid build that I'm using emit the necessary debug info?

ghost commented 5 years ago

@bk138 actually, looking at the code, I can only see this work in one of two ways:

  1. the code is updated to recognize every single one of the obscure layouts like the Gemini PDA, to recognize the special keycode combinations, and replace them with the appropriate single key code event of a desktop keycode a generic Linux desktop might use. (This doesn't seem very feasible since a larger wave of new devices with each their unusual hardware keyboards are being released, also see Neo900 and others)

  2. The code is changed to use a text event instead of key code events, and then map back from the text character, properly generated by Android with full knowledge of the layout, back to a simulated keycode of a regular desktop layout that a VNC guest might recognize. This could be optional since I imagine it could cause other issues with international layouts (e.g. would shift be possibly recognized and properly send as separate modifier for international non-ascii uppercase characters? might not be so easy) but at least it would allow this to work for most of these unusual layouts

I'm pretty sure what the code is doing right now can't work properly, per design. There is just no direct equivalent mapping from one single key press on the Gemini to another corresponding single key press on a regular desktop keyboard layout. Therefore, the current code would require the VNC target to recognize the Gemini PDA layout, that is that a specific non-shift function key pressed together with a regular ascii key may suddenly spit out a different ascii key as a two key combination not involving shift - a concept which is entirely foreign e.g. to a Desktop Linux, isn't it? So unless this is changed on a conceptual level I don't see how this can ever work properly

ghost commented 5 years ago

Just to explain this better, just look at the layout yourself:

As you can see, e.g. the ' (apostrophe) key together with the function key suddenly produces : (colon), and that's exactly what doesn't work in VNC right now. That additional different modifier on ascii keys is just not something a VNC guest would recognize, is it?

Maybe I'm wrong and got all this incorrectly, but from what I've seen of keycodes I think that is what is the fundamental problem