I have developped an text editor on PC. Now I would like to port it to UNIX.
However, I have some problems to detect control, alt or meta key pressed.
Does anyone know how to do this on text terminal? TKS.
With curses you can do it . There is a function named unctrl( char )
that returns the ctrl character in ^X notation.Of course you'll have to be
on a 8bit term to use this.See man curses or ncurses for more detail.
Happy New Year
The short answer is you can't detect ctrl/alt/shift from the user's terminal,Quote:>Hi!
>I have developped an text editor on PC. Now I would like to port it to UNIX.
>However, I have some problems to detect control, alt or meta key pressed.
>Does anyone know how to do this on text terminal? TKS.
There _are_ ways to do this with 'doorway' mode on IBM PC terminal programs, but
your better off designing the program to respond to sequences like CTRL-B rather
than depending on beling able to detect the CTRL key alone.
Plus, if you stick to the "standard" Wordstar(tm) sequences, such as CTRL-Y to
delete a line, etc, then people will be able to use your editor without
learning a whole new set of commands.
FREE Usenet/Mail, inexpensive Internet - Ripco... Wearing white hats since 1983
Dialup:(312) 665-0065|Gopher:gopher.ripco.com|Telnet:foley.ripco.com ('info')
I access the Solaris 5.7 server as x terminal. However, I can not use
the Alt key and Meta key.
I tried to use xmodmap to map the key.
I also put a .Xmodmap file in my home directory for .xinitrc.
The file contents are:
add mod1 = Alt_L
add mod4 = Meta_L Meta_R
keysym Alt_L = Alt_L Meta_L
keysym Alt_R = Alt_R Meta_R
And the results when I run "xmodmap -pke" are:
keycode 9 =
keycode 10 =
keycode 11 =
keycode 12 =
keycode 13 = Shift_R Shift_R
keycode 14 = Control_R Control_R
keycode 15 = Alt_R Meta_R
keycode 16 = BackSpace Delete
keycode 17 = Tab Tab
keycode 18 = Alt_L Meta_L
keycode 19 =
keycode 20 = Clear Clear
keycode 21 = Return
keycode 22 =
keycode 23 =
keycode 24 = Shift_L Shift_L
keycode 25 = Control_L Control_L
keycode 26 = Menu Menu
keycode 27 = Pause Pause
keycode 28 = Caps_Lock Caps_Lock
keycode 29 = KP_F1 KP_F1
keycode 30 =
keycode 31 =
... ... ...
But the problem is there is no Alt_L Alt_R key. So the association Meta
key to Alt key definitely not
Any one has good suggestion for fixing my Alt Key problem?
2. Mouse + KDE