wwc@boole.ece.wisc.edu (William W. Carlson) (06/08/89)
Two quick and related questions. I have a sun (386i, but that's not important) with a type 4 keyboard. I am also running X11R3 as distributed, with patches 1-9 applied. I would like the "num lock" key to have the "desired" effect, that is, when num lock is on, the keypad goes into numbers mode. Can I do this easily/at all in X and xterm? On a related issue, some of the left keys have legends like "front", "open", etc. In sunview, these have the action of performing the appropriate window functions (like just press front to bring the current window to the top). Is there any way I can get these keys through to the window manager and have it do the appropriate thing in X? Thanks for your answers and advice in advance. Bill Carlson wwc@boole.ece.wisc.edu wwc%boole.ece.wisc.edu@cs.wisc.edu
rws@EXPO.LCS.MIT.EDU (06/08/89)
I would like the "num lock" key to have the "desired" effect, that is, when num lock is on, the keypad goes into numbers mode. Can I do this easily/at all in X and xterm? There is no mechanism in xterm, or in Xlib, at present to permit this. An application could certainly do this on its own, if it wanted. Is there any way I can get these keys through to the window manager and have it do the appropriate thing in X? It will be up to the individual window manager as to whether window functions can be bound to key events. You can certainly get the keys through. You'll have to decide on what keysyms to hang on them, as most window managers will be keysym based rather than keycode based.
erc@pai.UUCP (Eric Johnson) (06/09/89)
In article <WWC.89Jun7220439@boole.ece.wisc.edu>, wwc@boole.ece.wisc.edu (William W. Carlson) writes: > Two quick and related questions. I have a sun (386i, but that's not > important) with a type 4 keyboard. I am also running X11R3 as > distributed, with patches 1-9 applied. I would like the "num lock" > key to have the "desired" effect, that is, when num lock is on, the > keypad goes into numbers mode. Can I do this easily/at all in X and > xterm? This is probably pretty messy. > On a related issue, some of the left keys have legends like "front", > "open", etc. In sunview, these have the action of performing the > appropriate window functions (like just press front to bring the > current window to the top). Is there any way I can get these keys > through to the window manager and have it do the appropriate thing in > X? Some window managers in X allow you to specify certain keys/events to do certain window manager functions. I suspect you will have the best luck with L5/Front. > Thanks for your answers and advice in advance. > > Bill Carlson > wwc@boole.ece.wisc.edu > wwc%boole.ece.wisc.edu@cs.wisc.edu Hope this helps... In running the xev (X event) client, I tested out the Sun type 4 keyboard on the Sun 386i. In general, the Left function keys map to the Lx keysyms (which are also Fx keysyms) and the right keys map to Rx (also Fx) keysyms. There were a few oddities. You may be able to map certain keys to do certain functions with your window manager's configuration file (e.g., .uwmrc, .twmrc, etc.). Other than that, it probably gets messy. Anyway, for more information, check ~/X11/include/keysym*.h. Here is what xev listed. Generally, the keysym symbols just need an "XK_" prepended, such as "XK_Help" for the Help key. Sun Type 4 X (as listed by xev) L1/ Stop F11 (XK_F11 == XK_L1, and so on) L2/ Again F12 L3/ Props F13 L4/ Undo F14 L5/ Front F15 L6/ Copy F16 L7/ Open F17 L8/ Paste F18 L9/ Find F19 L10/ Cut F20 Help Help (wow, a match) R1/ Pause F21 R2/ PrSc F22 R3/ Scrolllock/ Break F23 R4/ = F24 (not the keypad =) R5/ / F25 R6/ * F26 R7/ Home F27 R8/ Up/ 8 Up R9/ PgUp/ 9 F29 (not Prior) R10/ Left/ 4 Left R11/ 5 F31 R12/ Right/ 6 Right R13/ End/ 1 R13 (funny, this wasn't listed as an Fx key by xev) R14/ Down/ 2 Down R15/ PgDn/ 3 F35 (not Next) 0/ Ins NoSymbol (PC Insert Key) ./ Del NoSymbol (PC Delete Key) Left Diamond Meta_L (Left meta, or meta 1) Right Diamond Meta_R (Right meta) Alt Break (this is a funny one) Good luck, -Eric -- Eric F. Johnson | Phone +1 612-894-0313 | Are we Prime Automation,Inc | UUCP: bungia!pai!erc | having 12201 Wood Lake Drive | UUCP: sun!tundra!pai!erc | fun Burnsville, MN 55337 USA | DOMAIN: erc@pai.mn.org | yet?
markc@Solbourne.COM (Mark Connell) (06/09/89)
> type 4 keyboard ... I would like the "num lock" key to have the "desired" > effect This would have to be done in xterm. The problem is that the num_lock key is defined as a function key, not as a modifier. (RWS - If you are out there, WHY?). The other problem you may run into is that on some Sun's (Sun 4's at least) the type 4 keyboard says it is a type 3 keyboard. The type 3 does not have a num lock key. If this is the case, I think you need on OS mod to get the keyboard to admit it is a type4, which might break other (non X) applications. I got around this by defining the shifted versions of the R keys to be the numeric keys. This probably is not a good idea, since some applications may want to use the shifted R keys. You may also be able to modify sunKeyMap.c (in the server) if the type3 keyboard does not return the same code as the type for does for num lock. >Is there any way I can get these keys (L keys) ... to do the appropriate thing > in X? That depends on what window mgr you are using, but some of them should be easy. Front and Open should be easy enough, check the documentation for your window mgr. Others would take modifications to applications, for example Cut, Paste, Undo, .... Hope this is at least a little help. Mark A. Connell Solbourne Computer, Inc. 1900 Pike Road Longmont, Co 80501 (303) 772-3400 markc@Solbourne.COM ...!boulder!stan!markc
rws@EXPO.LCS.MIT.EDU (06/09/89)
The problem is that the num_lock key is defined as a function key, not as a modifier. That's not really the problem at all. The real problem is that neither the Xlib nor the Xt key handling routines recognize Num Lock semantics. If you got past that, you might get to the semantics of IsMiscFunctionKey (but I doubt it). (RWS - If you are out there, WHY?) Am I responsible for everything? Probably because whoever defined the macro had never touched an IBM keyboard before. If you think it's wrong, please file a bug report.
stevep@stellar.COM (Steve Pitschke) (06/10/89)
>> The problem is that the num_lock key >> is defined as a function key, not as a modifier. >> That's not really the problem at all. The real problem is that neither the >> Xlib nor the Xt key handling routines recognize Num Lock semantics. If you got >> past that, you might get to the semantics of IsMiscFunction>> Key (but I dou bt >> it). >> (RWS - If you are out there, WHY?) >> Am I responsible for everything? Probably because whoever defined the macro >> had never touched an IBM keyboard before. If you think it's wrong, please >> file a bug report. Actually, I have my numlock key working with the following lines from my Xdefaults file. (You may have to run xmodmap to assign Mod2 "shift" functionality to the numlock key as well, depending on what your friendly server implementor defined as the default modifiers. % xmodmap -e 'add mod2=Num_Lock' I have good access to the one at Stellar.) XTerm.VT100.Translations: #override \ <Key>Insert: string(0x1b) string("[1~") \n\ . . . <Key>Right: string(0x1b) string("[C") \n\ \ Mod2 <Key>KP_Divide: string("/") \n\ Mod2 <Key>KP_Multiply: string("*") \n\ Mod2 <Key>KP_Subtract: string("-") \n\ Mod2 <Key>KP_7: string("7") \n\ Mod2 <Key>KP_8: string("8") \n\ Mod2 <Key>KP_9: string("9") \n\ Mod2 <Key>KP_Add: string("+") \n\ Mod2 <Key>KP_4: string("4") \n\ Mod2 <Key>KP_5: string("5") \n\ Mod2 <Key>KP_6: string("6") \n\ Mod2 <Key>KP_1: string("1") \n\ Mod2 <Key>KP_2: string("2") \n\ Mod2 <Key>KP_3: string("3") \n\ Mod2 <Key>KP_0: string("-") \n\ Mod2 <Key>KP_Decimal: string(".") \n\ Mod2 <Key>KP_Enter: string(0x0a) \n\ \ ~Mod2 <Key>KP_Divide: string(0x1b) string("[OQ") \n\ ~Mod2 <Key>KP_Multiply: string(0x1b) string("[OR") \n\ ~Mod2 <Key>KP_Subtract: string(0x1b) string("[OS") \n\ ~Mod2 <Key>KP_7: string(0x1b) string("[Ow") \n\ ~Mod2 <Key>KP_8: string(0x1b) string("[Ox") \n\ ~Mod2 <Key>KP_9: string(0x1b) string("[Oy") \n\ ~Mod2 <Key>KP_Add: string(0x1b) string("[Om") \n\ ~Mod2 <Key>KP_4: string(0x1b) string("[Ot") \n\ ~Mod2 <Key>KP_5: string(0x1b) string("[Ou") \n\ ~Mod2 <Key>KP_6: string(0x1b) string("[Ov") \n\ ~Mod2 <Key>KP_1: string(0x1b) string("[Oq") \n\ ~Mod2 <Key>KP_2: string(0x1b) string("[Or") \n\ ~Mod2 <Key>KP_3: string(0x1b) string("[Os") \n\ ~Mod2 <Key>KP_0: string(0x1b) string("[Op") \n\ ~Mod2 <Key>KP_Decimal: string(0x1b) string("[On") \n\ ~Mod2 <Key>KP_Enter: string(0x1b) string("[OM") \n\ \ . . .
dshr@SUN.COM (David Rosenthal) (06/10/89)
> This would have to be done in xterm. The problem is that the num_lock key > is defined as a function key, not as a modifier. (RWS - If you are out there, > WHY?). This comment reveals a lack of understanding of the way keys and modifiers are handled in X11. There is no such thing as a defined modifier key in X. There are 8 modifier bits (NOT keys). The Shift, Lock, and Control bits (NOT keys) are predefined. The other bits can be assigned as required (for example, to a NumLock modifier). The mechanism for doing this is described in the ICCCM. Note that the things that affect modifier bits are keycodes, not keysyms. There is no practical sense in which any keysym (such as num_lock) is defined as a function keysym, or a modifier keysym, or as any different from any other keysym. Keysyms simply describe the symbol(s) on the keys. They are simply hints that a client may use to attach meaning to a keycode or may ignore at its pleasure. Any number of keys can be defined to affect the state of a modifier bit - the set of keys that affect each bit is dynamic. Modifier bits are a scare resource in X11, which is why the ICCCM describes mechanisms for assigning them dynamically as required. It is also why only a small number of the possible modifiers are pre-assigned - I argued against pre-assigning Lock as well. Your comment about xterm is an example of the general problem. The mapping of the key events to (for example) ASCII digits is a matter for each individual client. Uniform support for a NumLock modifier across all clients involves changing the Xib implementation they all use. Simple enough for a single machine (if you have shared libraries) but not so easy if some of your clients are elsewhere......... David.
rws@EXPO.LCS.MIT.EDU (06/10/89)
There is no practical sense in which any keysym (such as num_lock) is defined as a function keysym, or a modifier keysym, or as any different from any other keysym. Sorry, David, this is not correct. Xlib has macros for "categorizing" keysyms (see section 10.1.2). You can decide that this was a mistake (and I might agree), but there it is.
richard@torch.UUCP (Richard Nuttall) (06/13/89)
wwc@boole.ece.wisc.edu (William W. Carlson) writes: >... I would like the "num lock" >key to have the "desired" effect, that is, when num lock is on, the >keypad goes into numbers mode. Can I do this easily/at all in X and >xterm? Add the following to your .Xdefaults file or put it in the app-defaults/XTerm file. XTerm*VT100.Translations: #override \ <Key>Num_Lock: keymap(numbers) XTerm*VT100.numbersKeymap.translations: \ <Key>KP_1: string("1") \n\ <Key>KP_2: string("2") \n\ <Key>KP_3: string("3") \n\ <Key>KP_4: string("4") \n\ <Key>KP_5: string("5") \n\ <Key>KP_6: string("6") \n\ <Key>KP_7: string("7") \n\ <Key>KP_8: string("8") \n\ <Key>KP_9: string("9") \n\ <Key>KP_0: string("0") \n\ <Key>Num_Lock: keymap(None) The mechanism is documented in the xterm man page. The function keys can likewise be defined. >On a related issue, some of the left keys have legends like "front", >"open", etc. In sunview, these have the action of performing the >appropriate window functions (like just press front to bring the >current window to the top). Is there any way I can get these keys >through to the window manager and have it do the appropriate thing in >X? I haven't found a way to do this yet, at least not with awm. -- Richard Nuttall | ukc!stc!datlog!torch!richard Torch Technology Ltd. | 0223 841000 X 309 Cambridge England |
toml@Solbourne.COM (Tom LaStrange) (06/16/89)
]>On a related issue, some of the left keys have legends like "front", ]>"open", etc. In sunview, these have the action of performing the ]>appropriate window functions (like just press front to bring the ]>current window to the top). Is there any way I can get these keys ]>through to the window manager and have it do the appropriate thing in ]>X? ] ] I haven't found a way to do this yet, at least not with awm. twm allows you to do this. -- Tom LaStrange Solbourne Computer Inc. ARPA: toml@Solbourne.COM 1900 Pike Rd. UUCP: ...!{boulder,nbires,sun}!stan!toml Longmont, CO 80501