🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.emacs.bug
Article #99044

KeyPress events in Emacs' X interface

#99044
From: Liam Breck
Date: Sat, 01 Dec 1990 19:28
42 lines
2914 bytes
This is really a future design suggestion rather than a bug report...

I have rewritten part of x11term.c recently so that the KeyPress
handler works a bit better with function keys (if anyone wants a diff
file of the changes I made drop me a note).  While I was at it I
thought of a better way to do it which would require major work.
Since work on V19 is in progress perhaps this idea can be implemented
(if it hasn't already).  I took a look at the Epoch implementation of
this handler and was disappointed to find that it uses the same code
with additions that only complicate things.

Currently, when a function key is pressed on a keyboard managed by an
X Window server, a KeyPress event is generated and Emacs' X interface
code translates it (in a clumsy way) into an escape sequence and
passes it to the editing session.  At the editing session level an
elisp key translator may catch escape sequences and perform some
pre-defined function for a given sequence.  The elisp translator is
device specific, allowing users to customize Emacs for strange
terminals that generate unheard of escape sequences.

My suggestion is to pass X function key keysyms directly to the
editing session and create another version of the elisp translator (or
an extension of a current one) to translate these keysyms to Emacs
functions.  (This is nice because only one translator would be
required for all the different X servers out there.)  When multiple
terminal types are used one can load a particular translator
conditionally.  Passing keysyms directly would eliminate the need to
use XRebindKeysym() to remap keysyms to escape sequences at the X
level and the need to call XLookupString() when a KeyPress event is
received.  (To get the keysym for a KeyPress event one can grab the
keycode element from the event structure and use XKeycodeToKeysym() to
get a keysym.)  It should also make KeyPress handling a bit faster on
machines where CPU time is at a premium.

I recommend that an Emacs function that calls XRebindKeysym for
on-the-fly rebinding NOT be implemented since it only adds another
layer where key translation (and confusion) may occur.  The proper
place for key rebinding is in the elisp translator.

Comments?

Liam Breck
Technical Details
Message-ID: <1377@umvlsi.ecs.umass.edu>
Path: arc1-ca.pugleaf.net!gmdzi!unido!mcsun!uunet!tut.cis.ohio-state.edu!STAR.ECS.UMASS.EDU!breck

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: fb2f1,de9a5f9a588c3171,start
X-Google-Attributes: gidfb2f1,public
X-Google-ArrivalTime: 1990-12-01 11:28:17 PST
Path: arc1-ca.pugleaf.net!gmdzi!unido!mcsun!uunet!tut.cis.ohio-state.edu!STAR.ECS.UMASS.EDU!breck
From: breck@STAR.ECS.UMASS.EDU (Liam Breck)
Newsgroups: gnu.emacs.bug
Subject: KeyPress events in Emacs' X interface
Message-ID: <1377@umvlsi.ecs.umass.edu>
Date: 1 Dec 90 19:28:17 GMT
Sender: daemon@tut.cis.ohio-state.edu
Distribution: gnu
Organization: University of Massachusetts, Amherst
Lines: 42
Approved: bug-gnu-emacs@prep.ai.mit.edu
Posted: Sat Dec  1 20:28:17 1990