Added the KP_* symbols, for the keys on the keypad..

This commit is contained in:
Zephaniah E. Hull 1999-12-25 21:50:55 +00:00
parent 570ede5076
commit 6ba933cf80
10 changed files with 208 additions and 117 deletions

View file

@ -112,33 +112,33 @@ static int XLateKey(XKeyEvent *ev)
switch(keysym)
{
case XK_KP_Page_Up:
case XK_KP_Page_Up: key = KP_PGUP; break;
case XK_Page_Up: key = K_PGUP; break;
case XK_KP_Page_Down:
case XK_KP_Page_Down: key = KP_PGDN; break;
case XK_Page_Down: key = K_PGDN; break;
case XK_KP_Home:
case XK_KP_Home: key = KP_HOME; break;
case XK_Home: key = K_HOME; break;
case XK_KP_End:
case XK_KP_End: key = KP_END; break;
case XK_End: key = K_END; break;
case XK_KP_Left:
case XK_KP_Left: key = KP_LEFTARROW; break;
case XK_Left: key = K_LEFTARROW; break;
case XK_KP_Right:
case XK_KP_Right: key = KP_RIGHTARROW; break;
case XK_Right: key = K_RIGHTARROW; break;
case XK_KP_Down:
case XK_KP_Down: key = KP_DOWNARROW; break;
case XK_Down: key = K_DOWNARROW; break;
case XK_KP_Up:
case XK_KP_Up: key = KP_UPARROW; break;
case XK_Up: key = K_UPARROW; break;
case XK_Escape: key = K_ESCAPE; break;
case XK_KP_Enter:
case XK_KP_Enter: key = KP_ENTER; break;
case XK_Return: key = K_ENTER; break;
case XK_Tab: key = K_TAB; break;
@ -169,7 +169,7 @@ static int XLateKey(XKeyEvent *ev)
case XK_BackSpace: key = K_BACKSPACE; break;
case XK_KP_Delete:
case XK_KP_Delete: key = KP_DEL; break;
case XK_Delete: key = K_DEL; break;
case XK_Pause: key = K_PAUSE; break;
@ -186,15 +186,15 @@ static int XLateKey(XKeyEvent *ev)
case XK_Alt_R:
case XK_Meta_R: key = K_ALT; break;
case XK_KP_Begin: key = '5'; break;
case XK_KP_Begin: key = K_AUX30; break;
case XK_KP_Insert:
case XK_Insert:key = K_INS; break;
case XK_Insert: key = K_INS; break;
case XK_KP_Insert: key = KP_INS; break;
case XK_KP_Multiply: key = '*'; break;
case XK_KP_Add: key = '+'; break;
case XK_KP_Subtract: key = '-'; break;
case XK_KP_Divide: key = '/'; break;
case XK_KP_Multiply: key = KP_MULTIPLY; break;
case XK_KP_Add: key = KP_PLUS; break;
case XK_KP_Subtract: key = KP_MINUS; break;
case XK_KP_Divide: key = KP_DIVIDE; break;
#if 0
case 0x021: key = '1';break;/* [!] */
@ -223,6 +223,7 @@ static int XLateKey(XKeyEvent *ev)
key = *(unsigned char*)buf;
if (key >= 'A' && key <= 'Z')
key = key - 'A' + 'a';
// fprintf(stdout, "case 0x0%x: key = ___;break;/* [%c] */\n", keysym);
break;
}

View file

@ -902,7 +902,7 @@ int XLateKey(XKeyEvent *ev)
case XK_F29: key = K_PGUP; break;
case XK_F33: key = K_END; break;
case XK_F35: key = K_PGDN; break;
case XK_KP_Insert: key = K_INS; break;
case XK_KP_Insert: key = KP_INS; break;
default:
key = *buf;

View file

@ -796,10 +796,10 @@ int XLateKey(XKeyEvent *ev)
case XK_F33: key = K_END; break;
case XK_F35: key = K_PGDN; break;
case XK_Insert:
case XK_KP_Insert: key = K_INS; break;
case XK_KP_Insert: key = KP_INS; break;
case XK_F24: key = '-'; break;
case XK_KP_Add: key = '+'; break;
case XK_KP_Subtract: key = '-'; break;
case XK_KP_Add: key = KP_PLUS; break;
case XK_KP_Subtract: key = KP_MINUS; break;
case XK_F25: key = '/'; break;
case XK_F26: key = '*'; break;

View file

@ -672,7 +672,7 @@ void VID_Init(unsigned char *palette)
scantokey[ 52] = '.';
scantokey[ 53] = '/';
scantokey[ 54] = K_SHIFT; //right
scantokey[ 55] = '*'; //keypad
scantokey[ 55] = KP_MULTIPLY; //keypad
scantokey[ 56] = K_ALT; //left
scantokey[ 57] = ' ';
// 58 caps lock
@ -688,26 +688,26 @@ void VID_Init(unsigned char *palette)
scantokey[ 68] = K_F10;
// 69 numlock
// 70 scrollock
scantokey[ 71] = K_HOME;
scantokey[ 72] = K_UPARROW;
scantokey[ 73] = K_PGUP;
scantokey[ 74] = '-';
scantokey[ 75] = K_LEFTARROW;
scantokey[ 76] = '5';
scantokey[ 77] = K_RIGHTARROW;
scantokey[ 79] = K_END;
scantokey[ 78] = '+';
scantokey[ 80] = K_DOWNARROW;
scantokey[ 81] = K_PGDN;
scantokey[ 82] = K_INS;
scantokey[ 83] = K_DEL;
scantokey[ 71] = KP_HOME;
scantokey[ 72] = KP_UPARROW;
scantokey[ 73] = KP_PGUP;
scantokey[ 74] = KP_MINUS;
scantokey[ 75] = KP_LEFTARROW;
scantokey[ 76] = KP_5;
scantokey[ 77] = KP_RIGHTARROW;
scantokey[ 79] = KP_END;
scantokey[ 78] = KP_PLUS;
scantokey[ 80] = KP_DOWNARROW;
scantokey[ 81] = KP_PGDN;
scantokey[ 82] = KP_INS;
scantokey[ 83] = KP_DEL;
// 84 to 86 not used
scantokey[ 87] = K_F11;
scantokey[ 88] = K_F12;
// 89 to 95 not used
scantokey[ 96] = K_ENTER; //keypad enter
scantokey[ 96] = KP_ENTER; //keypad enter
scantokey[ 97] = K_CTRL; //right
scantokey[ 98] = '/';
scantokey[ 98] = KP_DIVIDE;
scantokey[ 99] = K_F12; // print screen, bind to screenshot by default
scantokey[100] = K_ALT; // right

View file

