mirror of
https://git.code.sf.net/p/quake/newtree
synced 2025-02-18 01:21:39 +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 int chat_bufferlen;
|
||||||
extern qboolean chat_team;
|
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 (void);
|
||||||
void Key_Init_Cvars (void);
|
void Key_Init_Cvars (void);
|
||||||
void Key_WriteBindings (QFile *f);
|
void Key_WriteBindings (QFile *f);
|
||||||
|
|
|
@ -590,6 +590,6 @@ void CL_ClearStates (void)
|
||||||
for (i=0 ; i<256 ; i++)
|
for (i=0 ; i<256 ; i++)
|
||||||
{
|
{
|
||||||
if (keydown[i])
|
if (keydown[i])
|
||||||
Key_Event (i, false);
|
Key_Event (i, 0, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -242,16 +242,8 @@ x11_create_null_cursor (void)
|
||||||
void
|
void
|
||||||
x11_set_vidmode(int width, int height)
|
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");
|
const char *str = getenv("MESA_GLX_FX");
|
||||||
|
|
||||||
if (str != NULL && *str != 'd') {
|
if (str != NULL && *str != 'd') {
|
||||||
if (tolower(*str) == 'w') {
|
if (tolower(*str) == 'w') {
|
||||||
Cvar_Set (vid_fullscreen, "0");
|
Cvar_Set (vid_fullscreen, "0");
|
||||||
|
@ -259,7 +251,11 @@ x11_set_vidmode(int width, int height)
|
||||||
Cvar_Set (vid_fullscreen, "1");
|
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
|
#ifdef HAVE_VIDMODE
|
||||||
if (!(hasvidmode = VID_CheckVMode(x_disp, NULL, NULL))) {
|
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);
|
XF86VidModeGetAllModeLines(x_disp, x_screen, &nummodes, &vidmodes);
|
||||||
|
|
||||||
if (vid_fullscreen->int_val) {
|
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++) {
|
for (i = 0; i < nummodes; i++) {
|
||||||
if ((best_x > vidmodes[i]->hdisplay) ||
|
if ((best_x > vidmodes[i]->hdisplay) ||
|
||||||
(best_y > vidmodes[i]->vdisplay)) {
|
(best_y > vidmodes[i]->vdisplay)) {
|
||||||
|
|
|
@ -93,12 +93,17 @@ static int p_mouse_x, p_mouse_y;
|
||||||
#define INPUT_MASK (KEY_MASK | MOUSE_MASK)
|
#define INPUT_MASK (KEY_MASK | MOUSE_MASK)
|
||||||
|
|
||||||
static int
|
static int
|
||||||
XLateKey(XKeyEvent *ev)
|
XLateKey(XKeyEvent *ev, qboolean modified)
|
||||||
{
|
{
|
||||||
|
char tmp[2];
|
||||||
int key = 0;
|
int key = 0;
|
||||||
KeySym keysym;
|
KeySym keysym;
|
||||||
|
|
||||||
keysym = XLookupKeysym(ev, 0);
|
if (!modified) {
|
||||||
|
keysym = XLookupKeysym(ev, 0);
|
||||||
|
} else {
|
||||||
|
XLookupString(ev, tmp, 1, &keysym, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
switch(keysym) {
|
switch(keysym) {
|
||||||
case XK_KP_Page_Up: key = KP_PGUP; break;
|
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_F33: key = K_END; break;
|
||||||
case XK_F35: key = K_PGDN; 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:
|
default:
|
||||||
if (keysym < 128) {
|
if (keysym < 128) {
|
||||||
/* ASCII keys */
|
/* ASCII keys */
|
||||||
key = keysym;
|
key = keysym;
|
||||||
if (key >= 'A' && key <= 'Z') {
|
if (!modified && ((key >= 'A') && (key <= 'Z'))) {
|
||||||
key = key + ('a' - 'A');
|
key = key + ('a' - 'A');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -222,7 +205,7 @@ XLateKey(XKeyEvent *ev)
|
||||||
static void
|
static void
|
||||||
event_key (XEvent *event)
|
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 1:
|
||||||
case 2:
|
case 2:
|
||||||
case 3:
|
case 3:
|
||||||
Key_Event(K_MOUSE1 + but - 1, event->type == ButtonPress);
|
Key_Event(K_MOUSE1 + but - 1, 0, event->type == ButtonPress);
|
||||||
break;
|
break;
|
||||||
case 4:
|
case 4:
|
||||||
Key_Event(K_MWHEELUP, event->type == ButtonPress);
|
Key_Event(K_MWHEELUP, 0, event->type == ButtonPress);
|
||||||
break;
|
break;
|
||||||
case 5:
|
case 5:
|
||||||
Key_Event(K_MWHEELDOWN, event->type == ButtonPress);
|
Key_Event(K_MWHEELDOWN, 0, event->type == ButtonPress);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -98,10 +98,10 @@ JOY_Command (void)
|
||||||
joy_buttons[event.number].current = event.value;
|
joy_buttons[event.number].current = event.value;
|
||||||
|
|
||||||
if (joy_buttons[event.number].current > joy_buttons[event.number].old) {
|
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 {
|
} else {
|
||||||
if (joy_buttons[event.number].current < joy_buttons[event.number].old) {
|
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;
|
joy_buttons[event.number].old = joy_buttons[event.number].current;
|
||||||
|
|
|
@ -34,6 +34,7 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
#include <ctype.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#ifdef HAVE_STRINGS_H
|
#ifdef HAVE_STRINGS_H
|
||||||
#include <strings.h>
|
#include <strings.h>
|
||||||
|
@ -779,13 +780,20 @@ Should NOT be called during an interrupt!
|
||||||
===================
|
===================
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
Key_Event ( int key, qboolean down )
|
Key_Event ( int key, int alt_key, qboolean down )
|
||||||
{
|
{
|
||||||
char *kb;
|
char *kb;
|
||||||
char cmd[1024];
|
char cmd[1024];
|
||||||
|
|
||||||
// Con_Printf ("%i : %i\n", key, down); //@@@
|
// 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;
|
keydown[key] = down;
|
||||||
|
|
||||||
if (!down)
|
if (!down)
|
||||||
|
@ -849,16 +857,13 @@ Key_Event ( int key, qboolean down )
|
||||||
if (!down)
|
if (!down)
|
||||||
{
|
{
|
||||||
kb = keybindings[key];
|
kb = keybindings[key];
|
||||||
if (kb && kb[0] == '+')
|
if (kb && kb[0] == '+') {
|
||||||
{
|
|
||||||
snprintf (cmd, sizeof(cmd), "-%s %i\n", kb+1, key);
|
snprintf (cmd, sizeof(cmd), "-%s %i\n", kb+1, key);
|
||||||
Cbuf_AddText (cmd);
|
Cbuf_AddText (cmd);
|
||||||
}
|
}
|
||||||
if (keyshift[key] != key)
|
if (islower(key)) {
|
||||||
{
|
kb = keybindings[toupper(key)];
|
||||||
kb = keybindings[keyshift[key]];
|
if (kb && kb[0] == '+') {
|
||||||
if (kb && kb[0] == '+')
|
|
||||||
{
|
|
||||||
snprintf (cmd, sizeof(cmd), "-%s %i\n", kb+1, key);
|
snprintf (cmd, sizeof(cmd), "-%s %i\n", kb+1, key);
|
||||||
Cbuf_AddText (cmd);
|
Cbuf_AddText (cmd);
|
||||||
}
|
}
|
||||||
|
@ -903,8 +908,8 @@ Key_Event ( int key, qboolean down )
|
||||||
if (!down)
|
if (!down)
|
||||||
return; // other systems only care about key down events
|
return; // other systems only care about key down events
|
||||||
|
|
||||||
if (keydown[K_SHIFT])
|
if (alt_key > 0)
|
||||||
key = keyshift[key];
|
key = alt_key;
|
||||||
|
|
||||||
switch (key_dest)
|
switch (key_dest)
|
||||||
{
|
{
|
||||||
|
|
|
@ -69,7 +69,7 @@
|
||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
|
|
||||||
#ifndef HAVE_FNMATCH_PROTO
|
#ifndef HAVE_FNMATCH_PROTO
|
||||||
fnmatch (__const char *__pattern, __const char *__string, int __flags);
|
int fnmatch (__const char *__pattern, __const char *__string, int __flags);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue