🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.archives
Article #105

[comp.windows.x.announce] Patch for Xsun keyboard handling

#105
From: Martin Forssen
Date: Tue, 04 Aug 1992 08:16
91 lines
5122 bytes
Archive-name: auto/comp.windows.x.announce/Patch-for-Xsun-keyboard-handling


 I have modified our X-server (Xsun & XsunMono X11R5 pl12) to support
 alternative layouts for the keyboard. The server now supports all the
 keyboards that are supported by OW3 (which I think is all type4
 and type5 layouts that exists) plus those supported by the original
 Xsun-server.

 In addition to that the server supports the Num_Lock key and all
 the Compose combinations which are mentioned in the little folder
 we get with our keyboards.

 The patch is now available by anonymous ftp to export.lcs.mit.edu
 in the contrib/sunkbd.tar.Z file or by email from me (maf@dtek.chalmers.se).

 Below follows a copy of the README.kbd file:


 Keyboard patch version 920802

 This patch enables the Xsun (and XsunMono) server to work with
 other keyboards than type 4 US. It also fixes the Num_Lock and
 Compose keys. It was programmed by maf@dtek.chalmers.se. If you
 have any questions or comments about this piece of code feel free
 to send me an email.

  Installation

 This patch is distributed as a compressed tar file. When you unpack
 the archive you should get three files: README.kbd (this file),
 sunKeyMap.c and sunkbd.patch. README.kbd and sunKeyMap.c should
 be installed in mit/server/ddx/sun (move the old sunKeyMap.c to
 some safe backup place). You should the apply the patch 
 (patch -p -s <sunkbd.patch) in the mit/server/ddx/sun directory.
 The patch will touch the following files: ./README, ./sun.h,
 ./sunKbd.c and ../../../include/Sunkeysym.h. Now look in sunKeyMap.c
 and remove any unwanted keyboards (to save space) and then just
 rebuild the server.


  Known problems

 The only problem I know of today is that FrameMaker 3.1X doesn't
 recognize any compose combinations that ends with a shifted or
 alted character. This seems to be a bug in FM and the only workaround
 I have found is to define a macro file for these combinations (they
 are recognized as triggers).


  How it works

 When the server initializes it queries the keyboard for its type and
 layout. If it is anything else than type 4 (note that type 5 keyboards
 say they are type 4) it works as before. If it is a type4 keyboard
 the server finds the correct keycode to keysym mappings. These are
 contained in the file sunKeyMap.c. In this file you can find the
 layout tables for 35 different type 4 layouts. Each of these tables
 occupies about 2.5K in the server and since you probably won't need
 more than one or two different entries you can remove the others through 
 the comments at the top of the file (further instructions is in the
 file). Now the keycodes that are reported when you press any numerical
 key while NumLock is pressed or the final code of a compose combination
 is appended to the table. If COMPACT_MAP is defined in sun.h (which it
 is by default) the server tries to fill any holes in the layout first
 before appending the keys. Unfortunately some third part keyboards
 have keys in the ordinary holes. To solve this you can undefine COMPACT_MAP
 and then the server won't fill the holes.
 When the user presses a key the server first checks if NumLock is
 active. If it is the server searches a table of the numerical keyboards
 scancodes and if the current keycode is found in there it is transformed
 into another scancode which points to the correct entry in the keycode
 to keysym table. If the user has pressed the compose key the server
 first converts the scancode to a keysym, then it checks if this key is
 part of any legal compose combination if it is it is remembered else
 the compose key is deactivated. In either case the event is swallowed
 unless it was a modifier key. When the final key of the combination
 is pressed the server changes the scancode to one that points to the
 right location and passes the event on to the clients. Observe that
 this entry in the scancode to keycode table has the same value for
 all the combinations of modifier keys. This is since I can't know
 which modifiers are active when the last key is pressed.
 When the server checks for Num_Lock and Compose it actually decodes
 the scancodes it gets to keysyms and the check these. This enables the
 user to remap both Num_Lock and Compose (Multi_key).

	/MaF

--
Martin Forssen: maf@dtek.chalmers.se or maf@math.chalmers.se
System administrator at math and dtek at Chalmers univ. of technology 
Technical Details
Message-ID: <15lecsINNm0a@agate.berkeley.edu>
Path: arc1-ca.pugleaf.net!sparky!uunet!sun-barr!ames!agate!agate!usenet
References: <9208031739.AA02864@expo.lcs.mit.edu>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!sun-barr!ames!agate!agate!usenet
From: maf@DTEK.CHALMERS.SE (Martin Forssen)
Newsgroups: comp.archives
Subject: [comp.windows.x.announce] Patch for Xsun keyboard handling
Followup-To: comp.windows.x.announce
Date: 4 Aug 1992 08:16:28 GMT
Organization: Chalmers University of Technology, Gothenburg Sweden
Lines: 92
Approved: adam@soda.berkeley.edu
Distribution: world
Message-ID: <15lecsINNm0a@agate.berkeley.edu>
References: <9208031739.AA02864@expo.lcs.mit.edu>
NNTP-Posting-Host: soda.berkeley.edu
X-Original-Newsgroups: comp.windows.x.announce
X-Original-Date: 3 Aug 92 17:39:24 GMT