@ -648,33 +648,33 @@ int XLateKey(XKeyEvent *ev)
switch(keysym)
{
case XK_KP_Page_Up:
case XK_KP_Page_Up: key = KP_PGUP; break;
case XK_Page_Up: key = K_PGUP; break;
case XK_KP_Page_Down:
case XK_KP_Page_Down: key = KP_PGDN; break;
case XK_Page_Down: key = K_PGDN; break;
case XK_KP_Home:
case XK_KP_Home: key = KP_HOME; break;
case XK_Home: key = K_HOME; break;
case XK_KP_End:
case XK_KP_End: key = KP_END; break;
case XK_End: key = K_END; break;
case XK_KP_Left:
case XK_KP_Left: key = KP_LEFTARROW; break;
case XK_Left: key = K_LEFTARROW; break;
case XK_KP_Right:
case XK_KP_Right: key = KP_RIGHTARROW; break;
case XK_Right: key = K_RIGHTARROW; break;
case XK_KP_Down:
case XK_KP_Down: key = KP_DOWNARROW; break;
case XK_Down: key = K_DOWNARROW; break;
case XK_KP_Up:
case XK_KP_Up: key = KP_UPARROW; break;
case XK_Up: key = K_UPARROW; break;
case XK_Escape: key = K_ESCAPE; break;
case XK_KP_Enter:
case XK_KP_Enter: key = KP_ENTER; break;
case XK_Return: key = K_ENTER; break;
case XK_Tab: key = K_TAB; break;
@ -705,7 +705,7 @@ int XLateKey(XKeyEvent *ev)
case XK_BackSpace: key = K_BACKSPACE; break;
case XK_KP_Delete:
case XK_KP_Delete: key = KP_DEL; break;
case XK_Delete: key = K_DEL; break;
case XK_Pause: key = K_PAUSE; break;
@ -724,13 +724,13 @@ int XLateKey(XKeyEvent *ev)
case XK_KP_Begin: key = K_AUX30; break;
case XK_Insert:
case XK_KP_Insert: key = K_INS; break;
case XK_Insert: key = K_INS; break;
case XK_KP_Insert: key = KP_INS; break;
case XK_KP_Multiply: key = '*'; break;
case XK_KP_Add: key = '+'; break;
case XK_KP_Subtract: key = '-'; break;
case XK_KP_Divide: key = '/'; break;
case XK_KP_Multiply: key = KP_MULTIPLY; break;
case XK_KP_Add: key = KP_PLUS; break;
case XK_KP_Subtract: key = KP_MINUS; break;
case XK_KP_Divide: key = KP_DIVIDE; break;
#if 0
case 0x021: key = '1';break;/* [!] */

View file

@ -362,15 +362,33 @@ void Init_KBD(void)
for (i=0 ; i<128 ; i++)
scantokey[i] = ' ';
scantokey[69] = KP_NUM;
scantokey[98] = KP_DIVIDE;
scantokey[55] = KP_MULTIPLY;
scantokey[71] = KP_HOME;
scantokey[72] = KP_UPARROW;
scantokey[73] = KP_PGUP;
scantokey[74] = KP_MINUS;
scantokey[75] = KP_LEFTARROW;
scantokey[76] = KP_5;
scantokey[77] = KP_RIGHTARROW;
scantokey[78] = KP_PLUS;
scantokey[79] = KP_END;
scantokey[80] = KP_DOWNARROW;
scantokey[81] = KP_PGDN;
scantokey[82] = KP_INS;
scantokey[83] = KP_DEL;
scantokey[96] = KP_ENTER;
scantokey[42] = K_SHIFT;
scantokey[54] = K_SHIFT;
scantokey[72] = K_UPARROW;
scantokey[103] = K_UPARROW;
scantokey[80] = K_DOWNARROW;
scantokey[108] = K_DOWNARROW;
scantokey[75] = K_LEFTARROW;
scantokey[105] = K_LEFTARROW;
scantokey[77] = K_RIGHTARROW;
scantokey[106] = K_RIGHTARROW;
scantokey[29] = K_CTRL;
scantokey[97] = K_CTRL;
@ -378,12 +396,6 @@ void Init_KBD(void)
scantokey[100] = K_ALT;
// scantokey[58] = JK_CAPS;
// scantokey[69] = JK_NUM_LOCK;
scantokey[71] = K_HOME;
scantokey[73] = K_PGUP;
scantokey[79] = K_END;
scantokey[81] = K_PGDN;
scantokey[82] = K_INS;
scantokey[83] = K_DEL;
scantokey[1 ] = K_ESCAPE;
scantokey[28] = K_ENTER;
scantokey[15] = K_TAB;
@ -459,8 +471,6 @@ void Init_KBD(void)
scantokey[21] = 'y';
scantokey[44] = 'z';
scantokey[78] = '+';
scantokey[74] = '-';
if (keyboard_init())
Sys_Error("keyboard_init() failed");

View file

@ -174,33 +174,33 @@ int XLateKey(XKeyEvent *ev)
switch(keysym)
{
case XK_KP_Page_Up:
case XK_KP_Page_Up: key = KP_PGUP; break;
case XK_Page_Up: key = K_PGUP; break;
case XK_KP_Page_Down:
case XK_KP_Page_Down: key = KP_PGDN; break;
case XK_Page_Down: key = K_PGDN; break;
case XK_KP_Home:
case XK_KP_Home: key = KP_HOME; break;
case XK_Home: key = K_HOME; break;
case XK_KP_End:
case XK_KP_End: key = KP_END; break;
case XK_End: key = K_END; break;
case XK_KP_Left:
case XK_KP_Left: key = KP_LEFTARROW; break;
case XK_Left: key = K_LEFTARROW; break;
case XK_KP_Right:
case XK_KP_Right: key = KP_RIGHTARROW; break;
case XK_Right: key = K_RIGHTARROW; break;
case XK_KP_Down:
case XK_KP_Down: key = KP_DOWNARROW; break;
case XK_Down: key = K_DOWNARROW; break;
case XK_KP_Up:
case XK_KP_Up: key = KP_UPARROW; break;
case XK_Up: key = K_UPARROW; break;
case XK_Escape: key = K_ESCAPE; break;
case XK_KP_Enter:
case XK_KP_Enter: key = KP_ENTER; break;
case XK_Return: key = K_ENTER; break;
case XK_Tab: key = K_TAB; break;
@ -231,7 +231,7 @@ int XLateKey(XKeyEvent *ev)
case XK_BackSpace: key = K_BACKSPACE; break;
case XK_KP_Delete:
case XK_KP_Delete: key = KP_DEL; break;
case XK_Delete: key = K_DEL; break;
case XK_Pause: key = K_PAUSE; break;
@ -250,13 +250,13 @@ int XLateKey(XKeyEvent *ev)
case XK_KP_Begin: key = K_AUX30; break;
case XK_Insert:
case XK_KP_Insert: key = K_INS; break;
case XK_Insert: key = K_INS; break;
case XK_KP_Insert: key = KP_INS; break;
case XK_KP_Multiply: key = '*'; break;
case XK_KP_Add: key = '+'; break;
case XK_KP_Subtract: key = '-'; break;
case XK_KP_Divide: key = '/'; break;
case XK_KP_Multiply: key = KP_MULTIPLY; break;
case XK_KP_Add: key = KP_PLUS; break;
case XK_KP_Subtract: key = KP_MINUS; break;
case XK_KP_Divide: key = KP_DIVIDE; break;
#if 0
case 0x021: key = '1';break;/* [!] */

View file

@ -70,6 +70,30 @@ keyname_t keynames[] =
{"CTRL", K_CTRL},
{"SHIFT", K_SHIFT},
// Keypad stuff..
{"KP_NUM", KP_NUM},
{"KP_DIVIDE", KP_DIVIDE},
{"KP_MULTIPLY", KP_MULTIPLY},
{"KP_MINUS", KP_MINUS},
{"KP_HOME", KP_HOME},
{"KP_UPARROW", KP_UPARROW},
{"KP_PGUP", KP_PGUP},
{"KP_PLUS", KP_PLUS},
{"KP_LEFTARROW", KP_LEFTARROW},
{"KP_5", KP_5},
{"KP_RIGHTARROW", KP_RIGHTARROW},
{"KP_END", KP_END},
{"KP_DOWNARROW", KP_DOWNARROW},
{"KP_PGDN", KP_PGDN},
{"KP_INS", KP_INS},
{"KP_DEL", KP_DEL},
{"KP_ENTER", KP_ENTER},
{"F1", K_F1},
{"F2", K_F2},
{"F3", K_F3},
@ -212,8 +236,10 @@ void Key_Console (int key)
char *clipText, *textCopied;
#endif
if (key == K_ENTER)
{ // backslash text are commands, else chat
switch (key) {
case KP_ENTER:
case K_ENTER:
// backslash text are commands, else chat
if (key_lines[edit_line][1] == '\\' || key_lines[edit_line][1] == '/')
Cbuf_AddText (key_lines[edit_line]+2); // skip the >
else if (CheckForCommand())
@ -235,23 +261,22 @@ void Key_Console (int key)
SCR_UpdateScreen (); // force an update, because the command
// may take some time
return;
}
if (key == K_TAB)
{ // command completion
break;
case K_TAB:
// command completion
CompleteCommand ();
return;
}
break;
if (key == K_BACKSPACE || key == K_LEFTARROW)
{
case K_BACKSPACE:
case KP_LEFTARROW:
case K_LEFTARROW:
if (key_linepos > 1)
key_linepos--;
return;
}
if (key == K_UPARROW)
{
break;
case KP_UPARROW:
case K_UPARROW:
do
{
history_line = (history_line - 1) & 31;
@ -262,10 +287,9 @@ void Key_Console (int key)
Q_strcpy(key_lines[edit_line], key_lines[history_line]);
key_linepos = Q_strlen(key_lines[edit_line]);
return;
}
if (key == K_DOWNARROW)
{
break;
case KP_DOWNARROW:
case K_DOWNARROW:
if (history_line == edit_line) return;
do
{
@ -284,34 +308,36 @@ void Key_Console (int key)
key_linepos = Q_strlen(key_lines[edit_line]);
}
return;
}
if (key == K_PGUP || key==K_MWHEELUP)
{
break;
case K_MWHEELUP:
case KP_PGUP:
case K_PGUP:
con->display -= 2;
return;
}
break;
if (key == K_PGDN || key==K_MWHEELDOWN)
{
case K_MWHEELDOWN:
case KP_PGDN:
case K_PGDN:
con->display += 2;
if (con->display > con->current)
con->display = con->current;
return;
}
break;
if (key == K_HOME)
{
case KP_HOME:
case K_HOME:
con->display = con->current - con_totallines + 10;
return;
}
break;
if (key == K_END)
{
case KP_END:
case K_END:
con->display = con->current;
return;
break;
}
#ifdef _WIN32
if ((key=='V' || key=='v') && GetKeyState(VK_CONTROL)<0) {
if (OpenClipboard(NULL)) {
@ -361,7 +387,7 @@ int chat_bufferlen = 0;
void Key_Message (int key)
{
if (key == K_ENTER)
if (key == K_ENTER || key == KP_ENTER)
{
if (chat_team)
Cbuf_AddText ("say_team \"");
@ -610,6 +636,16 @@ void Key_Init (void)
//
for (i=32 ; i<128 ; i++)
consolekeys[i] = true;
consolekeys[KP_ENTER] = true;
consolekeys[KP_LEFTARROW] = true;
consolekeys[KP_RIGHTARROW] = true;
consolekeys[KP_UPARROW] = true;
consolekeys[KP_DOWNARROW] = true;
consolekeys[KP_HOME] = true;
consolekeys[KP_END] = true;
consolekeys[KP_PGUP] = true;
consolekeys[KP_PGDN] = true;
consolekeys[K_ENTER] = true;
consolekeys[K_TAB] = true;
consolekeys[K_LEFTARROW] = true;

View file

@ -316,18 +316,21 @@ void M_Main_Key (int key)
CL_NextDemo ();
break;
case KP_DOWNARROW:
case K_DOWNARROW:
S_LocalSound ("misc/menu1.wav");
if (++m_main_cursor >= MAIN_ITEMS)
m_main_cursor = 0;
break;
case KP_UPARROW:
case K_UPARROW:
S_LocalSound ("misc/menu1.wav");
if (--m_main_cursor < 0)
m_main_cursor = MAIN_ITEMS - 1;
break;
case KP_ENTER:
case K_ENTER:
m_entersound = true;
@ -570,6 +573,7 @@ void M_Options_Key (int k)
M_Menu_Main_f ();
break;
case KP_ENTER:
case K_ENTER:
m_entersound = true;
switch (options_cursor)
@ -593,6 +597,7 @@ void M_Options_Key (int k)
}
return;
case KP_UPARROW:
case K_UPARROW:
S_LocalSound ("misc/menu1.wav");
options_cursor--;
@ -600,6 +605,7 @@ void M_Options_Key (int k)
options_cursor = OPTIONS_ITEMS-1;
break;
case KP_DOWNARROW:
case K_DOWNARROW:
S_LocalSound ("misc/menu1.wav");
options_cursor++;
@ -607,10 +613,12 @@ void M_Options_Key (int k)
options_cursor = 0;
break;
case KP_LEFTARROW:
case K_LEFTARROW:
M_AdjustSliders (-1);
break;
case KP_RIGHTARROW:
case K_RIGHTARROW:
M_AdjustSliders (1);
break;
@ -630,7 +638,7 @@ void M_Options_Key (int k)
#endif
)
{
if (k == K_UPARROW)
if ((k == K_UPARROW) || (k == KP_UPARROW))
options_cursor = 14;
else
options_cursor = 0;
@ -800,6 +808,8 @@ void M_Keys_Key (int k)
M_Menu_Options_f ();
break;
case KP_LEFTARROW:
case KP_UPARROW:
case K_LEFTARROW:
case K_UPARROW:
S_LocalSound ("misc/menu1.wav");
@ -808,6 +818,8 @@ void M_Keys_Key (int k)
keys_cursor = NUMCOMMANDS-1;
break;
case KP_DOWNARROW:
case KP_RIGHTARROW:
case K_DOWNARROW:
case K_RIGHTARROW:
S_LocalSound ("misc/menu1.wav");
@ -816,6 +828,7 @@ void M_Keys_Key (int k)
keys_cursor = 0;
break;
case KP_ENTER: // go into bind mode
case K_ENTER: // go into bind mode
M_FindKeysForCommand (bindnames[keys_cursor][0], keys);
S_LocalSound ("misc/menu2.wav");
@ -825,6 +838,7 @@ void M_Keys_Key (int k)
break;
case K_BACKSPACE: // delete bindings
case KP_DEL: // delete bindings
case K_DEL: // delete bindings
S_LocalSound ("misc/menu2.wav");
M_UnbindCommand (bindnames[keys_cursor][0]);
@ -885,6 +899,8 @@ void M_Help_Key (int key)
M_Menu_Main_f ();
break;
case KP_UPARROW:
case KP_RIGHTARROW:
case K_UPARROW:
case K_RIGHTARROW:
m_entersound = true;
@ -892,6 +908,8 @@ void M_Help_Key (int key)
help_page = 0;
break;
case KP_DOWNARROW:
case KP_LEFTARROW:
case K_DOWNARROW:
case K_LEFTARROW:
m_entersound = true;
@ -1018,7 +1036,7 @@ void M_SinglePlayer_Draw (void) {
}
void M_SinglePlayer_Key (key) {
if (key == K_ESCAPE || key==K_ENTER)
if (key == K_ESCAPE || key==K_ENTER || key == KP_ENTER)
m_state = m_main;
}
@ -1046,7 +1064,7 @@ void M_MultiPlayer_Draw (void) {
}
void M_MultiPlayer_Key (key) {
if (key == K_ESCAPE || key==K_ENTER)
if (key == K_ESCAPE || key==K_ENTER || key==KP_ENTER)
m_state = m_main;
}

View file

@ -32,7 +32,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#define K_UPARROW 128
#define K_DOWNARROW 129
#define K_LEFTARROW 130
#define K_RIGHTARROW 131
#define K_RIGHTARROW 131
#define K_ALT 132
#define K_CTRL 133
@ -56,6 +56,32 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#define K_HOME 151
#define K_END 152
//
// Keypad stuff..
//
#define KP_NUM 153
#define KP_DIVIDE 154
#define KP_MULTIPLY 155
#define KP_HOME 156
#define KP_UPARROW 157
#define KP_PGUP 158
#define KP_MINUS 159
#define KP_LEFTARROW 160
#define KP_5 161
#define KP_RIGHTARROW 162
#define KP_PLUS 163
#define KP_END 164
#define KP_DOWNARROW 165
#define KP_PGDN 166
#define KP_INS 167
#define KP_DEL 168
#define KP_ENTER 169
#define K_PAUSE 255
//