[comp.windows.x] Intercepting key events by a window manager

tale@pawl.rpi.edu (David C Lawrence) (05/24/89)

Are there any window managers which currently will intercept key
events, a la NeWS or SunView (suntools-e being a better example of what
I want).  For example, I want to bind f.focus to a key event much
the same way it can be bound to a button event.

If this is dumb to even suggest such a thing for a window manager (I
don't think it is and what I've seen about X internals indicates to me
that it is a possibility) would someone please set me straight on the
issue? 

Thanks in advance ...

Dave
--
 (setq mail '("tale@pawl.rpi.edu" "tale@itsgw.rpi.edu" "tale@rpitsmts.bitnet"))

toml@Solbourne.COM (Tom LaStrange) (05/25/89)

> Are there any window managers which currently will intercept key
> events, a la NeWS or SunView (suntools-e being a better example of what
> I want).  For example, I want to bind f.focus to a key event much
> the same way it can be bound to a button event.
> 
> If this is dumb to even suggest such a thing for a window manager (I
> don't think it is and what I've seen about X internals indicates to me
> that it is a possibility) would someone please set me straight on the
> issue? 
> 

If I understand you right, twm allows you to do such a thing.  You 
could put something like

  "F1" = : window : f.raise

in your .twmrc file, and when the F1 key is pressed while the pointer
is in the client window, the window will be raised.  It's not dumb,
it's VERY useful,  I couldn't get by without it.

--
Tom LaStrange

Solbourne Computer Inc.    ARPA: toml@Solbourne.COM
Longmont, CO               UUCP: ...!{boulder,nbires,sun}!stan!toml

tale@pawl.rpi.edu (David C Lawrence) (05/25/89)

Thanks for the answers I've gotten on this, all of which point to twm.
About the only shortcoming I see is that it doesn't let you bind to an
arbitrary key sequence but only to specialized function keys; ie, I
would have to say "F1" rather than "^[1A." or whatever the key
sequence for F1 is.  Obviously in this case that seems better, but it
is not equally so for wanting to bind "." or "^D^Q".  

Dave
--
 (setq mail '("tale@pawl.rpi.edu" "tale@itsgw.rpi.edu" "tale@rpitsmts.bitnet"))

jim@EXPO.LCS.MIT.EDU (Jim Fulton) (05/25/89)

> About the only shortcoming I see is that it doesn't let you bind to an
> arbitrary key sequence but only to specialized function keys; ie, I
> would have to say "F1" rather than "^[1A." or whatever the key
> sequence for F1 is.

What does "whatever the key sequence for F1 is" mean for a clock, or any other
non-terminal emulator application?

When you press F1 on the keyboard, the server sends an event containing a
server-dependent "key code" (similar to a make/break code) to the client.  The
application can then map that keycode into a "key symbol" (called keysym, for
short) that tells the client what is engraved on the key (in this case "F1").
The application can then do with this whatever it wants.  

Textual applications such as xterm will often map this into a byte sequence as
if it had been typed on a keyboard attached to this type of terminal (e.g.
vt100, h19, etc.).  Window managers want to deal with the actual keysyms.