aboutsummaryrefslogtreecommitdiff
path: root/xorg-server
diff options
context:
space:
mode:
Diffstat (limited to 'xorg-server')
-rw-r--r--xorg-server/Xi/exevents.c27
-rw-r--r--xorg-server/dix/events.c12
-rw-r--r--xorg-server/dix/getevents.c49
-rw-r--r--xorg-server/hw/dmx/input/atKeynames.h586
-rw-r--r--xorg-server/hw/kdrive/ephyr/ephyr.c8
-rw-r--r--xorg-server/hw/xfree86/common/xf86Events.c4
-rw-r--r--xorg-server/hw/xnest/Keyboard.c8
-rw-r--r--xorg-server/hw/xwin/winkeynames.h403
-rw-r--r--xorg-server/include/input.h9
-rw-r--r--xorg-server/mi/mipointer.c24
10 files changed, 563 insertions, 567 deletions
diff --git a/xorg-server/Xi/exevents.c b/xorg-server/Xi/exevents.c
index d1d87a639..0bc2ecc81 100644
--- a/xorg-server/Xi/exevents.c
+++ b/xorg-server/Xi/exevents.c
@@ -747,7 +747,6 @@ UpdateDeviceState(DeviceIntPtr device, DeviceEvent* event)
KeyClassPtr k = NULL;
ButtonClassPtr b = NULL;
ValuatorClassPtr v = NULL;
- BYTE *kptr = NULL;
/* This event is always the first we get, before the actual events with
* the data. However, the way how the DDX is set up, "device" will
@@ -814,32 +813,31 @@ UpdateDeviceState(DeviceIntPtr device, DeviceEvent* event)
if (!k)
return DONT_PROCESS;
- kptr = &k->down[key >> 3];
- /* don't allow ddx to generate multiple downs, but repeats are okay */
- if ((*kptr & bit) && !event->key_repeat)
+ /* don't allow ddx to generate multiple downs, but repeats are okay */
+ if (key_is_down(device, key, KEY_PROCESSED) && !event->key_repeat)
return DONT_PROCESS;
+
if (device->valuator)
device->valuator->motionHintWindow = NullWindow;
- *kptr |= bit;
+ set_key_down(device, key, KEY_PROCESSED);
} else if (event->type == ET_KeyRelease) {
if (!k)
return DONT_PROCESS;
- kptr = &k->down[key >> 3];
- if (!(*kptr & bit)) /* guard against duplicates */
+ if (!key_is_down(device, key, KEY_PROCESSED)) /* guard against duplicates */
return DONT_PROCESS;
if (device->valuator)
device->valuator->motionHintWindow = NullWindow;
- *kptr &= ~bit;
+ set_key_up(device, key, KEY_PROCESSED);
} else if (event->type == ET_ButtonPress) {
Mask mask;
if (!b)
return DONT_PROCESS;
- kptr = &b->down[key >> 3];
- if ((*kptr & bit) != 0)
+ if (button_is_down(device, key, BUTTON_PROCESSED))
return DONT_PROCESS;
- *kptr |= bit;
+
+ set_button_down(device, key, BUTTON_PROCESSED);
if (device->valuator)
device->valuator->motionHintWindow = NullWindow;
if (!b->map[key])
@@ -859,8 +857,7 @@ UpdateDeviceState(DeviceIntPtr device, DeviceEvent* event)
if (!b)
return DONT_PROCESS;
- kptr = &b->down[key>>3];
- if (!(*kptr & bit))
+ if (!button_is_down(device, key, BUTTON_PROCESSED))
return DONT_PROCESS;
if (IsMaster(device)) {
DeviceIntPtr sd;
@@ -875,11 +872,11 @@ UpdateDeviceState(DeviceIntPtr device, DeviceEvent* event)
continue;
if (!sd->button)
continue;
- if ((sd->button->down[key>>3] & bit) != 0)
+ if (button_is_down(sd, key, BUTTON_PROCESSED))
return DONT_PROCESS;
}
}
- *kptr &= ~bit;
+ set_button_up(device, key, BUTTON_PROCESSED);
if (device->valuator)
device->valuator->motionHintWindow = NullWindow;
if (!b->map[key])
diff --git a/xorg-server/dix/events.c b/xorg-server/dix/events.c
index 13c91f68a..c9a73dc90 100644
--- a/xorg-server/dix/events.c
+++ b/xorg-server/dix/events.c
@@ -3937,13 +3937,7 @@ DeliverGrabbedEvent(InternalEvent *event, DeviceIntPtr thisDev,
void
FixKeyState (DeviceEvent *event, DeviceIntPtr keybd)
{
- int key, bit;
- BYTE *kptr;
- KeyClassPtr keyc = keybd->key;
-
- key = event->detail.key;
- kptr = &keyc->down[key >> 3];
- bit = 1 << (key & 7);
+ int key = event->detail.key;
if (event->type == ET_KeyPress) {
DebugF("FixKeyState: Key %d %s\n",key,
@@ -3951,9 +3945,9 @@ FixKeyState (DeviceEvent *event, DeviceIntPtr keybd)
}
if (event->type == ET_KeyPress)
- *kptr |= bit;
+ set_key_down(keybd, key, KEY_PROCESSED);
else if (event->type == ET_KeyRelease)
- *kptr &= ~bit;
+ set_key_up(keybd, key, KEY_PROCESSED);
else
FatalError("Impossible keyboard event");
}
diff --git a/xorg-server/dix/getevents.c b/xorg-server/dix/getevents.c
index ea19e0cac..3885cd771 100644
--- a/xorg-server/dix/getevents.c
+++ b/xorg-server/dix/getevents.c
@@ -91,21 +91,52 @@ GetMotionHistorySize(void)
}
void
+set_button_down(DeviceIntPtr pDev, int button, int type)
+{
+ if (type == BUTTON_PROCESSED)
+ SetBit(pDev->button->down, button);
+ else
+ SetBit(pDev->button->postdown, button);
+}
+
+void
+set_button_up(DeviceIntPtr pDev, int button, int type)
+{
+ if (type == BUTTON_PROCESSED)
+ ClearBit(pDev->button->down, button);
+ else
+ ClearBit(pDev->button->postdown, button);
+}
+
+Bool
+button_is_down(DeviceIntPtr pDev, int button, int type)
+{
+ int ret = 0;
+
+ if (type & BUTTON_PROCESSED)
+ ret |= !!BitIsOn(pDev->button->down, button);
+ if (type & BUTTON_POSTED)
+ ret |= !!BitIsOn(pDev->button->postdown, button);
+
+ return ret;
+}
+
+void
set_key_down(DeviceIntPtr pDev, int key_code, int type)
{
if (type == KEY_PROCESSED)
- pDev->key->down[key_code >> 3] |= (1 << (key_code & 7));
+ SetBit(pDev->key->down, key_code);
else
- pDev->key->postdown[key_code >> 3] |= (1 << (key_code & 7));
+ SetBit(pDev->key->postdown, key_code);
}
void
set_key_up(DeviceIntPtr pDev, int key_code, int type)
{
if (type == KEY_PROCESSED)
- pDev->key->down[key_code >> 3] &= ~(1 << (key_code & 7));
+ ClearBit(pDev->key->down, key_code);
else
- pDev->key->postdown[key_code >> 3] &= ~(1 << (key_code & 7));
+ ClearBit(pDev->key->postdown, key_code);
}
Bool
@@ -114,9 +145,9 @@ key_is_down(DeviceIntPtr pDev, int key_code, int type)
int ret = 0;
if (type & KEY_PROCESSED)
- ret |= !!(pDev->key->down[key_code >> 3] & (1 << (key_code & 7)));
- else if (type & KEY_POSTED)
- ret |= !!(pDev->key->postdown[key_code >> 3] & (1 << (key_code & 7)));
+ ret |= !!BitIsOn(pDev->key->down, key_code);
+ if (type & KEY_POSTED)
+ ret |= !!BitIsOn(pDev->key->postdown, key_code);
return ret;
}
@@ -1123,11 +1154,11 @@ GetPointerEvents(EventList *events, DeviceIntPtr pDev, int type, int buttons,
else {
if (type == ButtonPress) {
event->type = ET_ButtonPress;
- pDev->button->postdown[buttons >> 3] |= (1 << (buttons & 7));
+ set_button_down(pDev, buttons, BUTTON_POSTED);
}
else if (type == ButtonRelease) {
event->type = ET_ButtonRelease;
- pDev->button->postdown[buttons >> 3] &= ~(1 << (buttons & 7));
+ set_button_up(pDev, buttons, BUTTON_POSTED);
}
event->detail.button = buttons;
}
diff --git a/xorg-server/hw/dmx/input/atKeynames.h b/xorg-server/hw/dmx/input/atKeynames.h
index e632ca27c..551a9e1b0 100644
--- a/xorg-server/hw/dmx/input/atKeynames.h
+++ b/xorg-server/hw/dmx/input/atKeynames.h
@@ -1,294 +1,292 @@
-/*
- * Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany.
- *
- * Permission to use, copy, modify, distribute, and sell this software and its
- * documentation for any purpose is hereby granted without fee, provided that
- * the above copyright notice appear in all copies and that both that
- * copyright notice and this permission notice appear in supporting
- * documentation, and that the name of Thomas Roell not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. Thomas Roell makes no representations
- * about the suitability of this software for any purpose. It is provided
- * "as is" without express or implied warranty.
- *
- * THOMAS ROELL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL THOMAS ROELL BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
- * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
- * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- * PERFORMANCE OF THIS SOFTWARE.
- *
- */
-/*
- * Copyright (c) 1994-2003 by The XFree86 Project, Inc.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
- * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
- * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
- * OTHER DEALINGS IN THE SOFTWARE.
- *
- * Except as contained in this notice, the name of the copyright holder(s)
- * and author(s) shall not be used in advertising or otherwise to promote
- * the sale, use or other dealings in this Software without prior written
- * authorization from the copyright holder(s) and author(s).
- */
-
-#ifndef _ATKEYNAMES_H
-#define _ATKEYNAMES_H
-
-#define XK_TECHNICAL
-#define XK_KATAKANA
-#include <X11/keysym.h>
-#include <X11/XF86keysym.h>
-
-#define GLYPHS_PER_KEY 4
-#define NUM_KEYCODES 248
-#define MIN_KEYCODE 8
-#define MAX_KEYCODE (NUM_KEYCODES + MIN_KEYCODE - 1)
-
-#define AltMask Mod1Mask
-#define NumLockMask Mod2Mask
-#define AltLangMask Mod3Mask
-#define KanaMask Mod4Mask
-#define ScrollLockMask Mod5Mask
-
-#define KeyPressed(k) (keyc->postdown[k >> 3] & (1 << (k & 7)))
-
-/*
- * NOTE: The AT/MF keyboards can generate (via the 8042) two (MF: three)
- * sets of scancodes. Set3 can only be generated by a MF keyboard.
- * Set2 sends a makecode for keypress, and the same code prefixed by a
- * F0 for keyrelease. This is a little bit ugly to handle. Thus we use
- * here for X386 the PC/XT compatible Set1. This set uses 8bit scancodes.
- * Bit 7 ist set if the key is released. The code E0 switches to a
- * different meaning to add the new MF cursorkeys, while not breaking old
- * applications. E1 is another special prefix. Since I assume that there
- * will be further versions of PC/XT scancode compatible keyboards, we
- * may be in trouble one day.
- *
- * IDEA: 1) Use Set2 on AT84 keyboards and translate it to MF Set3.
- * 2) Use the keyboards native set and translate it to common keysyms.
- */
-
-/*
- * definition of the AT84/MF101/MF102 Keyboard:
- * ============================================================
- * Defined Key Cap Glyphs Pressed value
- * Key Name Main Also (hex) (dec)
- * ---------------- ---------- ------- ------ ------
- */
-
-#define KEY_Escape /* Escape 0x01 */ 1
-#define KEY_1 /* 1 ! 0x02 */ 2
-#define KEY_2 /* 2 @ 0x03 */ 3
-#define KEY_3 /* 3 # 0x04 */ 4
-#define KEY_4 /* 4 $ 0x05 */ 5
-#define KEY_5 /* 5 % 0x06 */ 6
-#define KEY_6 /* 6 ^ 0x07 */ 7
-#define KEY_7 /* 7 & 0x08 */ 8
-#define KEY_8 /* 8 * 0x09 */ 9
-#define KEY_9 /* 9 ( 0x0a */ 10
-#define KEY_0 /* 0 ) 0x0b */ 11
-#define KEY_Minus /* - (Minus) _ (Under) 0x0c */ 12
-#define KEY_Equal /* = (Equal) + 0x0d */ 13
-#define KEY_BackSpace /* Back Space 0x0e */ 14
-#define KEY_Tab /* Tab 0x0f */ 15
-#define KEY_Q /* Q 0x10 */ 16
-#define KEY_W /* W 0x11 */ 17
-#define KEY_E /* E 0x12 */ 18
-#define KEY_R /* R 0x13 */ 19
-#define KEY_T /* T 0x14 */ 20
-#define KEY_Y /* Y 0x15 */ 21
-#define KEY_U /* U 0x16 */ 22
-#define KEY_I /* I 0x17 */ 23
-#define KEY_O /* O 0x18 */ 24
-#define KEY_P /* P 0x19 */ 25
-#define KEY_LBrace /* [ { 0x1a */ 26
-#define KEY_RBrace /* ] } 0x1b */ 27
-#define KEY_Enter /* Enter 0x1c */ 28
-#define KEY_LCtrl /* Ctrl(left) 0x1d */ 29
-#define KEY_A /* A 0x1e */ 30
-#define KEY_S /* S 0x1f */ 31
-#define KEY_D /* D 0x20 */ 32
-#define KEY_F /* F 0x21 */ 33
-#define KEY_G /* G 0x22 */ 34
-#define KEY_H /* H 0x23 */ 35
-#define KEY_J /* J 0x24 */ 36
-#define KEY_K /* K 0x25 */ 37
-#define KEY_L /* L 0x26 */ 38
-#define KEY_SemiColon /* ;(SemiColon) :(Colon) 0x27 */ 39
-#define KEY_Quote /* ' (Apostr) " (Quote) 0x28 */ 40
-#define KEY_Tilde /* ` (Accent) ~ (Tilde) 0x29 */ 41
-#define KEY_ShiftL /* Shift(left) 0x2a */ 42
-#define KEY_BSlash /* \(BckSlash) |(VertBar)0x2b */ 43
-#define KEY_Z /* Z 0x2c */ 44
-#define KEY_X /* X 0x2d */ 45
-#define KEY_C /* C 0x2e */ 46
-#define KEY_V /* V 0x2f */ 47
-#define KEY_B /* B 0x30 */ 48
-#define KEY_N /* N 0x31 */ 49
-#define KEY_M /* M 0x32 */ 50
-#define KEY_Comma /* , (Comma) < (Less) 0x33 */ 51
-#define KEY_Period /* . (Period) >(Greater)0x34 */ 52
-#define KEY_Slash /* / (Slash) ? 0x35 */ 53
-#define KEY_ShiftR /* Shift(right) 0x36 */ 54
-#define KEY_KP_Multiply /* * 0x37 */ 55
-#define KEY_Alt /* Alt(left) 0x38 */ 56
-#define KEY_Space /* (SpaceBar) 0x39 */ 57
-#define KEY_CapsLock /* CapsLock 0x3a */ 58
-#define KEY_F1 /* F1 0x3b */ 59
-#define KEY_F2 /* F2 0x3c */ 60
-#define KEY_F3 /* F3 0x3d */ 61
-#define KEY_F4 /* F4 0x3e */ 62
-#define KEY_F5 /* F5 0x3f */ 63
-#define KEY_F6 /* F6 0x40 */ 64
-#define KEY_F7 /* F7 0x41 */ 65
-#define KEY_F8 /* F8 0x42 */ 66
-#define KEY_F9 /* F9 0x43 */ 67
-#define KEY_F10 /* F10 0x44 */ 68
-#define KEY_NumLock /* NumLock 0x45 */ 69
-#define KEY_ScrollLock /* ScrollLock 0x46 */ 70
-#define KEY_KP_7 /* 7 Home 0x47 */ 71
-#define KEY_KP_8 /* 8 Up 0x48 */ 72
-#define KEY_KP_9 /* 9 PgUp 0x49 */ 73
-#define KEY_KP_Minus /* - (Minus) 0x4a */ 74
-#define KEY_KP_4 /* 4 Left 0x4b */ 75
-#define KEY_KP_5 /* 5 0x4c */ 76
-#define KEY_KP_6 /* 6 Right 0x4d */ 77
-#define KEY_KP_Plus /* + (Plus) 0x4e */ 78
-#define KEY_KP_1 /* 1 End 0x4f */ 79
-#define KEY_KP_2 /* 2 Down 0x50 */ 80
-#define KEY_KP_3 /* 3 PgDown 0x51 */ 81
-#define KEY_KP_0 /* 0 Insert 0x52 */ 82
-#define KEY_KP_Decimal /* . (Decimal) Delete 0x53 */ 83
-#define KEY_SysReqest /* SysReqest 0x54 */ 84
- /* NOTUSED 0x55 */
-#define KEY_Less /* < (Less) >(Greater) 0x56 */ 86
-#define KEY_F11 /* F11 0x57 */ 87
-#define KEY_F12 /* F12 0x58 */ 88
-
-#define KEY_Prefix0 /* special 0x60 */ 96
-#define KEY_Prefix1 /* specail 0x61 */ 97
-
-/*
- * The 'scancodes' below are generated by the server, because the MF101/102
- * keyboard sends them as sequence of other scancodes
- */
-#define KEY_Home /* Home 0x59 */ 89
-#define KEY_Up /* Up 0x5a */ 90
-#define KEY_PgUp /* PgUp 0x5b */ 91
-#define KEY_Left /* Left 0x5c */ 92
-#define KEY_Begin /* Begin 0x5d */ 93
-#define KEY_Right /* Right 0x5e */ 94
-#define KEY_End /* End 0x5f */ 95
-#define KEY_Down /* Down 0x60 */ 96
-#define KEY_PgDown /* PgDown 0x61 */ 97
-#define KEY_Insert /* Insert 0x62 */ 98
-#define KEY_Delete /* Delete 0x63 */ 99
-#define KEY_KP_Enter /* Enter 0x64 */ 100
-#define KEY_RCtrl /* Ctrl(right) 0x65 */ 101
-#define KEY_Pause /* Pause 0x66 */ 102
-#define KEY_Print /* Print 0x67 */ 103
-#define KEY_KP_Divide /* Divide 0x68 */ 104
-#define KEY_AltLang /* AtlLang(right) 0x69 */ 105
-#define KEY_Break /* Break 0x6a */ 106
-#define KEY_LMeta /* Left Meta 0x6b */ 107
-#define KEY_RMeta /* Right Meta 0x6c */ 108
-#define KEY_Menu /* Menu 0x6d */ 109
-#define KEY_F13 /* F13 0x6e */ 110
-#define KEY_F14 /* F14 0x6f */ 111
-#define KEY_F15 /* F15 0x70 */ 112
-#define KEY_HKTG /* Hirugana/Katakana tog 0x70 */ 112
-#define KEY_F16 /* F16 0x71 */ 113
-#define KEY_F17 /* F17 0x72 */ 114
-#define KEY_KP_DEC /* KP_DEC 0x73 */ 115
-#define KEY_BSlash2 /* \ _ 0x73 */ 115
-#define KEY_KP_Equal /* Equal (Keypad) 0x76 */ 118
-#define KEY_XFER /* Kanji Transfer 0x79 */ 121
-#define KEY_NFER /* No Kanji Transfer 0x7b */ 123
-#define KEY_Yen /* Yen 0x7d */ 125
-
-#define KEY_Power /* Power Key 0x84 */ 132
-#define KEY_Mute /* Audio Mute 0x85 */ 133
-#define KEY_AudioLower /* Audio Lower 0x86 */ 134
-#define KEY_AudioRaise /* Audio Raise 0x87 */ 135
-#define KEY_Help /* Help 0x88 */ 136
-#define KEY_L1 /* Stop 0x89 */ 137
-#define KEY_L2 /* Again 0x8a */ 138
-#define KEY_L3 /* Props 0x8b */ 139
-#define KEY_L4 /* Undo 0x8c */ 140
-#define KEY_L5 /* Front 0x8d */ 141
-#define KEY_L6 /* Copy 0x8e */ 142
-#define KEY_L7 /* Open 0x8f */ 143
-#define KEY_L8 /* Paste 0x90 */ 144
-#define KEY_L9 /* Find 0x91 */ 145
-#define KEY_L10 /* Cut 0x92 */ 146
-
-/*
- * Fake 'scancodes' in the following ranges are generated for 2-byte
- * codes not handled elsewhere. These correspond to most extended keys
- * on so-called "Internet" keyboards:
- *
- * 0x79-0x93
- * 0x96-0xa1
- * 0xa3-0xac
- * 0xb1-0xb4
- * 0xba-0xbd
- * 0xc2
- * 0xcc-0xd2
- * 0xd6-0xf7
- */
-
-/*
- * Remapped 'scancodes' are generated for single-byte codes in the range
- * 0x59-0x5f,0x62-0x76. These are used for some extra keys on some keyboards.
- */
-
-#define KEY_0x59 0x95
-#define KEY_0x5A 0xA2
-#define KEY_0x5B 0xAD
-#define KEY_0x5C KEY_KP_EQUAL
-#define KEY_0x5D 0xAE
-#define KEY_0x5E 0xAF
-#define KEY_0x5F 0xB0
-#define KEY_0x62 0xB5
-#define KEY_0x63 0xB6
-#define KEY_0x64 0xB7
-#define KEY_0x65 0xB8
-#define KEY_0x66 0xB9
-#define KEY_0x67 0xBE
-#define KEY_0x68 0xBF
-#define KEY_0x69 0xC0
-#define KEY_0x6A 0xC1
-#define KEY_0x6B 0xC3
-#define KEY_0x6C 0xC4
-#define KEY_0x6D 0xC5
-#define KEY_0x6E 0xC6
-#define KEY_0x6F 0xC7
-#define KEY_0x70 0xC8
-#define KEY_0x71 0xC9
-#define KEY_0x72 0xCA
-#define KEY_0x73 0xCB
-#define KEY_0x74 0xD3
-#define KEY_0x75 0xD4
-#define KEY_0x76 0xD5
-
-/* These are for "notused" and "unknown" entries in translation maps. */
-#define KEY_NOTUSED 0
-#define KEY_UNKNOWN 255
-
-#endif /* _ATKEYNAMES_H */
+/*
+ * Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany.
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of Thomas Roell not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission. Thomas Roell makes no representations
+ * about the suitability of this software for any purpose. It is provided
+ * "as is" without express or implied warranty.
+ *
+ * THOMAS ROELL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL THOMAS ROELL BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ *
+ */
+/*
+ * Copyright (c) 1994-2003 by The XFree86 Project, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * Except as contained in this notice, the name of the copyright holder(s)
+ * and author(s) shall not be used in advertising or otherwise to promote
+ * the sale, use or other dealings in this Software without prior written
+ * authorization from the copyright holder(s) and author(s).
+ */
+
+#ifndef _ATKEYNAMES_H
+#define _ATKEYNAMES_H
+
+#define XK_TECHNICAL
+#define XK_KATAKANA
+#include <X11/keysym.h>
+#include <X11/XF86keysym.h>
+
+#define GLYPHS_PER_KEY 4
+#define NUM_KEYCODES 248
+#define MIN_KEYCODE 8
+#define MAX_KEYCODE (NUM_KEYCODES + MIN_KEYCODE - 1)
+
+#define AltMask Mod1Mask
+#define NumLockMask Mod2Mask
+#define AltLangMask Mod3Mask
+#define KanaMask Mod4Mask
+#define ScrollLockMask Mod5Mask
+
+/*
+ * NOTE: The AT/MF keyboards can generate (via the 8042) two (MF: three)
+ * sets of scancodes. Set3 can only be generated by a MF keyboard.
+ * Set2 sends a makecode for keypress, and the same code prefixed by a
+ * F0 for keyrelease. This is a little bit ugly to handle. Thus we use
+ * here for X386 the PC/XT compatible Set1. This set uses 8bit scancodes.
+ * Bit 7 ist set if the key is released. The code E0 switches to a
+ * different meaning to add the new MF cursorkeys, while not breaking old
+ * applications. E1 is another special prefix. Since I assume that there
+ * will be further versions of PC/XT scancode compatible keyboards, we
+ * may be in trouble one day.
+ *
+ * IDEA: 1) Use Set2 on AT84 keyboards and translate it to MF Set3.
+ * 2) Use the keyboards native set and translate it to common keysyms.
+ */
+
+/*
+ * definition of the AT84/MF101/MF102 Keyboard:
+ * ============================================================
+ * Defined Key Cap Glyphs Pressed value
+ * Key Name Main Also (hex) (dec)
+ * ---------------- ---------- ------- ------ ------
+ */
+
+#define KEY_Escape /* Escape 0x01 */ 1
+#define KEY_1 /* 1 ! 0x02 */ 2
+#define KEY_2 /* 2 @ 0x03 */ 3
+#define KEY_3 /* 3 # 0x04 */ 4
+#define KEY_4 /* 4 $ 0x05 */ 5
+#define KEY_5 /* 5 % 0x06 */ 6
+#define KEY_6 /* 6 ^ 0x07 */ 7
+#define KEY_7 /* 7 & 0x08 */ 8
+#define KEY_8 /* 8 * 0x09 */ 9
+#define KEY_9 /* 9 ( 0x0a */ 10
+#define KEY_0 /* 0 ) 0x0b */ 11
+#define KEY_Minus /* - (Minus) _ (Under) 0x0c */ 12
+#define KEY_Equal /* = (Equal) + 0x0d */ 13
+#define KEY_BackSpace /* Back Space 0x0e */ 14
+#define KEY_Tab /* Tab 0x0f */ 15
+#define KEY_Q /* Q 0x10 */ 16
+#define KEY_W /* W 0x11 */ 17
+#define KEY_E /* E 0x12 */ 18
+#define KEY_R /* R 0x13 */ 19
+#define KEY_T /* T 0x14 */ 20
+#define KEY_Y /* Y 0x15 */ 21
+#define KEY_U /* U 0x16 */ 22
+#define KEY_I /* I 0x17 */ 23
+#define KEY_O /* O 0x18 */ 24
+#define KEY_P /* P 0x19 */ 25
+#define KEY_LBrace /* [ { 0x1a */ 26
+#define KEY_RBrace /* ] } 0x1b */ 27
+#define KEY_Enter /* Enter 0x1c */ 28
+#define KEY_LCtrl /* Ctrl(left) 0x1d */ 29
+#define KEY_A /* A 0x1e */ 30
+#define KEY_S /* S 0x1f */ 31
+#define KEY_D /* D 0x20 */ 32
+#define KEY_F /* F 0x21 */ 33
+#define KEY_G /* G 0x22 */ 34
+#define KEY_H /* H 0x23 */ 35
+#define KEY_J /* J 0x24 */ 36
+#define KEY_K /* K 0x25 */ 37
+#define KEY_L /* L 0x26 */ 38
+#define KEY_SemiColon /* ;(SemiColon) :(Colon) 0x27 */ 39
+#define KEY_Quote /* ' (Apostr) " (Quote) 0x28 */ 40
+#define KEY_Tilde /* ` (Accent) ~ (Tilde) 0x29 */ 41
+#define KEY_ShiftL /* Shift(left) 0x2a */ 42
+#define KEY_BSlash /* \(BckSlash) |(VertBar)0x2b */ 43
+#define KEY_Z /* Z 0x2c */ 44
+#define KEY_X /* X 0x2d */ 45
+#define KEY_C /* C 0x2e */ 46
+#define KEY_V /* V 0x2f */ 47
+#define KEY_B /* B 0x30 */ 48
+#define KEY_N /* N 0x31 */ 49
+#define KEY_M /* M 0x32 */ 50
+#define KEY_Comma /* , (Comma) < (Less) 0x33 */ 51
+#define KEY_Period /* . (Period) >(Greater)0x34 */ 52
+#define KEY_Slash /* / (Slash) ? 0x35 */ 53
+#define KEY_ShiftR /* Shift(right) 0x36 */ 54
+#define KEY_KP_Multiply /* * 0x37 */ 55
+#define KEY_Alt /* Alt(left) 0x38 */ 56
+#define KEY_Space /* (SpaceBar) 0x39 */ 57
+#define KEY_CapsLock /* CapsLock 0x3a */ 58
+#define KEY_F1 /* F1 0x3b */ 59
+#define KEY_F2 /* F2 0x3c */ 60
+#define KEY_F3 /* F3 0x3d */ 61
+#define KEY_F4 /* F4 0x3e */ 62
+#define KEY_F5 /* F5 0x3f */ 63
+#define KEY_F6 /* F6 0x40 */ 64
+#define KEY_F7 /* F7 0x41 */ 65
+#define KEY_F8 /* F8 0x42 */ 66
+#define KEY_F9 /* F9 0x43 */ 67
+#define KEY_F10 /* F10 0x44 */ 68
+#define KEY_NumLock /* NumLock 0x45 */ 69
+#define KEY_ScrollLock /* ScrollLock 0x46 */ 70
+#define KEY_KP_7 /* 7 Home 0x47 */ 71
+#define KEY_KP_8 /* 8 Up 0x48 */ 72
+#define KEY_KP_9 /* 9 PgUp 0x49 */ 73
+#define KEY_KP_Minus /* - (Minus) 0x4a */ 74
+#define KEY_KP_4 /* 4 Left 0x4b */ 75
+#define KEY_KP_5 /* 5 0x4c */ 76
+#define KEY_KP_6 /* 6 Right 0x4d */ 77
+#define KEY_KP_Plus /* + (Plus) 0x4e */ 78
+#define KEY_KP_1 /* 1 End 0x4f */ 79
+#define KEY_KP_2 /* 2 Down 0x50 */ 80
+#define KEY_KP_3 /* 3 PgDown 0x51 */ 81
+#define KEY_KP_0 /* 0 Insert 0x52 */ 82
+#define KEY_KP_Decimal /* . (Decimal) Delete 0x53 */ 83
+#define KEY_SysReqest /* SysReqest 0x54 */ 84
+ /* NOTUSED 0x55 */
+#define KEY_Less /* < (Less) >(Greater) 0x56 */ 86
+#define KEY_F11 /* F11 0x57 */ 87
+#define KEY_F12 /* F12 0x58 */ 88
+
+#define KEY_Prefix0 /* special 0x60 */ 96
+#define KEY_Prefix1 /* specail 0x61 */ 97
+
+/*
+ * The 'scancodes' below are generated by the server, because the MF101/102
+ * keyboard sends them as sequence of other scancodes
+ */
+#define KEY_Home /* Home 0x59 */ 89
+#define KEY_Up /* Up 0x5a */ 90
+#define KEY_PgUp /* PgUp 0x5b */ 91
+#define KEY_Left /* Left 0x5c */ 92
+#define KEY_Begin /* Begin 0x5d */ 93
+#define KEY_Right /* Right 0x5e */ 94
+#define KEY_End /* End 0x5f */ 95
+#define KEY_Down /* Down 0x60 */ 96
+#define KEY_PgDown /* PgDown 0x61 */ 97
+#define KEY_Insert /* Insert 0x62 */ 98
+#define KEY_Delete /* Delete 0x63 */ 99
+#define KEY_KP_Enter /* Enter 0x64 */ 100
+#define KEY_RCtrl /* Ctrl(right) 0x65 */ 101
+#define KEY_Pause /* Pause 0x66 */ 102
+#define KEY_Print /* Print 0x67 */ 103
+#define KEY_KP_Divide /* Divide 0x68 */ 104
+#define KEY_AltLang /* AtlLang(right) 0x69 */ 105
+#define KEY_Break /* Break 0x6a */ 106
+#define KEY_LMeta /* Left Meta 0x6b */ 107
+#define KEY_RMeta /* Right Meta 0x6c */ 108
+#define KEY_Menu /* Menu 0x6d */ 109
+#define KEY_F13 /* F13 0x6e */ 110
+#define KEY_F14 /* F14 0x6f */ 111
+#define KEY_F15 /* F15 0x70 */ 112
+#define KEY_HKTG /* Hirugana/Katakana tog 0x70 */ 112
+#define KEY_F16 /* F16 0x71 */ 113
+#define KEY_F17 /* F17 0x72 */ 114
+#define KEY_KP_DEC /* KP_DEC 0x73 */ 115
+#define KEY_BSlash2 /* \ _ 0x73 */ 115
+#define KEY_KP_Equal /* Equal (Keypad) 0x76 */ 118
+#define KEY_XFER /* Kanji Transfer 0x79 */ 121
+#define KEY_NFER /* No Kanji Transfer 0x7b */ 123
+#define KEY_Yen /* Yen 0x7d */ 125
+
+#define KEY_Power /* Power Key 0x84 */ 132
+#define KEY_Mute /* Audio Mute 0x85 */ 133
+#define KEY_AudioLower /* Audio Lower 0x86 */ 134
+#define KEY_AudioRaise /* Audio Raise 0x87 */ 135
+#define KEY_Help /* Help 0x88 */ 136
+#define KEY_L1 /* Stop 0x89 */ 137
+#define KEY_L2 /* Again 0x8a */ 138
+#define KEY_L3 /* Props 0x8b */ 139
+#define KEY_L4 /* Undo 0x8c */ 140
+#define KEY_L5 /* Front 0x8d */ 141
+#define KEY_L6 /* Copy 0x8e */ 142
+#define KEY_L7 /* Open 0x8f */ 143
+#define KEY_L8 /* Paste 0x90 */ 144
+#define KEY_L9 /* Find 0x91 */ 145
+#define KEY_L10 /* Cut 0x92 */ 146
+
+/*
+ * Fake 'scancodes' in the following ranges are generated for 2-byte
+ * codes not handled elsewhere. These correspond to most extended keys
+ * on so-called "Internet" keyboards:
+ *
+ * 0x79-0x93
+ * 0x96-0xa1
+ * 0xa3-0xac
+ * 0xb1-0xb4
+ * 0xba-0xbd
+ * 0xc2
+ * 0xcc-0xd2
+ * 0xd6-0xf7
+ */
+
+/*
+ * Remapped 'scancodes' are generated for single-byte codes in the range
+ * 0x59-0x5f,0x62-0x76. These are used for some extra keys on some keyboards.
+ */
+
+#define KEY_0x59 0x95
+#define KEY_0x5A 0xA2
+#define KEY_0x5B 0xAD
+#define KEY_0x5C KEY_KP_EQUAL
+#define KEY_0x5D 0xAE
+#define KEY_0x5E 0xAF
+#define KEY_0x5F 0xB0
+#define KEY_0x62 0xB5
+#define KEY_0x63 0xB6
+#define KEY_0x64 0xB7
+#define KEY_0x65 0xB8
+#define KEY_0x66 0xB9
+#define KEY_0x67 0xBE
+#define KEY_0x68 0xBF
+#define KEY_0x69 0xC0
+#define KEY_0x6A 0xC1
+#define KEY_0x6B 0xC3
+#define KEY_0x6C 0xC4
+#define KEY_0x6D 0xC5
+#define KEY_0x6E 0xC6
+#define KEY_0x6F 0xC7
+#define KEY_0x70 0xC8
+#define KEY_0x71 0xC9
+#define KEY_0x72 0xCA
+#define KEY_0x73 0xCB
+#define KEY_0x74 0xD3
+#define KEY_0x75 0xD4
+#define KEY_0x76 0xD5
+
+/* These are for "notused" and "unknown" entries in translation maps. */
+#define KEY_NOTUSED 0
+#define KEY_UNKNOWN 255
+
+#endif /* _ATKEYNAMES_H */
diff --git a/xorg-server/hw/kdrive/ephyr/ephyr.c b/xorg-server/hw/kdrive/ephyr/ephyr.c
index 315f68340..5dfde07f6 100644
--- a/xorg-server/hw/kdrive/ephyr/ephyr.c
+++ b/xorg-server/hw/kdrive/ephyr/ephyr.c
@@ -776,13 +776,7 @@ ephyrUpdateModifierState(unsigned int state)
for (key = 0; key < MAP_LENGTH; key++)
if (keyc->xkbInfo->desc->map->modmap[key] & mask) {
- int bit;
- BYTE *kptr;
-
- kptr = &keyc->down[key >> 3];
- bit = 1 << (key & 7);
-
- if (*kptr & bit)
+ if (key_is_down(pDev, key, KEY_PROCESSED))
KdEnqueueKeyboardEvent (ephyrKbd, key, TRUE);
if (--count == 0)
diff --git a/xorg-server/hw/xfree86/common/xf86Events.c b/xorg-server/hw/xfree86/common/xf86Events.c
index 9d3a58f91..87555f31f 100644
--- a/xorg-server/hw/xfree86/common/xf86Events.c
+++ b/xorg-server/hw/xfree86/common/xf86Events.c
@@ -372,8 +372,6 @@ xf86PrintBacktrace(void)
xorg_backtrace();
}
-#define KeyPressed(k) (keyc->postdown[k >> 3] & (1 << (k & 7)))
-
static void
xf86ReleaseKeys(DeviceIntPtr pDev)
{
@@ -399,7 +397,7 @@ xf86ReleaseKeys(DeviceIntPtr pDev)
for (i = keyc->xkbInfo->desc->min_key_code;
i < keyc->xkbInfo->desc->max_key_code;
i++) {
- if (KeyPressed(i)) {
+ if (key_is_down(pDev, i, KEY_POSTED)) {
sigstate = xf86BlockSIGIO ();
nevents = GetKeyboardEvents(xf86Events, pDev, KeyRelease, i);
for (j = 0; j < nevents; j++)
diff --git a/xorg-server/hw/xnest/Keyboard.c b/xorg-server/hw/xnest/Keyboard.c
index 473724a04..9dba46ccd 100644
--- a/xorg-server/hw/xnest/Keyboard.c
+++ b/xorg-server/hw/xnest/Keyboard.c
@@ -231,13 +231,7 @@ xnestUpdateModifierState(unsigned int state)
for (key = 0; key < MAP_LENGTH; key++)
if (keyc->xkbInfo->desc->map->modmap[key] & mask) {
- int bit;
- BYTE *kptr;
-
- kptr = &keyc->down[key >> 3];
- bit = 1 << (key & 7);
-
- if (*kptr & bit)
+ if (key_is_down(pDev, key, KEY_PROCESSED))
xnestQueueKeyEvent(KeyRelease, key);
if (--count == 0)
diff --git a/xorg-server/hw/xwin/winkeynames.h b/xorg-server/hw/xwin/winkeynames.h
index 7c16337de..5649e2f66 100644
--- a/xorg-server/hw/xwin/winkeynames.h
+++ b/xorg-server/hw/xwin/winkeynames.h
@@ -1,202 +1,201 @@
-#ifndef _WINKEYNAMES_H
-#define _WINKEYNAMES_H
-/*
- * Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany.
- *
- * Permission to use, copy, modify, distribute, and sell this software and its
- * documentation for any purpose is hereby granted without fee, provided that
- * the above copyright notice appear in all copies and that both that
- * copyright notice and this permission notice appear in supporting
- * documentation, and that the name of Thomas Roell not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. Thomas Roell makes no representations
- * about the suitability of this software for any purpose. It is provided
- * "as is" without express or implied warranty.
- *
- * THOMAS ROELL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL THOMAS ROELL BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
- * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
- * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- * PERFORMANCE OF THIS SOFTWARE.
- *
- */
-
-#define XK_TECHNICAL
-#define XK_KATAKANA
-#include <X11/keysym.h>
-
-#define GLYPHS_PER_KEY 4
-#define NUM_KEYCODES 248
-#define MIN_KEYCODE 8
-#define MAX_KEYCODE (NUM_KEYCODES + MIN_KEYCODE - 1)
-
-#define AltMask Mod1Mask
-#define NumLockMask Mod2Mask
-#define AltLangMask Mod3Mask
-#define KanaMask Mod4Mask
-#define ScrollLockMask Mod5Mask
-
-#define KeyPressed(k) (keyc->down[k >> 3] & (1 << (k & 7)))
-#define ModifierDown(k) ((keyc->state & (k)) == (k))
-
-/*
- * NOTE: The AT/MF keyboards can generate (via the 8042) two (MF: three)
- * sets of scancodes. Set3 can only be generated by a MF keyboard.
- * Set2 sends a makecode for keypress, and the same code prefixed by a
- * F0 for keyrelease. This is a little bit ugly to handle. Thus we use
- * here for X386 the PC/XT compatible Set1. This set uses 8bit scancodes.
- * Bit 7 ist set if the key is released. The code E0 switches to a
- * different meaning to add the new MF cursorkeys, while not breaking old
- * applications. E1 is another special prefix. Since I assume that there
- * will be further versions of PC/XT scancode compatible keyboards, we
- * may be in trouble one day.
- *
- * IDEA: 1) Use Set2 on AT84 keyboards and translate it to MF Set3.
- * 2) Use the keyboards native set and translate it to common keysyms.
- */
-
-/*
- * definition of the AT84/MF101/MF102 Keyboard:
- * ============================================================
- * Defined Key Cap Glyphs Pressed value
- * Key Name Main Also (hex) (dec)
- * ---------------- ---------- ------- ------ ------
- */
-
-#define KEY_Escape /* Escape 0x01 */ 1
-#define KEY_1 /* 1 ! 0x02 */ 2
-#define KEY_2 /* 2 @ 0x03 */ 3
-#define KEY_3 /* 3 # 0x04 */ 4
-#define KEY_4 /* 4 $ 0x05 */ 5
-#define KEY_5 /* 5 % 0x06 */ 6
-#define KEY_6 /* 6 ^ 0x07 */ 7
-#define KEY_7 /* 7 & 0x08 */ 8
-#define KEY_8 /* 8 * 0x09 */ 9
-#define KEY_9 /* 9 ( 0x0a */ 10
-#define KEY_0 /* 0 ) 0x0b */ 11
-#define KEY_Minus /* - (Minus) _ (Under) 0x0c */ 12
-#define KEY_Equal /* = (Equal) + 0x0d */ 13
-#define KEY_BackSpace /* Back Space 0x0e */ 14
-#define KEY_Tab /* Tab 0x0f */ 15
-#define KEY_Q /* Q 0x10 */ 16
-#define KEY_W /* W 0x11 */ 17
-#define KEY_E /* E 0x12 */ 18
-#define KEY_R /* R 0x13 */ 19
-#define KEY_T /* T 0x14 */ 20
-#define KEY_Y /* Y 0x15 */ 21
-#define KEY_U /* U 0x16 */ 22
-#define KEY_I /* I 0x17 */ 23
-#define KEY_O /* O 0x18 */ 24
-#define KEY_P /* P 0x19 */ 25
-#define KEY_LBrace /* [ { 0x1a */ 26
-#define KEY_RBrace /* ] } 0x1b */ 27
-#define KEY_Enter /* Enter 0x1c */ 28
-#define KEY_LCtrl /* Ctrl(left) 0x1d */ 29
-#define KEY_A /* A 0x1e */ 30
-#define KEY_S /* S 0x1f */ 31
-#define KEY_D /* D 0x20 */ 32
-#define KEY_F /* F 0x21 */ 33
-#define KEY_G /* G 0x22 */ 34
-#define KEY_H /* H 0x23 */ 35
-#define KEY_J /* J 0x24 */ 36
-#define KEY_K /* K 0x25 */ 37
-#define KEY_L /* L 0x26 */ 38
-#define KEY_SemiColon /* ;(SemiColon) :(Colon) 0x27 */ 39
-#define KEY_Quote /* ' (Apostr) " (Quote) 0x28 */ 40
-#define KEY_Tilde /* ` (Accent) ~ (Tilde) 0x29 */ 41
-#define KEY_ShiftL /* Shift(left) 0x2a */ 42
-#define KEY_BSlash /* \(BckSlash) |(VertBar)0x2b */ 43
-#define KEY_Z /* Z 0x2c */ 44
-#define KEY_X /* X 0x2d */ 45
-#define KEY_C /* C 0x2e */ 46
-#define KEY_V /* V 0x2f */ 47
-#define KEY_B /* B 0x30 */ 48
-#define KEY_N /* N 0x31 */ 49
-#define KEY_M /* M 0x32 */ 50
-#define KEY_Comma /* , (Comma) < (Less) 0x33 */ 51
-#define KEY_Period /* . (Period) >(Greater)0x34 */ 52
-#define KEY_Slash /* / (Slash) ? 0x35 */ 53
-#define KEY_ShiftR /* Shift(right) 0x36 */ 54
-#define KEY_KP_Multiply /* * 0x37 */ 55
-#define KEY_Alt /* Alt(left) 0x38 */ 56
-#define KEY_Space /* (SpaceBar) 0x39 */ 57
-#define KEY_CapsLock /* CapsLock 0x3a */ 58
-#define KEY_F1 /* F1 0x3b */ 59
-#define KEY_F2 /* F2 0x3c */ 60
-#define KEY_F3 /* F3 0x3d */ 61
-#define KEY_F4 /* F4 0x3e */ 62
-#define KEY_F5 /* F5 0x3f */ 63
-#define KEY_F6 /* F6 0x40 */ 64
-#define KEY_F7 /* F7 0x41 */ 65
-#define KEY_F8 /* F8 0x42 */ 66
-#define KEY_F9 /* F9 0x43 */ 67
-#define KEY_F10 /* F10 0x44 */ 68
-#define KEY_NumLock /* NumLock 0x45 */ 69
-#define KEY_ScrollLock /* ScrollLock 0x46 */ 70
-#define KEY_KP_7 /* 7 Home 0x47 */ 71
-#define KEY_KP_8 /* 8 Up 0x48 */ 72
-#define KEY_KP_9 /* 9 PgUp 0x49 */ 73
-#define KEY_KP_Minus /* - (Minus) 0x4a */ 74
-#define KEY_KP_4 /* 4 Left 0x4b */ 75
-#define KEY_KP_5 /* 5 0x4c */ 76
-#define KEY_KP_6 /* 6 Right 0x4d */ 77
-#define KEY_KP_Plus /* + (Plus) 0x4e */ 78
-#define KEY_KP_1 /* 1 End 0x4f */ 79
-#define KEY_KP_2 /* 2 Down 0x50 */ 80
-#define KEY_KP_3 /* 3 PgDown 0x51 */ 81
-#define KEY_KP_0 /* 0 Insert 0x52 */ 82
-#define KEY_KP_Decimal /* . (Decimal) Delete 0x53 */ 83
-#define KEY_SysReqest /* SysReqest 0x54 */ 84
- /* NOTUSED 0x55 */
-#define KEY_Less /* < (Less) >(Greater) 0x56 */ 86
-#define KEY_F11 /* F11 0x57 */ 87
-#define KEY_F12 /* F12 0x58 */ 88
-
-#define KEY_Prefix0 /* special 0x60 */ 96
-#define KEY_Prefix1 /* specail 0x61 */ 97
-
-/*
- * The 'scancodes' below are generated by the server, because the MF101/102
- * keyboard sends them as sequence of other scancodes
- */
-#define KEY_Home /* Home 0x59 */ 89
-#define KEY_Up /* Up 0x5a */ 90
-#define KEY_PgUp /* PgUp 0x5b */ 91
-#define KEY_Left /* Left 0x5c */ 92
-#define KEY_Begin /* Begin 0x5d */ 93
-#define KEY_Right /* Right 0x5e */ 94
-#define KEY_End /* End 0x5f */ 95
-#define KEY_Down /* Down 0x60 */ 96
-#define KEY_PgDown /* PgDown 0x61 */ 97
-#define KEY_Insert /* Insert 0x62 */ 98
-#define KEY_Delete /* Delete 0x63 */ 99
-#define KEY_KP_Enter /* Enter 0x64 */ 100
-#define KEY_RCtrl /* Ctrl(right) 0x65 */ 101
-#define KEY_Pause /* Pause 0x66 */ 102
-#define KEY_Print /* Print 0x67 */ 103
-#define KEY_KP_Divide /* Divide 0x68 */ 104
-#define KEY_AltLang /* AtlLang(right) 0x69 */ 105
-#define KEY_Break /* Break 0x6a */ 106
-#define KEY_LMeta /* Left Meta 0x6b */ 107
-#define KEY_RMeta /* Right Meta 0x6c */ 108
-#define KEY_Menu /* Menu 0x6d */ 109
-#define KEY_F13 /* F13 0x6e */ 110
-#define KEY_F14 /* F14 0x6f */ 111
-#define KEY_F15 /* F15 0x70 */ 112
-#define KEY_F16 /* F16 0x71 */ 113
-#define KEY_F17 /* F17 0x72 */ 114
-#define KEY_KP_DEC /* KP_DEC 0x73 */ 115
-#define KEY_KP_Equal /* Equal (Keypad) 0x76 */ 118
-#define KEY_XFER /* Kanji Transfer 0x79 */ 121
-#define KEY_NFER /* No Kanji Transfer 0x7b */ 123
-#define KEY_Yen /* Yen 0x7d */ 125
-#define KEY_HKTG /* Hirugana/Katakana tog 0xc8 */ 200
-#define KEY_BSlash2 /* \ _ 0xcb */ 203
-
-/* These are for "notused" and "unknown" entries in translation maps. */
-#define KEY_NOTUSED 0
-#define KEY_UNKNOWN 255
-
-#endif /* _WINKEYNAMES_H */
+#ifndef _WINKEYNAMES_H
+#define _WINKEYNAMES_H
+/*
+ * Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany.
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of Thomas Roell not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission. Thomas Roell makes no representations
+ * about the suitability of this software for any purpose. It is provided
+ * "as is" without express or implied warranty.
+ *
+ * THOMAS ROELL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL THOMAS ROELL BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ *
+ */
+
+#define XK_TECHNICAL
+#define XK_KATAKANA
+#include <X11/keysym.h>
+
+#define GLYPHS_PER_KEY 4
+#define NUM_KEYCODES 248
+#define MIN_KEYCODE 8
+#define MAX_KEYCODE (NUM_KEYCODES + MIN_KEYCODE - 1)
+
+#define AltMask Mod1Mask
+#define NumLockMask Mod2Mask
+#define AltLangMask Mod3Mask
+#define KanaMask Mod4Mask
+#define ScrollLockMask Mod5Mask
+
+#define ModifierDown(k) ((keyc->state & (k)) == (k))
+
+/*
+ * NOTE: The AT/MF keyboards can generate (via the 8042) two (MF: three)
+ * sets of scancodes. Set3 can only be generated by a MF keyboard.
+ * Set2 sends a makecode for keypress, and the same code prefixed by a
+ * F0 for keyrelease. This is a little bit ugly to handle. Thus we use
+ * here for X386 the PC/XT compatible Set1. This set uses 8bit scancodes.
+ * Bit 7 ist set if the key is released. The code E0 switches to a
+ * different meaning to add the new MF cursorkeys, while not breaking old
+ * applications. E1 is another special prefix. Since I assume that there
+ * will be further versions of PC/XT scancode compatible keyboards, we
+ * may be in trouble one day.
+ *
+ * IDEA: 1) Use Set2 on AT84 keyboards and translate it to MF Set3.
+ * 2) Use the keyboards native set and translate it to common keysyms.
+ */
+
+/*
+ * definition of the AT84/MF101/MF102 Keyboard:
+ * ============================================================
+ * Defined Key Cap Glyphs Pressed value
+ * Key Name Main Also (hex) (dec)
+ * ---------------- ---------- ------- ------ ------
+ */
+
+#define KEY_Escape /* Escape 0x01 */ 1
+#define KEY_1 /* 1 ! 0x02 */ 2
+#define KEY_2 /* 2 @ 0x03 */ 3
+#define KEY_3 /* 3 # 0x04 */ 4
+#define KEY_4 /* 4 $ 0x05 */ 5
+#define KEY_5 /* 5 % 0x06 */ 6
+#define KEY_6 /* 6 ^ 0x07 */ 7
+#define KEY_7 /* 7 & 0x08 */ 8
+#define KEY_8 /* 8 * 0x09 */ 9
+#define KEY_9 /* 9 ( 0x0a */ 10
+#define KEY_0 /* 0 ) 0x0b */ 11
+#define KEY_Minus /* - (Minus) _ (Under) 0x0c */ 12
+#define KEY_Equal /* = (Equal) + 0x0d */ 13
+#define KEY_BackSpace /* Back Space 0x0e */ 14
+#define KEY_Tab /* Tab 0x0f */ 15
+#define KEY_Q /* Q 0x10 */ 16
+#define KEY_W /* W 0x11 */ 17
+#define KEY_E /* E 0x12 */ 18
+#define KEY_R /* R 0x13 */ 19
+#define KEY_T /* T 0x14 */ 20
+#define KEY_Y /* Y 0x15 */ 21
+#define KEY_U /* U 0x16 */ 22
+#define KEY_I /* I 0x17 */ 23
+#define KEY_O /* O 0x18 */ 24
+#define KEY_P /* P 0x19 */ 25
+#define KEY_LBrace /* [ { 0x1a */ 26
+#define KEY_RBrace /* ] } 0x1b */ 27
+#define KEY_Enter /* Enter 0x1c */ 28
+#define KEY_LCtrl /* Ctrl(left) 0x1d */ 29
+#define KEY_A /* A 0x1e */ 30
+#define KEY_S /* S 0x1f */ 31
+#define KEY_D /* D 0x20 */ 32
+#define KEY_F /* F 0x21 */ 33
+#define KEY_G /* G 0x22 */ 34
+#define KEY_H /* H 0x23 */ 35
+#define KEY_J /* J 0x24 */ 36
+#define KEY_K /* K 0x25 */ 37
+#define KEY_L /* L 0x26 */ 38
+#define KEY_SemiColon /* ;(SemiColon) :(Colon) 0x27 */ 39
+#define KEY_Quote /* ' (Apostr) " (Quote) 0x28 */ 40
+#define KEY_Tilde /* ` (Accent) ~ (Tilde) 0x29 */ 41
+#define KEY_ShiftL /* Shift(left) 0x2a */ 42
+#define KEY_BSlash /* \(BckSlash) |(VertBar)0x2b */ 43
+#define KEY_Z /* Z 0x2c */ 44
+#define KEY_X /* X 0x2d */ 45
+#define KEY_C /* C 0x2e */ 46
+#define KEY_V /* V 0x2f */ 47
+#define KEY_B /* B 0x30 */ 48
+#define KEY_N /* N 0x31 */ 49
+#define KEY_M /* M 0x32 */ 50
+#define KEY_Comma /* , (Comma) < (Less) 0x33 */ 51
+#define KEY_Period /* . (Period) >(Greater)0x34 */ 52
+#define KEY_Slash /* / (Slash) ? 0x35 */ 53
+#define KEY_ShiftR /* Shift(right) 0x36 */ 54
+#define KEY_KP_Multiply /* * 0x37 */ 55
+#define KEY_Alt /* Alt(left) 0x38 */ 56
+#define KEY_Space /* (SpaceBar) 0x39 */ 57
+#define KEY_CapsLock /* CapsLock 0x3a */ 58
+#define KEY_F1 /* F1 0x3b */ 59
+#define KEY_F2 /* F2 0x3c */ 60
+#define KEY_F3 /* F3 0x3d */ 61
+#define KEY_F4 /* F4 0x3e */ 62
+#define KEY_F5 /* F5 0x3f */ 63
+#define KEY_F6 /* F6 0x40 */ 64
+#define KEY_F7 /* F7 0x41 */ 65
+#define KEY_F8 /* F8 0x42 */ 66
+#define KEY_F9 /* F9 0x43 */ 67
+#define KEY_F10 /* F10 0x44 */ 68
+#define KEY_NumLock /* NumLock 0x45 */ 69
+#define KEY_ScrollLock /* ScrollLock 0x46 */ 70
+#define KEY_KP_7 /* 7 Home 0x47 */ 71
+#define KEY_KP_8 /* 8 Up 0x48 */ 72
+#define KEY_KP_9 /* 9 PgUp 0x49 */ 73
+#define KEY_KP_Minus /* - (Minus) 0x4a */ 74
+#define KEY_KP_4 /* 4 Left 0x4b */ 75
+#define KEY_KP_5 /* 5 0x4c */ 76
+#define KEY_KP_6 /* 6 Right 0x4d */ 77
+#define KEY_KP_Plus /* + (Plus) 0x4e */ 78
+#define KEY_KP_1 /* 1 End 0x4f */ 79
+#define KEY_KP_2 /* 2 Down 0x50 */ 80
+#define KEY_KP_3 /* 3 PgDown 0x51 */ 81
+#define KEY_KP_0 /* 0 Insert 0x52 */ 82
+#define KEY_KP_Decimal /* . (Decimal) Delete 0x53 */ 83
+#define KEY_SysReqest /* SysReqest 0x54 */ 84
+ /* NOTUSED 0x55 */
+#define KEY_Less /* < (Less) >(Greater) 0x56 */ 86
+#define KEY_F11 /* F11 0x57 */ 87
+#define KEY_F12 /* F12 0x58 */ 88
+
+#define KEY_Prefix0 /* special 0x60 */ 96
+#define KEY_Prefix1 /* specail 0x61 */ 97
+
+/*
+ * The 'scancodes' below are generated by the server, because the MF101/102
+ * keyboard sends them as sequence of other scancodes
+ */
+#define KEY_Home /* Home 0x59 */ 89
+#define KEY_Up /* Up 0x5a */ 90
+#define KEY_PgUp /* PgUp 0x5b */ 91
+#define KEY_Left /* Left 0x5c */ 92
+#define KEY_Begin /* Begin 0x5d */ 93
+#define KEY_Right /* Right 0x5e */ 94
+#define KEY_End /* End 0x5f */ 95
+#define KEY_Down /* Down 0x60 */ 96
+#define KEY_PgDown /* PgDown 0x61 */ 97
+#define KEY_Insert /* Insert 0x62 */ 98
+#define KEY_Delete /* Delete 0x63 */ 99
+#define KEY_KP_Enter /* Enter 0x64 */ 100
+#define KEY_RCtrl /* Ctrl(right) 0x65 */ 101
+#define KEY_Pause /* Pause 0x66 */ 102
+#define KEY_Print /* Print 0x67 */ 103
+#define KEY_KP_Divide /* Divide 0x68 */ 104
+#define KEY_AltLang /* AtlLang(right) 0x69 */ 105
+#define KEY_Break /* Break 0x6a */ 106
+#define KEY_LMeta /* Left Meta 0x6b */ 107
+#define KEY_RMeta /* Right Meta 0x6c */ 108
+#define KEY_Menu /* Menu 0x6d */ 109
+#define KEY_F13 /* F13 0x6e */ 110
+#define KEY_F14 /* F14 0x6f */ 111
+#define KEY_F15 /* F15 0x70 */ 112
+#define KEY_F16 /* F16 0x71 */ 113
+#define KEY_F17 /* F17 0x72 */ 114
+#define KEY_KP_DEC /* KP_DEC 0x73 */ 115
+#define KEY_KP_Equal /* Equal (Keypad) 0x76 */ 118
+#define KEY_XFER /* Kanji Transfer 0x79 */ 121
+#define KEY_NFER /* No Kanji Transfer 0x7b */ 123
+#define KEY_Yen /* Yen 0x7d */ 125
+#define KEY_HKTG /* Hirugana/Katakana tog 0xc8 */ 200
+#define KEY_BSlash2 /* \ _ 0xcb */ 203
+
+/* These are for "notused" and "unknown" entries in translation maps. */
+#define KEY_NOTUSED 0
+#define KEY_UNKNOWN 255
+
+#endif /* _WINKEYNAMES_H */
diff --git a/xorg-server/include/input.h b/xorg-server/include/input.h
index e96a44d50..33b94fd3e 100644
--- a/xorg-server/include/input.h
+++ b/xorg-server/include/input.h
@@ -228,14 +228,19 @@ typedef struct _InputAttributes {
#define ATTR_TOUCHPAD (1<<4)
#define ATTR_TOUCHSCREEN (1<<5)
-/* Key has been run through all input processing and events sent to clients. */
+/* Key/Button has been run through all input processing and events sent to clients. */
#define KEY_PROCESSED 1
-/* Key has not been fully processed, no events have been sent. */
+#define BUTTON_PROCESSED 1
+/* Key/Button has not been fully processed, no events have been sent. */
#define KEY_POSTED 2
+#define BUTTON_POSTED 2
extern void set_key_down(DeviceIntPtr pDev, int key_code, int type);
extern void set_key_up(DeviceIntPtr pDev, int key_code, int type);
extern int key_is_down(DeviceIntPtr pDev, int key_code, int type);
+extern void set_button_down(DeviceIntPtr pDev, int button, int type);
+extern void set_button_up(DeviceIntPtr pDev, int button, int type);
+extern int button_is_down(DeviceIntPtr pDev, int button, int type);
extern void InitCoreDevices(void);
extern void InitXTestDevices(void);
diff --git a/xorg-server/mi/mipointer.c b/xorg-server/mi/mipointer.c
index f11de7da0..1f84e5309 100644
--- a/xorg-server/mi/mipointer.c
+++ b/xorg-server/mi/mipointer.c
@@ -73,6 +73,7 @@ static void miPointerMove(DeviceIntPtr pDev, ScreenPtr pScreen,
static Bool miPointerDeviceInitialize(DeviceIntPtr pDev, ScreenPtr pScreen);
static void miPointerDeviceCleanup(DeviceIntPtr pDev,
ScreenPtr pScreen);
+static void miPointerMoveNoEvent (DeviceIntPtr pDev, ScreenPtr pScreen, int x, int y);
static EventList* events; /* for WarpPointer MotionNotifies */
@@ -305,24 +306,9 @@ miPointerWarpCursor (DeviceIntPtr pDev, ScreenPtr pScreen, int x, int y)
}
if (GenerateEvent)
- {
miPointerMove (pDev, pScreen, x, y);
- }
else
- {
- /* everything from miPointerMove except the event and history */
-
- if (!pScreenPriv->waitForUpdate && pScreen == pPointer->pSpriteScreen)
- {
- pPointer->devx = x;
- pPointer->devy = y;
- if(pPointer->pCursor && !pPointer->pCursor->bits->emptyMask)
- (*pScreenPriv->spriteFuncs->MoveCursor) (pDev, pScreen, x, y);
- }
- pPointer->x = x;
- pPointer->y = y;
- pPointer->pScreen = pScreen;
- }
+ miPointerMoveNoEvent(pDev, pScreen, x, y);
/* Don't call USFS if we use Xinerama, otherwise the root window is
* updated to the second screen, and we never receive any events.
@@ -470,7 +456,7 @@ miPointerSetWaitForUpdate(ScreenPtr pScreen, Bool wait)
/* Move the pointer on the current screen, and update the sprite. */
static void
-miPointerMoved (DeviceIntPtr pDev, ScreenPtr pScreen,
+miPointerMoveNoEvent (DeviceIntPtr pDev, ScreenPtr pScreen,
int x, int y)
{
miPointerPtr pPointer;
@@ -546,7 +532,7 @@ miPointerSetPosition(DeviceIntPtr pDev, int *x, int *y)
pPointer->pScreen == pScreen)
return;
- miPointerMoved(pDev, pScreen, *x, *y);
+ miPointerMoveNoEvent(pDev, pScreen, *x, *y);
}
void
@@ -568,7 +554,7 @@ miPointerMove (DeviceIntPtr pDev, ScreenPtr pScreen, int x, int y)
int i, nevents;
int valuators[2];
- miPointerMoved(pDev, pScreen, x, y);
+ miPointerMoveNoEvent(pDev, pScreen, x, y);
/* generate motion notify */
valuators[0] = x;