Bochs/bochs/patches/patch.kbd-dieter-for-1.2.1

532 lines
13 KiB
Groff
Raw Normal View History

diff -urN bochs/gui/gui.h bochs_dieter/gui/gui.h
--- bochs/gui/gui.h Tue May 15 16:49:56 2001
+++ bochs_dieter/gui/gui.h Wed Jun 20 22:36:17 2001
@@ -93,114 +93,114 @@
#define BX_KEY_PRESSED 0x00000000
#define BX_KEY_RELEASED 0x80000000
-#define BX_KEY_CTRL_L 0
-#define BX_KEY_SHIFT_L 1
+#define BX_KEY_CTRL_L 37
+#define BX_KEY_SHIFT_L 50
-#define BX_KEY_F1 2
-#define BX_KEY_F2 3
-#define BX_KEY_F3 4
-#define BX_KEY_F4 5
-#define BX_KEY_F5 6
-#define BX_KEY_F6 7
-#define BX_KEY_F7 8
-#define BX_KEY_F8 9
-#define BX_KEY_F9 10
-#define BX_KEY_F10 11
-#define BX_KEY_F11 12
-#define BX_KEY_F12 13
-
-#define BX_KEY_CTRL_R 14
-#define BX_KEY_SHIFT_R 15
-#define BX_KEY_CAPS_LOCK 16
-#define BX_KEY_NUM_LOCK 17
-#define BX_KEY_ALT_L 18
-#define BX_KEY_ALT_R 19
-
-#define BX_KEY_A 20
-#define BX_KEY_B 21
-#define BX_KEY_C 22
-#define BX_KEY_D 23
-#define BX_KEY_E 24
-#define BX_KEY_F 25
-#define BX_KEY_G 26
-#define BX_KEY_H 27
-#define BX_KEY_I 28
-#define BX_KEY_J 29
-#define BX_KEY_K 30
-#define BX_KEY_L 31
-#define BX_KEY_M 32
-#define BX_KEY_N 33
-#define BX_KEY_O 34
-#define BX_KEY_P 35
-#define BX_KEY_Q 36
-#define BX_KEY_R 37
-#define BX_KEY_S 38
-#define BX_KEY_T 39
-#define BX_KEY_U 40
-#define BX_KEY_V 41
-#define BX_KEY_W 42
-#define BX_KEY_X 43
-#define BX_KEY_Y 44
-#define BX_KEY_Z 45
-
-#define BX_KEY_0 46
-#define BX_KEY_1 47
-#define BX_KEY_2 48
-#define BX_KEY_3 49
-#define BX_KEY_4 50
-#define BX_KEY_5 51
-#define BX_KEY_6 52
-#define BX_KEY_7 53
-#define BX_KEY_8 54
-#define BX_KEY_9 55
+#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 56
+#define BX_KEY_ESC 9
-#define BX_KEY_SPACE 57
-#define BX_KEY_SINGLE_QUOTE 58
+#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 62
-#define BX_KEY_EQUALS 63
+#define BX_KEY_SEMICOLON 47
+#define BX_KEY_EQUALS 21
-#define BX_KEY_LEFT_BRACKET 64
-#define BX_KEY_BACKSLASH 65
-#define BX_KEY_RIGHT_BRACKET 66
-#define BX_KEY_MINUS 67
-#define BX_KEY_GRAVE 68
-
-#define BX_KEY_BACKSPACE 69
-#define BX_KEY_ENTER 70
-#define BX_KEY_TAB 71
-
-#define BX_KEY_INSERT 76
-#define BX_KEY_DELETE 77
-#define BX_KEY_HOME 78
-#define BX_KEY_END 79
-#define BX_KEY_PAGE_UP 80
-#define BX_KEY_PAGE_DOWN 81
-
-#define BX_KEY_KP_ADD 82
-#define BX_KEY_KP_SUBTRACT 83
-#define BX_KEY_KP_END 84
-#define BX_KEY_KP_DOWN 85
-#define BX_KEY_KP_PAGE_DOWN 86
-#define BX_KEY_KP_LEFT 87
-#define BX_KEY_KP_RIGHT 88
-#define BX_KEY_KP_HOME 89
-#define BX_KEY_KP_UP 90
-#define BX_KEY_KP_PAGE_UP 91
-#define BX_KEY_KP_INSERT 92
-#define BX_KEY_KP_DELETE 93
-#define BX_KEY_KP_5 94
-
-#define BX_KEY_UP 95
-#define BX_KEY_DOWN 96
-#define BX_KEY_LEFT 97
-#define BX_KEY_RIGHT 98
-
-#define BX_KEY_KP_ENTER 99
-#define BX_KEY_KP_MULTIPLY 100
-#define BX_KEY_KP_DIVIDE 101
+#define BX_KEY_LEFT_BRACKET 34
+#define BX_KEY_BACKSLASH 51
+#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
diff -urN bochs/gui/x.cc bochs_dieter/gui/x.cc
--- bochs/gui/x.cc Thu May 24 16:08:54 2001
+++ bochs_dieter/gui/x.cc Wed Jun 20 22:56:31 2001
@@ -102,137 +102,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))
@@ -533,6 +407,7 @@
XEvent report;
XKeyEvent *key_event;
KeySym keysym;
+ KeyCode keycode;
XComposeStatus compose;
char buffer[MAX_MAPPED_STRING_LENGTH];
int bufsize = MAX_MAPPED_STRING_LENGTH;
@@ -680,13 +555,15 @@
case KeyPress:
key_event = (XKeyEvent *) &report;
charcount = XLookupString(key_event, buffer, bufsize, &keysym, &compose);
- xkeypress(keysym, 0);
+ keycode = XKeysymToKeycode(bx_x_display, keysym);
+ xkeypress(keycode, 0);
break;
case KeyRelease:
key_event = (XKeyEvent *) &report;
charcount = XLookupString(key_event, buffer, bufsize, &keysym, &compose);
- xkeypress(keysym, 1);
+ keycode = XKeysymToKeycode(bx_x_display, keysym);
+ xkeypress(keycode, 1);
break;
case MotionNotify:
@@ -780,137 +657,13 @@
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!\n", (unsigned) keysym ));
- return;
- break;
- }
+ //dieter
+ key_event = (unsigned) keycode;
+// BX_INFO(("keycode: %d\n", (unsigned) keycode));
if (press_release)
key_event |= BX_KEY_RELEASED;