mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-23 04:42:32 +00:00
ok, old configs /should/ work again, though I'm having problems with F10
not quitting (mind you, I'm not connected)
This commit is contained in:
parent
b0cb351fba
commit
1c12dd804c
4 changed files with 300 additions and 10 deletions
41
include/old_keys.h
Normal file
41
include/old_keys.h
Normal file
|
@ -0,0 +1,41 @@
|
||||||
|
/*
|
||||||
|
old_keys.h
|
||||||
|
|
||||||
|
translations from old to new keynames
|
||||||
|
|
||||||
|
Copyright (C) 2001 Bill Currie <bill@tanwiha.org>
|
||||||
|
|
||||||
|
Author: Bill Currie <bill@tanwiha.org>
|
||||||
|
Date: 2001/8/16
|
||||||
|
|
||||||
|
This program is free software; you can redistribute it and/or
|
||||||
|
modify it under the terms of the GNU General Public License
|
||||||
|
as published by the Free Software Foundation; either version 2
|
||||||
|
of the License, or (at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
|
|
||||||
|
See the GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with this program; if not, write to:
|
||||||
|
|
||||||
|
Free Software Foundation, Inc.
|
||||||
|
59 Temple Place - Suite 330
|
||||||
|
Boston, MA 02111-1307, USA
|
||||||
|
|
||||||
|
$Id$
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef __keys_h
|
||||||
|
#define __keys_h
|
||||||
|
|
||||||
|
#include "QF/vfile.h"
|
||||||
|
|
||||||
|
void OK_Init (void);
|
||||||
|
const char *OK_TranslateKeyName (const char *name);
|
||||||
|
|
||||||
|
#endif//__keys_h
|
|
@ -30,7 +30,7 @@ libQFjs.la: $(libQFjs_la_OBJECTS) $(libQFjs_la_DEPENDENCIES)
|
||||||
$(LINK) -rpath $(libdir) $(libQFjs_la_LDFLAGS) $(libQFjs_la_OBJECTS) $(libQFjs_la_LIBADD) $(LIBS)
|
$(LINK) -rpath $(libdir) $(libQFjs_la_LDFLAGS) $(libQFjs_la_OBJECTS) $(libQFjs_la_LIBADD) $(LIBS)
|
||||||
EXTRA_DIST= joy.c joy_linux.c joy_null.c joy_win.c
|
EXTRA_DIST= joy.c joy_linux.c joy_null.c joy_win.c
|
||||||
|
|
||||||
in_common_SOURCE= in_common.c in_event.c keys.c
|
in_common_SOURCE= in_common.c in_event.c keys.c old_keys.c
|
||||||
|
|
||||||
# Linux FBdev
|
# Linux FBdev
|
||||||
YFLAGS = -d
|
YFLAGS = -d
|
||||||
|
|
|
@ -49,8 +49,10 @@
|
||||||
#include "QF/keys.h"
|
#include "QF/keys.h"
|
||||||
#include "QF/screen.h"
|
#include "QF/screen.h"
|
||||||
#include "QF/sys.h"
|
#include "QF/sys.h"
|
||||||
|
#include "QF/zone.h"
|
||||||
|
|
||||||
#include "compat.h"
|
#include "compat.h"
|
||||||
|
#include "old_keys.h"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
key up events are sent even if in console mode
|
key up events are sent even if in console mode
|
||||||
|
@ -830,12 +832,13 @@ Key_In_Bind (const char *kgt, const char *key, const char *cmd)
|
||||||
void
|
void
|
||||||
Key_In_Bind_f (void)
|
Key_In_Bind_f (void)
|
||||||
{
|
{
|
||||||
int c;
|
int c, i;
|
||||||
const char *kgt, *key, *cmd = 0;
|
const char *kgt, *key, *cmd = 0;
|
||||||
|
char cmd_buf[1024];
|
||||||
|
|
||||||
c = Cmd_Argc ();
|
c = Cmd_Argc ();
|
||||||
|
|
||||||
if (c != 3 && c != 4) {
|
if (c < 3) {
|
||||||
Con_Printf ("in_bind <kgt> <key> [command] : attach a command to a key\n");
|
Con_Printf ("in_bind <kgt> <key> [command] : attach a command to a key\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -844,8 +847,14 @@ Key_In_Bind_f (void)
|
||||||
|
|
||||||
key = Cmd_Argv (2);
|
key = Cmd_Argv (2);
|
||||||
|
|
||||||
if (c == 4) {
|
if (c >= 4) {
|
||||||
cmd = Cmd_Args (3);
|
cmd = cmd_buf;
|
||||||
|
cmd_buf[0] = 0;
|
||||||
|
for (i = 3; i < c; i++) {
|
||||||
|
strncat (cmd_buf, Cmd_Argv (i), sizeof (cmd_buf) - strlen (cmd_buf));
|
||||||
|
if (i != (c - 1))
|
||||||
|
strncat (cmd_buf, " ", sizeof (cmd_buf) - strlen (cmd_buf));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Key_In_Bind (kgt, key, cmd);
|
Key_In_Bind (kgt, key, cmd);
|
||||||
|
@ -864,22 +873,29 @@ Key_Unbind_f (void)
|
||||||
void
|
void
|
||||||
Key_Bind_f (void)
|
Key_Bind_f (void)
|
||||||
{
|
{
|
||||||
int c;
|
int c, i;
|
||||||
const char *kgt, *key, *cmd = 0;
|
const char *kgt, *key, *cmd = 0;
|
||||||
|
char cmd_buf[1024];
|
||||||
|
|
||||||
c = Cmd_Argc ();
|
c = Cmd_Argc ();
|
||||||
|
|
||||||
if (c != 2 && c != 3) {
|
if (c < 2) {
|
||||||
Con_Printf ("bind <key> [command] : attach a command to a key\n");
|
Con_Printf ("bind <key> [command] : attach a command to a key\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
kgt = in_bind_kgt->string;
|
kgt = in_bind_kgt->string;
|
||||||
|
|
||||||
key = Cmd_Argv (1);
|
key = OK_TranslateKeyName (Cmd_Argv (1));
|
||||||
|
|
||||||
if (c == 4) {
|
if (c >= 3) {
|
||||||
cmd = Cmd_Args (2);
|
cmd = cmd_buf;
|
||||||
|
cmd_buf[0] = 0;
|
||||||
|
for (i = 2; i < c; i++) {
|
||||||
|
strncat (cmd_buf, Cmd_Argv (i), sizeof (cmd_buf) - strlen (cmd_buf));
|
||||||
|
if (i != (c - 1))
|
||||||
|
strncat (cmd_buf, " ", sizeof (cmd_buf) - strlen (cmd_buf));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Key_In_Bind (kgt, key, cmd);
|
Key_In_Bind (kgt, key, cmd);
|
||||||
|
@ -1028,6 +1044,8 @@ Key_Init (void)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
OK_Init ();
|
||||||
|
|
||||||
for (i = 0; i < 32; i++) {
|
for (i = 0; i < 32; i++) {
|
||||||
key_lines[i][0] = ']';
|
key_lines[i][0] = ']';
|
||||||
key_lines[i][1] = 0;
|
key_lines[i][1] = 0;
|
||||||
|
|
231
libs/video/targets/old_keys.c
Normal file
231
libs/video/targets/old_keys.c
Normal file
|
@ -0,0 +1,231 @@
|
||||||
|
/*
|
||||||
|
old_keys.c
|
||||||
|
|
||||||
|
translations from old to new keynames
|
||||||
|
|
||||||
|
Copyright (C) 2001 Bill Currie <bill@tanwiha.org>
|
||||||
|
|
||||||
|
Author: Bill Currie <bill@tanwiha.org>
|
||||||
|
Date: 2001/8/16
|
||||||
|
|
||||||
|
This program is free software; you can redistribute it and/or
|
||||||
|
modify it under the terms of the GNU General Public License
|
||||||
|
as published by the Free Software Foundation; either version 2
|
||||||
|
of the License, or (at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
|
|
||||||
|
See the GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with this program; if not, write to:
|
||||||
|
|
||||||
|
Free Software Foundation, Inc.
|
||||||
|
59 Temple Place - Suite 330
|
||||||
|
Boston, MA 02111-1307, USA
|
||||||
|
|
||||||
|
$Id$
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
# include "config.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "QF/console.h"
|
||||||
|
#include "QF/hash.h"
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
char *old_name;
|
||||||
|
char *new_name;
|
||||||
|
} old_keyname_t;
|
||||||
|
|
||||||
|
old_keyname_t old_keynames[] = {
|
||||||
|
{"TAB", "K_TAB"},
|
||||||
|
{"ENTER", "K_RETURN"},
|
||||||
|
{"ESCAPE", "K_ESCAPE"},
|
||||||
|
{"SPACE", "K_SPACE"},
|
||||||
|
{"BACKSPACE", "K_BACKSPACE"},
|
||||||
|
|
||||||
|
{"CAPSLOCK", "K_CAPSLOCK"},
|
||||||
|
{"PRINTSCR", "K_PRINT"},
|
||||||
|
{"SCRLCK", "K_SCROLLOCK"},
|
||||||
|
{"PAUSE", "K_PAUSE"},
|
||||||
|
|
||||||
|
{"UPARROW", "K_UP"},
|
||||||
|
{"DOWNARROW", "K_DOWN"},
|
||||||
|
{"LEFTARROW", "K_LEFT"},
|
||||||
|
{"RIGHTARROW", "K_RIGHT"},
|
||||||
|
|
||||||
|
{"ALT", "K_LALT"},
|
||||||
|
{"CTRL", "K_LCTRL"},
|
||||||
|
{"SHIFT", "K_LSHIFT"},
|
||||||
|
|
||||||
|
{"NUMLOCK", "K_NUMLOCK"},
|
||||||
|
{"KP_NUMLCK", "K_NUMLOCK"},
|
||||||
|
{"KP_NUMLOCK", "K_NUMLOCK"},
|
||||||
|
{"KP_SLASH", "K_KP_DIVIDE"},
|
||||||
|
{"KP_DIVIDE", "K_KP_DIVIDE"},
|
||||||
|
{"KP_STAR", "K_KP_MULTIPLY"},
|
||||||
|
{"KP_MULTIPLY", "K_KP_MULTIPLY"},
|
||||||
|
{"KP_MINUS", "K_KP_MINUS"},
|
||||||
|
|
||||||
|
{"KP_HOME", "K_KP7"},
|
||||||
|
{"KP_UPARROW", "K_KP8"},
|
||||||
|
{"KP_PGUP", "K_KP9"},
|
||||||
|
{"KP_PLUS", "K_KP_PLUS"},
|
||||||
|
|
||||||
|
{"KP_LEFTARROW", "K_KP4"},
|
||||||
|
{"KP_5", "K_KP5"},
|
||||||
|
{"KP_RIGHTARROW", "K_KP6"},
|
||||||
|
|
||||||
|
{"KP_END", "K_KP1"},
|
||||||
|
{"KP_DOWNARROW", "K_KP2"},
|
||||||
|
{"KP_PGDN", "K_KP3"},
|
||||||
|
|
||||||
|
{"KP_INS", "K_KP0"},
|
||||||
|
{"KP_DEL", "K_KP_PERIOD"},
|
||||||
|
{"KP_ENTER", "K_KP_ENTER"},
|
||||||
|
|
||||||
|
{"F1", "K_F1"},
|
||||||
|
{"F2", "K_F2"},
|
||||||
|
{"F3", "K_F3"},
|
||||||
|
{"F4", "K_F4"},
|
||||||
|
{"F5", "K_F5"},
|
||||||
|
{"F6", "K_F6"},
|
||||||
|
{"F7", "K_F7"},
|
||||||
|
{"F8", "K_F8"},
|
||||||
|
{"F9", "K_F9"},
|
||||||
|
{"F10", "K_F10"},
|
||||||
|
{"F11", "K_F11"},
|
||||||
|
{"F12", "K_F12"},
|
||||||
|
|
||||||
|
{"INS", "K_INSERT"},
|
||||||
|
{"DEL", "K_DELETE"},
|
||||||
|
{"PGDN", "K_PAGEDOWN"},
|
||||||
|
{"PGUP", "K_PAGEUP"},
|
||||||
|
{"HOME", "K_HOME"},
|
||||||
|
{"END", "K_END"},
|
||||||
|
|
||||||
|
{"MOUSE1", "M_BUTTON1"},
|
||||||
|
{"MOUSE2", "M_BUTTON2"},
|
||||||
|
{"MOUSE3", "M_BUTTON3"},
|
||||||
|
|
||||||
|
{"JOY1", "J_BUTTON1"},
|
||||||
|
{"JOY2", "J_BUTTON2"},
|
||||||
|
{"JOY3", "J_BUTTON3"},
|
||||||
|
{"JOY4", "J_BUTTON4"},
|
||||||
|
|
||||||
|
{"MWHEELUP", "M_WHEEL_UP"},
|
||||||
|
{"MWHEELDOWN", "M_WHEEL_DOWN"},
|
||||||
|
|
||||||
|
{"ASC178", "K_WORLD_18"},
|
||||||
|
{"ASC233", "K_WORLD_73"},
|
||||||
|
{"ASC167", "K_WORLD_7"},
|
||||||
|
{"ASC232", "K_WORLD_72"},
|
||||||
|
{"ASC231", "K_WORLD_71"},
|
||||||
|
{"ASC224", "K_WORLD_64"},
|
||||||
|
|
||||||
|
{"0", "K_0"},
|
||||||
|
{"1", "K_1"},
|
||||||
|
{"2", "K_2"},
|
||||||
|
{"3", "K_3"},
|
||||||
|
{"4", "K_4"},
|
||||||
|
{"5", "K_5"},
|
||||||
|
{"6", "K_6"},
|
||||||
|
{"7", "K_7"},
|
||||||
|
{"8", "K_8"},
|
||||||
|
{"9", "K_9"},
|
||||||
|
|
||||||
|
{"a", "K_a"},
|
||||||
|
{"b", "K_b"},
|
||||||
|
{"c", "K_c"},
|
||||||
|
{"d", "K_d"},
|
||||||
|
{"e", "K_e"},
|
||||||
|
{"f", "K_f"},
|
||||||
|
{"g", "K_g"},
|
||||||
|
{"h", "K_h"},
|
||||||
|
{"i", "K_i"},
|
||||||
|
{"j", "K_j"},
|
||||||
|
{"k", "K_k"},
|
||||||
|
{"l", "K_l"},
|
||||||
|
{"m", "K_m"},
|
||||||
|
{"n", "K_n"},
|
||||||
|
{"o", "K_o"},
|
||||||
|
{"p", "K_p"},
|
||||||
|
{"q", "K_q"},
|
||||||
|
{"r", "K_r"},
|
||||||
|
{"s", "K_s"},
|
||||||
|
{"t", "K_t"},
|
||||||
|
{"u", "K_u"},
|
||||||
|
{"v", "K_v"},
|
||||||
|
{"w", "K_w"},
|
||||||
|
{"x", "K_y"},
|
||||||
|
{"y", "K_x"},
|
||||||
|
{"z", "K_z"},
|
||||||
|
|
||||||
|
{" ", "K_SPACE"},
|
||||||
|
{"!", "K_EXCLAIM"},
|
||||||
|
{"DOUBLEQUOTE", "K_QUOTEDBL"},
|
||||||
|
{"#", "K_HASH"},
|
||||||
|
{"$", "K_DOLLAR"},
|
||||||
|
{"&", "K_AMPERSAND"},
|
||||||
|
{"'", "K_QUOTE"},
|
||||||
|
{"(", "K_LEFTPAREN"},
|
||||||
|
{")", "K_RIGHTPAREN"},
|
||||||
|
{"*", "K_ASTERISK"},
|
||||||
|
{"+", "K_PLUS"},
|
||||||
|
{",", "K_COMMA"},
|
||||||
|
{"-", "K_MINUS"},
|
||||||
|
{".", "K_PERIOD"},
|
||||||
|
{"/", "K_SLASH"},
|
||||||
|
|
||||||
|
{":", "K_COLON"},
|
||||||
|
{"SEMICOLON", "K_SEMICOLON"},
|
||||||
|
{"<", "K_LESS"},
|
||||||
|
{"=", "K_EQUALS"},
|
||||||
|
{">", "K_GREATER"},
|
||||||
|
{"?", "K_QUESTION"},
|
||||||
|
{"@", "K_AT"},
|
||||||
|
|
||||||
|
{"[", "K_LEFTBRACKET"},
|
||||||
|
{"\\", "K_BACKSLASH"},
|
||||||
|
{"]", "K_RIGHTBRACKET"},
|
||||||
|
{"^", "K_CARET"},
|
||||||
|
{"_", "K_UNDERSCORE"},
|
||||||
|
{"`", "K_BACKQUOTE"},
|
||||||
|
{"~", "K_BACKQUOTE"},
|
||||||
|
|
||||||
|
{0, 0}
|
||||||
|
};
|
||||||
|
|
||||||
|
hashtab_t *old_key_table;
|
||||||
|
|
||||||
|
static const char *
|
||||||
|
get_key (void *_ok, void *unused)
|
||||||
|
{
|
||||||
|
old_keyname_t *ok = (old_keyname_t *)_ok;
|
||||||
|
return ok->old_name;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
OK_Init (void)
|
||||||
|
{
|
||||||
|
old_keyname_t *ok;
|
||||||
|
|
||||||
|
old_key_table = Hash_NewTable (1021, get_key, 0, 0);
|
||||||
|
for (ok = old_keynames; ok->old_name; ok++)
|
||||||
|
Hash_Add (old_key_table, ok);
|
||||||
|
}
|
||||||
|
|
||||||
|
const char *
|
||||||
|
OK_TranslateKeyName (const char *name)
|
||||||
|
{
|
||||||
|
old_keyname_t *ok = Hash_Find (old_key_table, name);
|
||||||
|
if (!ok) {
|
||||||
|
Con_Printf ("%s\n", name);
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
return ok->new_name;
|
||||||
|
}
|
Loading…
Reference in a new issue