LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 04-03-2012, 11:55 AM   #1
nass
Member
 
Registered: Apr 2006
Location: Athens, Greece
Distribution: slackware, debian, ubuntu
Posts: 666

Rep: Reputation: 39
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)

Last edited by nass; 04-03-2012 at 12:30 PM.
 
Old 04-03-2012, 01:57 PM   #2
nass
Member
 
Registered: Apr 2006
Location: Athens, Greece
Distribution: slackware, debian, ubuntu
Posts: 666

Original Poster
Rep: Reputation: 39
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?
 
Old 04-03-2012, 03:19 PM   #3
nass
Member
 
Registered: Apr 2006
Location: Athens, Greece
Distribution: slackware, debian, ubuntu
Posts: 666

Original Poster
Rep: Reputation: 39
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.
 
  


Reply

Tags
keyboard, mapping, xnest, xterm



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Keyboard mapping using xev see what key code, a key is bond to? NightSky Slackware 12 10-14-2011 03:03 AM
Mapping AltGr key to act as WIN key krisrao Linux - Newbie 3 02-11-2009 08:14 PM
char mapping display problems after switching to 2.6.28 lelnguye Linux - Kernel 0 01-04-2009 09:18 AM
Changing keyboard mapping for xterm in xwindow stting Slackware 7 07-11-2004 08:45 PM
ASCII char mapping tlennon Linux - Newbie 0 03-05-2001 07:10 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

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

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration