[comp.windows.open-look] function keys f1,f11 and f12

grp@Unify.com (Greg Pasquariello) (11/09/90)

In article <mdfzgew@openlook.Unify.Com>, uunet!nmri!loach!alex
(Alexander G. Macur) writes:

> Has anyone been able to figure out how to get function keys
> f1,f11 and f12 to work in an xterm under openlook verison 2.0 
> on a sparcstation 1.
> 
> On MIT X 11 R4 server they work fine
> 

First you have to understand keys vs keysysms.  Whenever a key
is pressed, the X server takes that key, and maps it to a keysym.
The keysym is what xterm thinks was really pressed.  For example
pressing the F3 Key causes the server to map an F3 keysym, and
everything works just fine.

The problem is that the xnews server maps the sun keys in an
odd way.  By default, it maps the L1 and L2 keys (on the left of 
the keyboard) to the F11 and F12 keysyms, and it maps the F1 key
to the Help keysym.  It then maps the F11 and F12 keys to the 
SunF36 and SunF37 keysysms.  Don't ask me why, 'cuz I can't tell
you.

So, you've got three choices.  The easiest is to use L1 and L2 
instead of F11 and F12.  You still have the problem with F1 though.

The next easiest is to change your translations.  Everywhere you 
use <Key>F11 or <Key>F12, change it to <Key>SunF36 or <Key>SunF37
respectively.  This is not portable, and you still have the F1
problem.

Lastly, you can use xmodmap to modify the key to keysym mapping.
This is not hard, just a bit confusing.  It will solve all of the
problems that you describe.

You can use "xmodmap -pk" to see the mappings of keycode to keysym.
In order to remap the keyboard so that the keys send what you think
the should, what you need to do is change the mapping of keycode to
keysym.  The keycodes for the various keys are:

	Key Label	Key Code	Default Keysym Name
        ----------	----------	---------------------

	F1		12		Help
	F11		16		SunF36
	F12		18		SunF37
	Help		125		Help
	L1		8		F11
	L2		10		F12

The simplest command to remap all the keys you need is:

	xmodmap -e 'keycode 12 = F1' \
                -e 'keycode 16 = F11' \
                -e 'keycode 18 = F12'

Now, F1 will send F1, F11 will send F11, and F12 will send F12.  The
Help key will still invoke help, and L1 and L2 will still send F11 and
F12.  If you want to remap them, you can do that too.

If you want more information on this stuff, see the man pages for
xmodmap, xev, and xnews.  Xev allows you to watch all events on the
window;  when you press a key, you will be able to sey the keycode, and
the keysym that is being generated.
> 
> thanks in advance for any help
> 
> 
> alex
> 
> Alexander G. Macur
> New Methods Research Inc, 6035 Corporate Dr. East Syracuse NY 13057
USA
> Phone: 315-437-7500 E-mail: uunet!nmri!alex

--

---
Greg Pasquariello	
Unify Corporation 	grp@Unify.Com

root@fstc-chville.army.mil (Operator) (11/09/90)

In article <mdfzgew@openlook.Unify.Com>:
>Has anyone been able to figure out how to get function keys
>f1,f11 and f12 to work in an xterm under openlook verison 2.0 
>on a sparcstation 1.

Alex,

I don't have an answer to your specific question (Wordperfect, Yecchhh :-)...
But when I want to find out how a key is mapped, I use xev (/usr/demo/xev
if you're running OpenWin)...

Hope that helps, and pls ignore this if you've already tried xev...
Brian

sarima@tdatirv.UUCP (Stanley Friesen) (11/10/90)

I am posting this, since it is likely to be one of the FAQ's for this group.

In article <mdfzgew@openlook.Unify.Com>  writes:
>Has anyone been able to figure out how to get function keys
>f1,f11 and f12 to work in an xterm under openlook verison 2.0 
>on a sparcstation 1.

You have two seperate problems here.

First, according to the X standard the keysyms for F11 and F12 are the same
as the keysyms for L1 and L2.  Since the Sparc has both, this is a mapping
problem.  Openwindows 2.0 has solved this by introducing two vendor-specific
keysyms (as allowed by the standard).  They are: SunF36 and SunF37 for
F11 and F12 respectively.  Use these in your translations and all will be well.

Second, the defualt Help key for Openwindows 2.0 is F1.  This is actually
established in the initialization file $OPENWINHOME/lib/Xinitrc.  If, as
is typical, your Sparc has a key labeled HELP, you do not need this mapping.
You may remove it by simply editing $OPENWINHOME/lib/Xinitrc to remove or
(better) comment out the xmodmap command.  (This will only be a problem if
your Openwindows is network installed and some stations lack a HELP key).

>On MIT X 11 R4 server they work fine
>
I'm not quite sure how though - it should be treating L1 and L2 as if they
were equivalent to F11 and F12.
-- 
---------------
uunet!tdatirv!sarima				(Stanley Friesen)

guy@auspex.auspex.com (Guy Harris) (11/10/90)

>The problem is that the xnews server maps the sun keys in an
>odd way.  By default, it maps the L1 and L2 keys (on the left of 
>the keyboard) to the F11 and F12 keysyms,

From the X11R4 <X11/keysymdef.h>:

	/*
	 * Auxilliary Functions; note the duplicate definitions for left and right
	 * function keys;  Sun keyboards and a few other manufactures have such
	 * function key groups on the left and/or right sides of the keyboard.
	 * We've not found a keyboard with more than 35 function keys total.
	 */

	...

	#define XK_F10			0xFFC7
	#define XK_F11			0xFFC8
	#define XK_L1			0xFFC8
	#define XK_F12			0xFFC9
	#define XK_L2			0xFFC9

so the L1 keysym is the *same* as the F11 keysym in X11 (and therefore
it had better be the same in OW, the X side of that being X11).  The
same applies to L2/F12.

The MIT Sun server does the exact same thing as the OW server here.

>and it maps the F1 key to the Help keysym.

For the benefit of IBM PC weenies out there, I assume.  If, as, and when
we get OW here, I'd probably make the frigging Help key have the Help
keysym, and the F1 key have the F1 keysym....  (That's what the MIT
server does.)

>It then maps the F11 and F12 keys to the SunF36 and SunF37 keysysms.

Because the F11 and F12 keysyms are already spoken for.  (The MIT server
maps F11 to F11/L1 and F12 to F12/L2, so L1 and F11.)

Apparently, the X11 folks at MIT hadn't found any Type 4 keyboards as of
when they wrote that comment, because I have no trouble finding a
keyboard with 37 "numbered" function keys (L1-L10, F1-F12, R1-R15) -
there's one right under my fingers as I type.... 

jeff@Unify.com (Jeff Mischkinsky) (11/14/90)

In article <1990Nov8.083925@Unify.com>, grp@Unify.com (Greg
Pasquariello) writes:
> In article <mdfzgew@openlook.Unify.Com>, uunet!nmri!loach!alex
> (Alexander G. Macur) writes:
> 
> > Has anyone been able to figure out how to get function keys
> > f1,f11 and f12 to work in an xterm under openlook verison 2.0 
> > on a sparcstation 1.
> > 
> > On MIT X 11 R4 server they work fine
> > 
> 
> First you have to understand keys vs keysysms.  Whenever a key
> is pressed, the X server takes that key, and maps it to a keysym.
> The keysym is what xterm thinks was really pressed.  For example
> pressing the F3 Key causes the server to map an F3 keysym, and
> everything works just fine.
> 
> The problem is that the xnews server maps the sun keys in an
> odd way.  By default, it maps the L1 and L2 keys (on the left of 
> the keyboard) to the F11 and F12 keysyms, and it maps the F1 key
> to the Help keysym.  It then maps the F11 and F12 keys to the 
> SunF36 and SunF37 keysysms.  Don't ask me why, 'cuz I can't tell
> you.

The reason is that the standard X keysyms only go up to F35.  Since
Sun has more than that, they had to roll their own.

--
Jeff Mischkinsky		internet: jeff@unify.com
Unify Corporation		          ...!{pyramid,csusac}!unify!jeff
3870 Rosin Court		voice: (916) 920-9092 fax: (916) 921-5340
Sacramento, CA 95834		ICBMS: 38 38 40 N / 120 28 10 W