- the patch of Christophe Bothamy is checked in and works, so this file is obsolete

This commit is contained in:
Volker Ruppert 2001-12-14 22:17:56 +00:00
parent 9ea6cf032c
commit 16f84392c1

View File

@ -1,466 +0,0 @@
----------------------------------------------------------------------
Patch name: patch.kbd-volker
Author: Volker Ruppert <Volker.Ruppert@t-online.de>
Date: Tue Nov 27 09:43:00 CET 2001
Detailed description:
This is a modified version of the patch.kbd-dieter.
- gui.h : X keycodes are defined only if X is present
- x.cc : keysym stuff removed, the keycodes are used directly
Patch was created with:
diff -u
Apply patch to what version:
cvs checked out on DATE
Instructions:
To patch, go to main bochs directory.
Type "patch -p0 < THIS_PATCH_FILE".
----------------------------------------------------------------------
--- ../bochs/gui/gui.h Mon Nov 26 10:54:12 2001
+++ gui/gui.h Tue Nov 27 09:41:57 2001
@@ -102,6 +102,8 @@
#define BX_KEY_PRESSED 0x00000000
#define BX_KEY_RELEASED 0x80000000
+#ifndef BX_WITH_X11
+
#define BX_KEY_CTRL_L 0
#define BX_KEY_SHIFT_L 1
@@ -218,3 +220,124 @@
#define BX_KEY_PRINT 73
#define BX_KEY_SCRL_LOCK 74
#define BX_KEY_PAUSE 75
+
+#else
+
+#define BX_KEY_CTRL_L 37
+#define BX_KEY_SHIFT_L 50
+
+#define BX_KEY_F1 67
+#define BX_KEY_F2 68
+#define BX_KEY_F3 69
+#define BX_KEY_F4 70
+#define BX_KEY_F5 71
+#define BX_KEY_F6 72
+#define BX_KEY_F7 73
+#define BX_KEY_F8 74
+#define BX_KEY_F9 75
+#define BX_KEY_F10 76
+#define BX_KEY_F11 95
+#define BX_KEY_F12 96
+
+#define BX_KEY_CTRL_R 109
+#define BX_KEY_SHIFT_R 62
+#define BX_KEY_CAPS_LOCK 66
+#define BX_KEY_NUM_LOCK 77
+#define BX_KEY_ALT_L 64
+#define BX_KEY_ALT_R 113
+
+#define BX_KEY_A 38
+#define BX_KEY_B 56
+#define BX_KEY_C 54
+#define BX_KEY_D 40
+#define BX_KEY_E 26
+#define BX_KEY_F 41
+#define BX_KEY_G 42
+#define BX_KEY_H 43
+#define BX_KEY_I 31
+#define BX_KEY_J 44
+#define BX_KEY_K 45
+#define BX_KEY_L 46
+#define BX_KEY_M 58
+#define BX_KEY_N 57
+#define BX_KEY_O 32
+#define BX_KEY_P 33
+#define BX_KEY_Q 24
+#define BX_KEY_R 27
+#define BX_KEY_S 39
+#define BX_KEY_T 28
+#define BX_KEY_U 30
+#define BX_KEY_V 55
+#define BX_KEY_W 25
+#define BX_KEY_X 53
+#define BX_KEY_Y 29
+#define BX_KEY_Z 52
+
+#define BX_KEY_0 19
+#define BX_KEY_1 10
+#define BX_KEY_2 11
+#define BX_KEY_3 12
+#define BX_KEY_4 13
+#define BX_KEY_5 14
+#define BX_KEY_6 15
+#define BX_KEY_7 16
+#define BX_KEY_8 17
+#define BX_KEY_9 18
+
+#define BX_KEY_ESC 9
+
+#define BX_KEY_SPACE 65
+#define BX_KEY_SINGLE_QUOTE 48
+#define BX_KEY_COMMA 59
+#define BX_KEY_PERIOD 60
+#define BX_KEY_SLASH 61
+
+#define BX_KEY_SEMICOLON 47
+#define BX_KEY_EQUALS 21
+
+#define BX_KEY_LEFT_BRACKET 34
+#define BX_KEY_BACKSLASH 51
+#define BX_KEY_LEFT_BACKSLASH 94
+#define BX_KEY_RIGHT_BRACKET 35
+#define BX_KEY_MINUS 20
+#define BX_KEY_GRAVE 49
+
+#define BX_KEY_BACKSPACE 22
+#define BX_KEY_ENTER 36
+#define BX_KEY_TAB 23
+
+#define BX_KEY_INSERT 106
+#define BX_KEY_DELETE 107
+#define BX_KEY_HOME 97
+#define BX_KEY_END 103
+#define BX_KEY_PAGE_UP 99
+#define BX_KEY_PAGE_DOWN 105
+
+#define BX_KEY_KP_ADD 86
+#define BX_KEY_KP_SUBTRACT 82
+#define BX_KEY_KP_END 87
+#define BX_KEY_KP_DOWN 88
+#define BX_KEY_KP_PAGE_DOWN 89
+#define BX_KEY_KP_LEFT 83
+#define BX_KEY_KP_RIGHT 85
+#define BX_KEY_KP_HOME 79
+#define BX_KEY_KP_UP 80
+#define BX_KEY_KP_PAGE_UP 81
+#define BX_KEY_KP_INSERT 90
+#define BX_KEY_KP_DELETE 91
+#define BX_KEY_KP_5 84
+
+#define BX_KEY_UP 98
+#define BX_KEY_DOWN 104
+#define BX_KEY_LEFT 100
+#define BX_KEY_RIGHT 102
+
+#define BX_KEY_KP_ENTER 108
+#define BX_KEY_KP_MULTIPLY 63
+#define BX_KEY_KP_DIVIDE 112
+
+#define BX_KEY_PRINT 111
+#define BX_KEY_SCRL_LOCK 78
+#define BX_KEY_PAUSE 110
+
+#endif
--- ../bochs/gui/x.cc Mon Nov 12 01:45:09 2001
+++ gui/x.cc Mon Nov 26 11:30:21 2001
@@ -106,137 +106,11 @@
static void headerbar_click(int x, int y);
static void send_keyboard_mouse_status(void);
-
-
-
-Bit32u ascii_to_key_event[0x5f] = {
- // !"#$%&'
- BX_KEY_SPACE,
- BX_KEY_1,
- BX_KEY_SINGLE_QUOTE,
- BX_KEY_3,
- BX_KEY_4,
- BX_KEY_5,
- BX_KEY_7,
- BX_KEY_SINGLE_QUOTE,
-
- // ()*+,-./
- BX_KEY_9,
- BX_KEY_0,
- BX_KEY_8,
- BX_KEY_EQUALS,
- BX_KEY_COMMA,
- BX_KEY_MINUS,
- BX_KEY_PERIOD,
- BX_KEY_SLASH,
-
- // 01234567
- BX_KEY_0,
- BX_KEY_1,
- BX_KEY_2,
- BX_KEY_3,
- BX_KEY_4,
- BX_KEY_5,
- BX_KEY_6,
- BX_KEY_7,
-
- // 89:;<=>?
- BX_KEY_8,
- BX_KEY_9,
- BX_KEY_SEMICOLON,
- BX_KEY_SEMICOLON,
- BX_KEY_COMMA,
- BX_KEY_EQUALS,
- BX_KEY_PERIOD,
- BX_KEY_SLASH,
-
- // @ABCDEFG
- BX_KEY_2,
- BX_KEY_A,
- BX_KEY_B,
- BX_KEY_C,
- BX_KEY_D,
- BX_KEY_E,
- BX_KEY_F,
- BX_KEY_G,
-
-
- // HIJKLMNO
- BX_KEY_H,
- BX_KEY_I,
- BX_KEY_J,
- BX_KEY_K,
- BX_KEY_L,
- BX_KEY_M,
- BX_KEY_N,
- BX_KEY_O,
-
-
- // PQRSTUVW
- BX_KEY_P,
- BX_KEY_Q,
- BX_KEY_R,
- BX_KEY_S,
- BX_KEY_T,
- BX_KEY_U,
- BX_KEY_V,
- BX_KEY_W,
-
- // XYZ[\]^_
- BX_KEY_X,
- BX_KEY_Y,
- BX_KEY_Z,
- BX_KEY_LEFT_BRACKET,
- BX_KEY_BACKSLASH,
- BX_KEY_RIGHT_BRACKET,
- BX_KEY_6,
- BX_KEY_MINUS,
-
- // `abcdefg
- BX_KEY_GRAVE,
- BX_KEY_A,
- BX_KEY_B,
- BX_KEY_C,
- BX_KEY_D,
- BX_KEY_E,
- BX_KEY_F,
- BX_KEY_G,
-
- // hijklmno
- BX_KEY_H,
- BX_KEY_I,
- BX_KEY_J,
- BX_KEY_K,
- BX_KEY_L,
- BX_KEY_M,
- BX_KEY_N,
- BX_KEY_O,
-
- // pqrstuvw
- BX_KEY_P,
- BX_KEY_Q,
- BX_KEY_R,
- BX_KEY_S,
- BX_KEY_T,
- BX_KEY_U,
- BX_KEY_V,
- BX_KEY_W,
-
- // xyz{|}~
- BX_KEY_X,
- BX_KEY_Y,
- BX_KEY_Z,
- BX_KEY_LEFT_BRACKET,
- BX_KEY_BACKSLASH,
- BX_KEY_RIGHT_BRACKET,
- BX_KEY_GRAVE
- };
-
extern Bit8u graphics_snapshot[32 * 1024];
static void load_font(void);
-static void xkeypress(KeySym keysym, int press_release);
+static void xkeypress(KeyCode keycode, int press_release);
// extern "C" void select_visual(void);
#define ROUNDUP(nbytes, pad) ((((nbytes) + ((pad)-1)) / (pad)) * ((pad)>>3))
@@ -558,11 +432,6 @@
{
XEvent report;
XKeyEvent *key_event;
- KeySym keysym;
- XComposeStatus compose;
- char buffer[MAX_MAPPED_STRING_LENGTH];
- int bufsize = MAX_MAPPED_STRING_LENGTH;
- int charcount;
Boolean mouse_update;
@@ -693,14 +562,12 @@
case KeyPress:
key_event = (XKeyEvent *) &report;
- charcount = XLookupString(key_event, buffer, bufsize, &keysym, &compose);
- xkeypress(keysym, 0);
+ xkeypress(key_event->keycode, 0);
break;
case KeyRelease:
key_event = (XKeyEvent *) &report;
- charcount = XLookupString(key_event, buffer, bufsize, &keysym, &compose);
- xkeypress(keysym, 1);
+ xkeypress(key_event->keycode, 1);
break;
case MotionNotify:
@@ -794,137 +661,11 @@
void
-xkeypress(KeySym keysym, int press_release)
+xkeypress(KeyCode keycode, int press_release)
{
Bit32u key_event;
-
-
-
-
-
- // this depends on the fact that the X11 keysyms which
- // correspond to the ascii characters space .. tilde
- // are in consequtive order.
- if ((keysym >= XK_space) && (keysym <= XK_asciitilde)) {
- key_event = ascii_to_key_event[keysym - XK_space];
- }
- else switch (keysym) {
- case XK_KP_1:
-#ifdef XK_KP_End
- case XK_KP_End:
-#endif
- key_event = BX_KEY_KP_END; break;
-
- case XK_KP_2:
-#ifdef XK_KP_Down
- case XK_KP_Down:
-#endif
- key_event = BX_KEY_KP_DOWN; break;
-
- case XK_KP_3:
-#ifdef XK_KP_Page_Down
- case XK_KP_Page_Down:
-#endif
- key_event = BX_KEY_KP_PAGE_DOWN; break;
-
- case XK_KP_4:
-#ifdef XK_KP_Left
- case XK_KP_Left:
-#endif
- key_event = BX_KEY_KP_LEFT; break;
-
- case XK_KP_5:
- key_event = BX_KEY_KP_5; break;
-
- case XK_KP_6:
-#ifdef XK_KP_Right
- case XK_KP_Right:
-#endif
- key_event = BX_KEY_KP_RIGHT; break;
-
- case XK_KP_7:
-#ifdef XK_KP_Home
- case XK_KP_Home:
-#endif
- key_event = BX_KEY_KP_HOME; break;
-
- case XK_KP_8:
-#ifdef XK_KP_Up
- case XK_KP_Up:
-#endif
- key_event = BX_KEY_KP_UP; break;
-
- case XK_KP_9:
-#ifdef XK_KP_Page_Up
- case XK_KP_Page_Up:
-#endif
- key_event = BX_KEY_KP_PAGE_UP; break;
-
- case XK_KP_0:
-#ifdef XK_KP_Insert
- case XK_KP_Insert:
- key_event = BX_KEY_KP_INSERT; break;
-#endif
-
- case XK_KP_Decimal:
-#ifdef XK_KP_Delete
- case XK_KP_Delete:
- key_event = BX_KEY_KP_DELETE; break;
-#endif
-
-#ifdef XK_KP_Enter
- case XK_KP_Enter:
- key_event = BX_KEY_KP_ENTER; break;
-#endif
-
- case XK_KP_Subtract: key_event = BX_KEY_KP_SUBTRACT; break;
- case XK_KP_Add: key_event = BX_KEY_KP_ADD; break;
-
- case XK_KP_Multiply: key_event = BX_KEY_KP_MULTIPLY; break;
- case XK_KP_Divide: key_event = BX_KEY_KP_DIVIDE; break;
-
-
- case XK_Up: key_event = BX_KEY_UP; break;
- case XK_Down: key_event = BX_KEY_DOWN; break;
- case XK_Left: key_event = BX_KEY_LEFT; break;
- case XK_Right: key_event = BX_KEY_RIGHT; break;
-
-
- case XK_Delete: key_event = BX_KEY_DELETE; break;
- case XK_BackSpace: key_event = BX_KEY_BACKSPACE; break;
- case XK_Tab: key_event = BX_KEY_TAB; break;
- case XK_Return: key_event = BX_KEY_ENTER; break;
- case XK_Escape: key_event = BX_KEY_ESC; break;
- case XK_F1: key_event = BX_KEY_F1; break;
- case XK_F2: key_event = BX_KEY_F2; break;
- case XK_F3: key_event = BX_KEY_F3; break;
- case XK_F4: key_event = BX_KEY_F4; break;
- case XK_F5: key_event = BX_KEY_F5; break;
- case XK_F6: key_event = BX_KEY_F6; break;
- case XK_F7: key_event = BX_KEY_F7; break;
- case XK_F8: key_event = BX_KEY_F8; break;
- case XK_F9: key_event = BX_KEY_F9; break;
- case XK_F10: key_event = BX_KEY_F10; break;
- case XK_F11: key_event = BX_KEY_F11; break;
- case XK_F12: key_event = BX_KEY_F12; break;
- case XK_Control_L: key_event = BX_KEY_CTRL_L; break;
- case XK_Shift_L: key_event = BX_KEY_SHIFT_L; break;
- case XK_Shift_R: key_event = BX_KEY_SHIFT_R; break;
- case XK_Caps_Lock: key_event = BX_KEY_CAPS_LOCK; break;
- case XK_Num_Lock: key_event = BX_KEY_NUM_LOCK; break;
- case XK_Alt_L: key_event = BX_KEY_ALT_L; break;
-
- case XK_Insert: key_event = BX_KEY_INSERT; break;
- case XK_Home: key_event = BX_KEY_HOME; break;
- case XK_End: key_event = BX_KEY_END; break;
- case XK_Page_Up: key_event = BX_KEY_PAGE_UP; break;
- case XK_Page_Down: key_event = BX_KEY_PAGE_DOWN; break;
-
- default:
- BX_ERROR(( "xkeypress(): keysym %x unhandled!", (unsigned) keysym ));
- return;
- break;
- }
+ key_event = (unsigned) keycode;
+ BX_DEBUG (("keycode: %d\n", (unsigned) keycode));
if (press_release)
key_event |= BX_KEY_RELEASED;