corbinlc / gnuroot

151 stars 29 forks source link

emacs under X gets no keyboard input #69

Open qobi opened 9 years ago

qobi commented 9 years ago

I'm running GNURoot Debian on a Samsung Galaxy S6. I have xvncpro installed on Android. I have emacs24-lucid installed in the GNURoot. And I have a bluetooth keyboard connected. I can run emacs fine using the bluetooth keyboard in the console terminal window. I can bring up an xterm from GNURoot in xvncpro and I can type to the xterm from the bluetooth keyboard just fine. But if I run emacs -nw in the xterm, I can't type into the emacs. And if I run emacs without -nw, I also can't type into the emacs. Any ideas of how to fix this?

qobi commented 9 years ago

I have done some more experimentation. It appears that it is a problem with the X server in xvncpro. (a) It doesn't interpret the Alt key on the bluetooth keyboard as a meta key. This happens no matter whether I run in emacs, an xterm, or even xev. This is even the case, if I ssh with JuiceSSH to a Debian machine and tunnel X (and run an xterm; I haven't tried emacs or xev). (b) The arrow keys on the bluetooth keyboard don't get sent as xkey events. They can interpreted as mouse move events. Both to a local GNURoot xclient and to a remote xclient over JuiceSSH tunneled X. (c) The ctrl- key doesn't work. Ditto bot to a local GNURoot xcliet and to a romote xclient over JucieSSH tunneled X.

Does anyone know how to get xvncpro to send proper xkey events for (a) Alt, (b) arrow keys, and (c) the ctrl- key? For that matter all keys like PgUp, PgDn, Home, End, Ins, Del, ...

Alternatively, can anyone recommend a better X server for Android?

I know that these keys work (on my bluetooth keyboard). Inside the JuiceSSH console, they all work. (I have run emacs in -nw mode inside a JucieSSH console and Ctrl- works, Alt works, the arrow keys work, and PgUp, PgDn, Ins, Del, Home, and End all work.

But if I run emacs -nw in the GNURoot console then the Alt key (from my bluetooth keyboard) does not work. But the Ctrl- key, the arrow keys, PgUp, PgDn, Ins, Del, Home, and End all work.

Is there a way to make the Alt key (from a bluetooth keyboard) work in the GNURoot console?

I also have a bluetooth mouse connected to my Android device. I can use the mouse to do Android things gesture.

But, inside the xvncpro X server, the mouse does not track the bluetooth mouse. If I click with the mouse, then a single mouse move and mouse click xevent gets sent. But the mouse does not track, sending a smooth stream of mouse motion xevents as the mouse moves.

Is there a way to make the mouse work like a normal X server in xvncpro? If not, can anyone recommend a better X server for Android?

For years, I have had a Nokia n900 in which I had a Debian chroot. I regularly used emacs with a bluetooth keyboard to edit LaTeX documents and compiled them and viewed them with xpdf or xdvi. And I could write, compile, and run C and Scheme code. It was convenient to be able to do this from a phone and keyboard that I would carry in my pocket so that I didn't have to carry a laptop. Later I did this with a Viliv N5. I recently switched to a Samsung Galaxy S6. I'm trying to duplicate the functionality.

tytso commented 8 years ago

It looks like the Alt key is being mapped to the mod4 (Alt/Alt-Gr) modifier in X, instead of the mod1 (Meta) modifier by default. You can test /verify this using xev, or when I tried typing Alt-X, emacs complained that there was no binding for A-x. This should be something you can workaround using xmodmap, although I ended up giving up on the X server because the performance wasn't great and using a mouse wasn't a lot of fun with only a touchscreen, and so I preferred using console mode anyway.