1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<!--Converted with LaTeX2HTML 2K.1beta (1.48)
original version by: Nikos Drakos, CBLU, University of Leeds
* revised and updated by: Marcus Hennecke, Ross Moore, Herb Swan
* with significant contributions from:
Jens Lippmann, Marek Rouchal, Martin Wilck and others -->
<HTML>
<HEAD>
<TITLE>Explanation of Sample Keyboard File</TITLE>
<META NAME="description" CONTENT="Explanation of Sample Keyboard File">
<META NAME="keywords" CONTENT="MANUAL">
<META NAME="resource-type" CONTENT="document">
<META NAME="distribution" CONTENT="global">
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<META NAME="Generator" CONTENT="LaTeX2HTML v2K.1beta">
<META HTTP-EQUIV="Content-Style-Type" CONTENT="text/css">
<LINK REL="STYLESHEET" HREF="MANUAL.css">
<LINK REL="previous" HREF="node43.html">
<LINK REL="up" HREF="node42.html">
<LINK REL="next" HREF="node45.html">
</HEAD>
<BODY >
<!--Navigation Panel-->
<A NAME="tex2html682"
HREF="node45.html">
<IMG WIDTH="37" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="next"
SRC="/usr/share/latex2html/icons/next.png"></A>
<A NAME="tex2html678"
HREF="node42.html">
<IMG WIDTH="26" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="up"
SRC="/usr/share/latex2html/icons/up.png"></A>
<A NAME="tex2html674"
HREF="node43.html">
<IMG WIDTH="63" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="previous"
SRC="/usr/share/latex2html/icons/prev.png"></A>
<A NAME="tex2html680"
HREF="node1.html">
<IMG WIDTH="65" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="contents"
SRC="/usr/share/latex2html/icons/contents.png"></A>
<BR>
<B> Next:</B> <A NAME="tex2html683"
HREF="node45.html">Debugging</A>
<B> Up:</B> <A NAME="tex2html679"
HREF="node42.html">Writing Keyboard Definition Files</A>
<B> Previous:</B> <A NAME="tex2html675"
HREF="node43.html">Sample Keyboard Definition File</A>
  <B> <A NAME="tex2html681"
