LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (http://www.linuxquestions.org/questions/slackware-14/)
-   -   wrong key to char mapping when starting an xterm in Xnest (http://www.linuxquestions.org/questions/slackware-14/wrong-key-to-char-mapping-when-starting-an-xterm-in-xnest-937927/)

nass 04-03-2012 11:55 AM

wrong key to char mapping when starting an xterm in Xnest
 
hello there,
some oddity that I can't get my head to fix..
probably I need to run xmodmap (?) or something.

basically I want to run remote application in my local pc, and since ssh -Y doesn't work as expected (see this post
I started an Xnest in my local pc as follows:

Xnest -geometry 1024x768 -ac :2

and then in another terminal, I started an xterm within this Xnest server as:

xterm -display :2

The problem is that if I now try to type something, the keys that I press on my keyboard do not correspond to the keys that show up on that xterm.
how can I fix that??

thank you all for your help.
Nass


EDIT: I tried xev, the keys pressed correspond to the char that appears on screen.
EDIT2: the above statement corresponds to running xev on the local display only, if i run xev on the Xnested xterm, the key code and keysym are a mess.

analytically:
xev on local display: i press 'q' on keyboard. xev returns keycode 54 (keysym 0x71,q)
xev on Xnest display: i press 'q' on keyboard. xev returns keycode 54 (keysym 0x63,c)

nass 04-03-2012 01:57 PM

hm this all seems to be due to the vnc server (hope you read the other post) for some reason (or the lack of sourcing some config file)

basically, the keycodes that are generated in a local slackbox (that has keyboard, mouse and screen), are different to the keycodes that xev understands on the pc which I accept through vnc.
so while the vnc server has some internal xmodmap file to follow, (with different keycode-keysym pairs), when I start an Xnest from within that vnc'ed session, the normal xmodmap file is sourced. only now there is keycode mismatch.

this is poorly explained so i'll give an example:

xev on local machine: I press 'q' , xev returns keycode 24, keysym 0x71 ,q
(checked with 'xmodmap -pke': keycode 24 = q Q q Q, notice that also that keycode 54 = c C c C )
xev on local machine again: I press 'c' , xev returns keycode 54, keysym 0x63 ,c
(checked with 'xmodmap -pke': keycode 54 = c C c C )

xev on vnc machine: I press 'q' , xev returns keycode 54, keysym 0x71 ,q
(the 'xmodmap -pke' returns a different xmodmap here: keycode 54 = q Q, so I get the right keysym, but for a different keycode)

xev on Xnested 3rd machine, accessed through vnc machine: I press 'q' , xev returns keycode 54, keysym 0x63 ,c
(the xmodmap of the Xnest session is indeed the same as the one on the local machine, but since it gets a different keycode from the vnc , it will also output a different keysym)

bammer, so the question is why does tightvnc understands different keycodes than the codes that the local machine understands?

nass 04-03-2012 03:19 PM

ok i'm contacting tightvnc to figure out why the vnc session understands different keycodes for the keys pressed (and thus uses a different xmodmap file to show the correct characters).
In the meantime, in order for me to do what I initially wanted - that is to type the correct characters in the Xnest'ed xterm, I used the command from within the xvnc session (note that I have ssh -Y to the Xnest pc and started up the Xnest on that remote pc, not on the vnc session pc)

Quote:

user@vnc-session-pc$ xmodmap -pke > xmodmap-vnc-file
to get the mappings that vnc uses.
Then I ssh -Y (from within the vnc session) to the remote Xnested pc, copy the xmodmap-vnc-file (with scp perhaps) and use the same command to overload Xnests xmodmap with the vnc's xmodmap

Quote:

user@Xnest-session-pc$ xmodmap -display :0 xmodmap-vnc-file
with -display :0 I am simply redirecting the output of the xmodmap command to the Xnest server which is running on the remote pc.


All times are GMT -5. The time now is 03:48 PM.