old-www/HOWTO/BackspaceDelete/x.html

316 lines
5.3 KiB
HTML

<HTML
><HEAD
><TITLE
>X</TITLE
><META
NAME="GENERATOR"
CONTENT="Modular DocBook HTML Stylesheet Version 1.63
"><LINK
REL="HOME"
TITLE="Linux Backspace/Delete mini-HOWTO"
HREF="index.html"><LINK
REL="PREVIOUS"
TITLE="Why It Doesn't (Always) Work"
HREF="why.html"><LINK
REL="NEXT"
TITLE="What You Should Do When Writing Applications"
HREF="writing.html"></HEAD
><BODY
CLASS="SECT1"
BGCOLOR="#FFFFFF"
TEXT="#000000"
LINK="#0000FF"
VLINK="#840084"
ALINK="#0000FF"
><DIV
CLASS="NAVHEADER"
><TABLE
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TH
COLSPAN="3"
ALIGN="center"
>Linux <B
CLASS="KEYCAP"
>Backspace</B
>/<B
CLASS="KEYCAP"
>Delete</B
> mini-HOWTO</TH
></TR
><TR
><TD
WIDTH="10%"
ALIGN="left"
VALIGN="bottom"
><A
HREF="why.html"
>Prev</A
></TD
><TD
WIDTH="80%"
ALIGN="center"
VALIGN="bottom"
></TD
><TD
WIDTH="10%"
ALIGN="right"
VALIGN="bottom"
><A
HREF="writing.html"
>Next</A
></TD
></TR
></TABLE
><HR
ALIGN="LEFT"
WIDTH="100%"></DIV
><DIV
CLASS="SECT1"
><H1
CLASS="SECT1"
><A
NAME="X"
>4. X</A
></H1
><P
>The situation under X is not really different. There is just a
different layer, that is, the X window system translates the scancodes into
its own keysyms, which are much more varied and precise than the console
ones, and feeds them into applications (by the way, this is the reason why
<SPAN
CLASS="APPLICATION"
>XEmacs</SPAN
> is not plagued by the problem: X
translates keycode 22 to keysym <SPAN
CLASS="KEYSYM"
>BackSpace</SPAN
> and keycode 107
to keysym <SPAN
CLASS="KEYSYM"
>Delete</SPAN
>, and then the user can easily assign to
those keysyms the desired behaviour). Of course, a terminal emulator
program (usually a VT100 emulator in the X world) must translate the
X keysyms into ASCII sequences, so we are again in our sore
business.</P
><P
>More in detail, usually <SPAN
CLASS="APPLICATION"
>xterm</SPAN
> behaves
exactly like the console (i.e., it emits the same <SPAN
CLASS="ACRONYM"
>ASCII</SPAN
>
sequences), but, for instance, <SPAN
CLASS="APPLICATION"
>gnome-terminal</SPAN
> in
Red Hat &#60;7.0 or &#8805;7.1 emits <SPAN
CLASS="SYMBOL"
>BS</SPAN
> for
<B
CLASS="KEYCAP"
>Backspace</B
> and <SPAN
CLASS="SYMBOL"
>DEL</SPAN
> for
<B
CLASS="KEYCAP"
>Delete</B
>. The real fun starts when you realise that by
default they use the <EM
>same</EM
> terminal-database entry, so
the fact that the <TT
CLASS="LITERAL"
>kbs</TT
> capability is associated to an
<SPAN
CLASS="ACRONYM"
>ASCII</SPAN
> <SPAN
CLASS="SYMBOL"
>DEL</SPAN
> makes all correctly behaving
applications produce the same behaviour for the <B
CLASS="KEYCAP"
>Backspace</B
>
and <B
CLASS="KEYCAP"
>Delete</B
> keys in
<SPAN
CLASS="APPLICATION"
>gnome-terminal</SPAN
>. The simple statement
<TABLE
BORDER="1"
BGCOLOR="#E0E0E0"
WIDTH="100%"
><TR
><TD
><FONT
COLOR="#000000"
><PRE
CLASS="SCREEN"
>&#13;bash$ export TERM=gnome</PRE
></FONT
></TD
></TR
></TABLE
> can solve the problem in this case for
correctly behaving applications. Well, not always, because your system
could lack an entry in the terminal database named
<TT
CLASS="LITERAL"
>gnome</TT
>, in particular if it is not very up-to-date.</P
><P
>In any case, this is not always a solution: if, for instance, you
have a Red Hat 7.0 distribution, your
<SPAN
CLASS="APPLICATION"
>gnome-terminal</SPAN
> behaves like a console. But
beware: if you upgraded your desktop using the Helix distribution, then
your <SPAN
CLASS="APPLICATION"
>gnome-terminal</SPAN
> behaves like a pre-7.0 Red
Hat.</P
><P
>Just to make easier the following discussion, let us define
<I
CLASS="FIRSTTERM"
>standard</I
> a VT100 emulator behaving like the console,
and <I
CLASS="FIRSTTERM"
>deviant</I
> one that emits <SPAN
CLASS="SYMBOL"
>BS</SPAN
> for
<B
CLASS="KEYCAP"
>Backspace</B
> and <SPAN
CLASS="SYMBOL"
>DEL</SPAN
> for
<B
CLASS="KEYCAP"
>Delete</B
>.<A
NAME="AEN188"
HREF="#FTN.AEN188"
>[1]</A
>
Thus, for instance, <SPAN
CLASS="APPLICATION"
>xterm</SPAN
> has always been
standard in the Debian distribution, while it switched a couple of times
from standard to deviant and viceversa in Red Hat; the behaviour of
<SPAN
CLASS="APPLICATION"
>gnome-terminal</SPAN
> is even more erratic. See <A
HREF="morehack.html"
>Section 8</A
> for some information on how to turn a deviant terminal
into a standard one.</P
></DIV
><H3
CLASS="FOOTNOTES"
>Notes</H3
><TABLE
BORDER="0"
CLASS="FOOTNOTES"
WIDTH="100%"
><TR
><TD
ALIGN="LEFT"
VALIGN="TOP"
WIDTH="5%"
><A
NAME="FTN.AEN188"
HREF="x.html#AEN188"
>[1]</A
></TD
><TD
ALIGN="LEFT"
VALIGN="TOP"
WIDTH="95%"
><P
>Also these definitions have been
asserted/disputed several times commenting this document. If you have any
definitive information on this subject, please write me.</P
></TD
></TR
></TABLE
><DIV
CLASS="NAVFOOTER"
><HR
ALIGN="LEFT"
WIDTH="100%"><TABLE
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
><A
HREF="why.html"
>Prev</A
></TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="index.html"
>Home</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
><A
HREF="writing.html"
>Next</A
></TD
></TR
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
>Why It Doesn't (Always) Work</TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
>&nbsp;</TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
>What You Should Do When Writing Applications</TD
></TR
></TABLE
></DIV
></BODY
></HTML
>