HREF="node1.html">Contents</A></B>
<BR>
<BR>
<!--End of Navigation Panel-->
<H2><A NAME="SECTION001112000000000000000">
Explanation of Sample Keyboard File</A>
</H2>
<P>
Each keyboard definition in GTKeyboard consists of 5 rows of keys.
Each row contains multiple keys. Line 1 in the file always tells
GTKeyboard how many keys are going to be on each row. In this case,
the first line, <I>14 14 13 12 5</I> means that there will be 14 keys
on the first row, 14 keys on the second row, 13 keys on the third row,
12 keys on the fourth row, and 5 keys on the fifth row. With that
laid out, the rest of the file consists of one key definition per
line. If you specified that there are 14 keys in the first row, then
the first 14 key definitions will be assigned to the first row, from
left to right. If you specified that the second row should have 14
keys as well, the next 14 keys will comprise the second row, from left
to right.
<P>
In the sample file you will notice commentary such as <I># Begin row
2</I>. GTKeyboard ignores these comments - they are merely there to
remind the person writing the file where each row begins.
<P>
Now all the file really consists of is a series of key definitions.
Key definitions contain up to 5 parts. The first three parts are all
KeySyms. KeySyms are the X server's way of keeping track of various
symbols. Names for all of the possible KeySyms may be found in <I>/usr/include/X11/keysymdef.h</I>. If this file doesn't exist you may
want to consult your local administrator for the location of the X
server include files. In that file, you will find lists of KeySyms
looking like this:
<P>
#define XK_Y 0x059
<BR>#define XK_Z 0x05a
<BR>#define XK_bracketleft 0x05b
<BR>#define XK_backslash 0x05c
<BR>
<P>
In this case, XK_Y refers to the character ``Y'' (upper case). XK_Z
refers to the character ``Z'' (upper case). XK_bracketleft refers to
``[``, and XK_backslash refers to the blackslash character. In all of
these lists, take the name of the KeySym as listed in <I>/usr/include/X11/keysymdef.h</I>, remove the beginning ``XK_'' and you
have a KeySym name for the GTKeyboard keyboard definition file.
<P>
Each key definition line starts with three KeySym definitions. For
example, in line 37, we see a lower case j, followed by an upper case
J, followed by another lower case j. The first KeySym is what the
pressed key will do under normal conditions. The second KeySym is
what the key will do when pressed in combination with either Shift or
Caps Lock. The third KeySym is what the key will do when pressed in
combination with the Mode Switch key. Usually this is labeled ``Alt
Gr'' on most keyboards. For US keyboard layouts, generally this isn't
used, but still must be specified.
<P>
Following the three KeySyms is the KeyCode. The KeyCode is an integer
assigned to each key on a physical keyboard. This KeyCode is what
allows GTKeyboard to do much of its remapping work. While it is not
required, it is strongly recommended. Without specifying the KeyCode
for each and every key in the keyboard definition file, GTKeyboard
will be unable to remap your physical keyboard to the settings you
specify in that file.
<P>
In order to find the KeyCode for a particular key, use the ``xev''
program that comes with your X server. By placing the mouse in the
xev window and pressing a button, xev outputs data about the key to
standard out. Example:
<P>
KeyPress event, serial 27, synthetic NO, window 0x3800001,
<BR>
root 0x26, subw 0x0, time 492725957, (100,0), root:(101,521),
<BR>
state 0x0, keycode 40 (keysym 0x64, d), same_screen YES,
<BR>
XLookupString gives 1 characters: ``d''
<BR>
<P>
This information tells us that the ``d'' key is bound to KeyCode 40.
When trying to find keycodes for particular keys, xev is very
helpful. Remember that KeyCodes are bound to particular physical keys
on the physical keyboard. KeySyms are not until you use the keyboard
remapping feature in GTKeyboard.
<P>
The final field is a modifier mask. This field is only used for
modifier keys. A modifier key is generally a key that doesn't output
a character by itself, it modifies another keystroke. Examples
include Caps Lock, Alt, Control, and Shift. Each modifier key may be
followed by a modifier mask. There are eight possible modifier masks,
<I>ShiftMask</I>, <I>LockMask</I>, <I>ControlMask</I>, <I>Mod1Mask</I>,
<I>Mod2Mask</I>, <I>Mod3Mask</I>, <I>Mod4Mask</I>, and <I>Mod5Mask</I>.
Modifier masks for modifier keys are mandatory for keyboards which you
wish to do remapping with. GTKeyboard cannot successfully remap
keyboards whose definitions do not contain modifier masks.
<P>
You may specify the mask for each modifier. As the name suggests,
<I>ShiftMask</I> is a good choice when specifying the modifier for
Shift_L and Shift_R. The keyboard file may specify any modifier mask
for any modifier, but the general rule is that Shift_L and Shift_R are
assigned to <I>ShiftMask</I>, Control_L and Control_R are assigned to
<I>ControlMask</I>, Caps_Lock is assigned to <I>LockMask</I>, Alt_L and
Alt_R are assigned to <I>Mod1Mask</I>, and Mode_switch is assigned to
<I>Mod2Mask</I>. Keys that perform the same function, (as with Shift_L
and Shift_R) should use the same modifier mask. Each modifier mask
may hold no more than 2 distinct keys unless you know that your X
server can handle more.
<P>
Once your keyboard definition file is successfully constructed,
there's nothing else to it - you can simply load GTKeyboard, and use
the ``Change Layout'' function to load your new keyboard onto the screen.
<P>
<HR>
<!--Navigation Panel-->
<A NAME="tex2html682"
HREF="node45.html">
<IMG WIDTH="37" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="next"
SRC="/usr/share/latex2html/icons/next.png"></A>
<A NAME="tex2html678"
HREF="node42.html">
<IMG WIDTH="26" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="up"
SRC="/usr/share/latex2html/icons/up.png"></A>
<A NAME="tex2html674"
HREF="node43.html">
<IMG WIDTH="63" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="previous"
SRC="/usr/share/latex2html/icons/prev.png"></A>
<A NAME="tex2html680"
HREF="node1.html">
<IMG WIDTH="65" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="contents"
SRC="/usr/share/latex2html/icons/contents.png"></A>
<BR>
<B> Next:</B> <A NAME="tex2html683"
HREF="node45.html">Debugging</A>
<B> Up:</B> <A NAME="tex2html679"
HREF="node42.html">Writing Keyboard Definition Files</A>
<B> Previous:</B> <A NAME="tex2html675"
HREF="node43.html">Sample Keyboard Definition File</A>
  <B> <A NAME="tex2html681"
HREF="node1.html">Contents</A></B>
<!--End of Navigation Panel-->
<ADDRESS>
David Allen
2001-04-26
</ADDRESS>
</BODY>
</HTML>
|