mirror of
https://git.code.sf.net/p/quake/newtree
synced 2024-11-25 05:21:58 +00:00
A few compile fixes.
And of course the very slight rework of the input system, at least in_x11 gets shifts right for different keymaps. Oh, by the way, ALL other input targets are broken in a very 'will not compile' way.
This commit is contained in:
parent
15c31544cf
commit
8f1ff1bddc
7 changed files with 41 additions and 54 deletions
|
@ -172,7 +172,7 @@ extern char chat_buffer[];
|
|||
extern int chat_bufferlen;
|
||||
extern qboolean chat_team;
|
||||
|
||||
void Key_Event (int key, qboolean down);
|
||||
void Key_Event (int key, int alt, qboolean down);
|
||||
void Key_Init (void);
|
||||
void Key_Init_Cvars (void);
|
||||
void Key_WriteBindings (QFile *f);
|
||||
|
|
|
@ -590,6 +590,6 @@ void CL_ClearStates (void)
|
|||
for (i=0 ; i<256 ; i++)
|
||||
{
|
||||
if (keydown[i])
|
||||
Key_Event (i, false);
|
||||
Key_Event (i, 0, false);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -242,16 +242,8 @@ x11_create_null_cursor (void)
|
|||
void
|
||||
x11_set_vidmode(int width, int height)
|
||||
{
|
||||
int i;
|
||||
int best_mode = 0, best_x = INT_MAX, best_y = INT_MAX;
|
||||
|
||||
XGetScreenSaver (x_disp, &xss_timeout, &xss_interval, &xss_blanking,
|
||||
&xss_exposures);
|
||||
XSetScreenSaver (x_disp, 0, xss_interval, xss_blanking,
|
||||
xss_exposures);
|
||||
|
||||
#ifdef XMESA
|
||||
const char *str = getenv("MESA_GLX_FX");
|
||||
|
||||
if (str != NULL && *str != 'd') {
|
||||
if (tolower(*str) == 'w') {
|
||||
Cvar_Set (vid_fullscreen, "0");
|
||||
|
@ -259,7 +251,11 @@ x11_set_vidmode(int width, int height)
|
|||
Cvar_Set (vid_fullscreen, "1");
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
XGetScreenSaver (x_disp, &xss_timeout, &xss_interval, &xss_blanking,
|
||||
&xss_exposures);
|
||||
XSetScreenSaver (x_disp, 0, xss_interval, xss_blanking,
|
||||
xss_exposures);
|
||||
|
||||
#ifdef HAVE_VIDMODE
|
||||
if (!(hasvidmode = VID_CheckVMode(x_disp, NULL, NULL))) {
|
||||
|
@ -270,6 +266,9 @@ x11_set_vidmode(int width, int height)
|
|||
XF86VidModeGetAllModeLines(x_disp, x_screen, &nummodes, &vidmodes);
|
||||
|
||||
if (vid_fullscreen->int_val) {
|
||||
int i;
|
||||
int best_mode = 0, best_x = INT_MAX, best_y = INT_MAX;
|
||||
|
||||
for (i = 0; i < nummodes; i++) {
|
||||
if ((best_x > vidmodes[i]->hdisplay) ||
|
||||
(best_y > vidmodes[i]->vdisplay)) {
|
||||
|
|
|
@ -93,12 +93,17 @@ static int p_mouse_x, p_mouse_y;
|
|||
#define INPUT_MASK (KEY_MASK | MOUSE_MASK)
|
||||
|
||||
static int
|
||||
XLateKey(XKeyEvent *ev)
|
||||
XLateKey(XKeyEvent *ev, qboolean modified)
|
||||
{
|
||||
char tmp[2];
|
||||
int key = 0;
|
||||
KeySym keysym;
|
||||
|
||||
keysym = XLookupKeysym(ev, 0);
|
||||
if (!modified) {
|
||||
keysym = XLookupKeysym(ev, 0);
|
||||
} else {
|
||||
XLookupString(ev, tmp, 1, &keysym, NULL);
|
||||
}
|
||||
|
||||
switch(keysym) {
|
||||
case XK_KP_Page_Up: key = KP_PGUP; break;
|
||||
|
@ -182,33 +187,11 @@ XLateKey(XKeyEvent *ev)
|
|||
case XK_F33: key = K_END; break;
|
||||
case XK_F35: key = K_PGDN; break;
|
||||
|
||||
#if 0
|
||||
case 0x021: key = '1';break;/* [!] */
|
||||
case 0x040: key = '2';break;/* [@] */
|
||||
case 0x023: key = '3';break;/* [#] */
|
||||
case 0x024: key = '4';break;/* [$] */
|
||||
case 0x025: key = '5';break;/* [%] */
|
||||
case 0x05e: key = '6';break;/* [^] */
|
||||
case 0x026: key = '7';break;/* [&] */
|
||||
case 0x02a: key = '8';break;/* [*] */
|
||||
case 0x028: key = '9';;break;/* [(] */
|
||||
case 0x029: key = '0';break;/* [)] */
|
||||
case 0x05f: key = '-';break;/* [_] */
|
||||
case 0x02b: key = '=';break;/* [+] */
|
||||
case 0x07c: key = '\'';break;/* [|] */
|
||||
case 0x07d: key = '[';break;/* [}] */
|
||||
case 0x07b: key = ']';break;/* [{] */
|
||||
case 0x022: key = '\'';break;/* ["] */
|
||||
case 0x03a: key = ';';break;/* [:] */
|
||||
case 0x03f: key = '/';break;/* [?] */
|
||||
case 0x03e: key = '.';break;/* [>] */
|
||||
case 0x03c: key = ',';break;/* [<] */
|
||||
#endif
|
||||
default:
|
||||
if (keysym < 128) {
|
||||
/* ASCII keys */
|
||||
key = keysym;
|
||||
if (key >= 'A' && key <= 'Z') {
|
||||
if (!modified && ((key >= 'A') && (key <= 'Z'))) {
|
||||
key = key + ('a' - 'A');
|
||||
}
|
||||
}
|
||||
|
@ -222,7 +205,7 @@ XLateKey(XKeyEvent *ev)
|
|||
static void
|
||||
event_key (XEvent *event)
|
||||
{
|
||||
Key_Event (XLateKey (&event->xkey), event->type == KeyPress);
|
||||
Key_Event (XLateKey (&event->xkey, 0), XLateKey(&event->xkey, 1), event->type == KeyPress);
|
||||
}
|
||||
|
||||
|
||||
|
@ -238,13 +221,13 @@ event_button (XEvent *event)
|
|||
case 1:
|
||||
case 2:
|
||||
case 3:
|
||||
Key_Event(K_MOUSE1 + but - 1, event->type == ButtonPress);
|
||||
Key_Event(K_MOUSE1 + but - 1, 0, event->type == ButtonPress);
|
||||
break;
|
||||
case 4:
|
||||
Key_Event(K_MWHEELUP, event->type == ButtonPress);
|
||||
Key_Event(K_MWHEELUP, 0, event->type == ButtonPress);
|
||||
break;
|
||||
case 5:
|
||||
Key_Event(K_MWHEELDOWN, event->type == ButtonPress);
|
||||
Key_Event(K_MWHEELDOWN, 0, event->type == ButtonPress);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -98,10 +98,10 @@ JOY_Command (void)
|
|||
joy_buttons[event.number].current = event.value;
|
||||
|
||||
if (joy_buttons[event.number].current > joy_buttons[event.number].old) {
|
||||
Key_Event(K_AUX1 + event.number, true);
|
||||
Key_Event(K_AUX1 + event.number, 0, true);
|
||||
} else {
|
||||
if (joy_buttons[event.number].current < joy_buttons[event.number].old) {
|
||||
Key_Event(K_AUX1 + event.number, false);
|
||||
Key_Event(K_AUX1 + event.number, 0, false);
|
||||
}
|
||||
}
|
||||
joy_buttons[event.number].old = joy_buttons[event.number].current;
|
||||
|
|
|
@ -34,6 +34,7 @@
|
|||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <ctype.h>
|
||||
#include <string.h>
|
||||
#ifdef HAVE_STRINGS_H
|
||||
#include <strings.h>
|
||||
|
@ -779,13 +780,20 @@ Should NOT be called during an interrupt!
|
|||
===================
|
||||
*/
|
||||
void
|
||||
Key_Event ( int key, qboolean down )
|
||||
Key_Event ( int key, int alt_key, qboolean down )
|
||||
{
|
||||
char *kb;
|
||||
char cmd[1024];
|
||||
|
||||
// Con_Printf ("%i : %i\n", key, down); //@@@
|
||||
|
||||
// They don't prove it, fall back to interal MESS.
|
||||
if (alt_key == -1) {
|
||||
if (keydown[K_SHIFT]) {
|
||||
alt_key = keyshift[key];
|
||||
}
|
||||
}
|
||||
|
||||
keydown[key] = down;
|
||||
|
||||
if (!down)
|
||||
|
@ -849,16 +857,13 @@ Key_Event ( int key, qboolean down )
|
|||
if (!down)
|
||||
{
|
||||
kb = keybindings[key];
|
||||
if (kb && kb[0] == '+')
|
||||
{
|
||||
if (kb && kb[0] == '+') {
|
||||
snprintf (cmd, sizeof(cmd), "-%s %i\n", kb+1, key);
|
||||
Cbuf_AddText (cmd);
|
||||
}
|
||||
if (keyshift[key] != key)
|
||||
{
|
||||
kb = keybindings[keyshift[key]];
|
||||
if (kb && kb[0] == '+')
|
||||
{
|
||||
if (islower(key)) {
|
||||
kb = keybindings[toupper(key)];
|
||||
if (kb && kb[0] == '+') {
|
||||
snprintf (cmd, sizeof(cmd), "-%s %i\n", kb+1, key);
|
||||
Cbuf_AddText (cmd);
|
||||
}
|
||||
|
@ -903,8 +908,8 @@ Key_Event ( int key, qboolean down )
|
|||
if (!down)
|
||||
return; // other systems only care about key down events
|
||||
|
||||
if (keydown[K_SHIFT])
|
||||
key = keyshift[key];
|
||||
if (alt_key > 0)
|
||||
key = alt_key;
|
||||
|
||||
switch (key_dest)
|
||||
{
|
||||
|
|
|
@ -69,7 +69,7 @@
|
|||
#include <limits.h>
|
||||
|
||||
#ifndef HAVE_FNMATCH_PROTO
|
||||
fnmatch (__const char *__pattern, __const char *__string, int __flags);
|
||||
int fnmatch (__const char *__pattern, __const char *__string, int __flags);
|
||||
#endif
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue