home *** CD-ROM | disk | FTP | other *** search
- Xref: sparky comp.windows.x:18901 comp.sys.sun.misc:5165
- Newsgroups: comp.windows.x,comp.sys.sun.misc
- Path: sparky!uunet!nevada.edu!tamsun.tamu.edu!inetg1!edp.arco.com!dbgwab
- From: dbgwab@edp.arco.com (William A. Bailey)
- Subject: Patches for Sun X server for NumLock support
- Message-ID: <1992Nov9.143452.11919@Arco.COM>
- Keywords: X11R5 Sun NumLock
- Sender: news@Arco.COM
- Organization: ARCO - Aept
- References: <1992Nov6.120836.12831@abekrd.co.uk>
- Date: Mon, 9 Nov 1992 14:34:52 GMT
- Lines: 145
-
- Release 5 SUN Keyboard NumLock Patch
- William Bailey <dbgwab@arco.com>
-
- This patch provides support for the NumLock function on the keypad
- of Sun Type 4 and Type 5 keyboards.
-
- To apply this patch:
-
- cd to the top of the source tree (to the directory containing the "mit"
- and "contrib" subdirectories) and do:
- patch -p -s < ThisFile
- cd mit/server
- make
-
- Patch will work silently unless an error occurs.
- This will rebuild Xsun and/or XsunMono per your original configuration.
- You can then test and install the new Xserver(s) manually.
-
- *** mit/server/ddx/sun/sunKbd.c
- 372,376c372
- < /*
- < * The LEDs on the type-4 keyboard are in a *strange*
- < * order. This code remaps them left-to-right, which
- < * may not be what you want, but it seems reasonable to me.
- < */
- ---
- > #define LED_ALL (LED_NUM_LOCK | LED_COMPOSE | LED_SCROLL_LOCK | LED_CAPS_LOCK)
- 378,384d373
- < #define LED_LOCK 0x08
- < #define LED_1 0x02
- < #define LED_2 0x04
- < #define LED_3 0x01
- < #define LED_X (LED_1 | LED_2 | LED_3)
- < #define LED_ALL (LED_LOCK | LED_X)
- <
- 393,400c382,389
- < if (request & 0x01)
- < device |= LED_1;
- < if (request & 0x02)
- < device |= LED_2;
- < if (request & 0x04)
- < device |= LED_3;
- < if (pPriv->lockLight)
- < device |= LED_LOCK;
- ---
- > if (request & LED_NUM_LOCK)
- > device |= LED_NUM_LOCK;
- > if (request & LED_COMPOSE)
- > device |= LED_COMPOSE;
- > if (request & LED_SCROLL_LOCK)
- > device |= LED_SCROLL_LOCK;
- > if (request & LED_CAPS_LOCK)
- > device |= LED_CAPS_LOCK;
- 428d416
- < char led;
- 451c439
- < pPriv->ctrl->leds = ctrl->leds & LED_X;
- ---
- > pPriv->ctrl->leds = ctrl->leds & LED_ALL;
- 468c456
- < sunKbdLockLight (pKeyboard, on)
- ---
- > sunKbdLockLight (pKeyboard, led)
- 470c458
- < Bool on;
- ---
- > char led;
- 475c463
- < pPriv->lockLight = on;
- ---
- > pPriv->ctrl->leds ^= led;
- 549c537
- < KbPrivPtr pPriv;
- ---
- > KbPrivPtr pPriv = (KbPrivPtr) pKeyboard->devicePrivate;
- 552a541,542
- > KeySym *keysym;
- > KeyClassRec *keyc;
- 553a544
- > keyc = ((DeviceIntPtr)pKeyboard)->key;
- 555a547,584
- >
- > if (pPriv->ctrl->leds & LED_NUM_LOCK) {
- > if (key == 0x77) { /* 1 */
- > key = 0x25;
- > }
- > else if (key == 0x78) { /* 2 */
- > key = 0x26;
- > }
- > else if (key == 0x79) { /* 3 */
- > key = 0x27;
- > }
- > else if (key == 0x62) { /* 4 */
- > key = 0x28;
- > }
- > else if (key == 0x63) { /* 5 */
- > key = 0x29;
- > }
- > else if (key == 0x64) { /* 6 */
- > key = 0x2a;
- > }
- > else if (key == 0x4B) { /* 7 */
- > key = 0x2B;
- > }
- > else if (key == 0x4C) { /* 8 */
- > key = 0x2C;
- > }
- > else if (key == 0x4D) { /* 9 */
- > key = 0x2D;
- > }
- > else if (key == 0x65) { /* 0 */
- > key = 0x2E;
- > }
- > else if (key == 0x39) { /* . */
- > key = 0x73;
- > }
- > }
- >
- >
- 563c592,597
- <
- ---
- > keysym = (keyc->curKeySyms.map +
- > keyc->curKeySyms.mapWidth *
- > (key - keyc->curKeySyms.minKeyCode));
- > /*
- > ErrorF("key %x, keysym %x, numlock %x\n",key,*keysym,XK_Num_Lock);
- > */
- 573c607,615
- < sunKbdLockLight (pKeyboard, xE.u.u.type == KeyPress);
- ---
- > sunKbdLockLight (pKeyboard, LED_CAPS_LOCK);
- > }
- >
- > if (*keysym == XK_Num_Lock) {
- > if (xE.u.u.type == KeyRelease)
- > return; /* this assumes autorepeat is not desired */
- > if (BitIsOn(((DeviceIntPtr)pKeyboard)->key->down, key))
- > xE.u.u.type = KeyRelease;
- > sunKbdLockLight (pKeyboard, LED_NUM_LOCK);
-
-
- --
- Bill Bailey <dbgwab@arco.com>
- Voice : (214) 754-6779
-