2001-04-15 04:18:22 +00:00
|
|
|
/*
|
|
|
|
in_x11.c
|
|
|
|
|
|
|
|
general x11 input driver
|
|
|
|
|
|
|
|
Copyright (C) 1996-1997 Id Software, Inc.
|
|
|
|
Copyright (C) 2000 Marcus Sundberg [mackan@stacken.kth.se]
|
|
|
|
Copyright (C) 1999,2000 contributors of the QuakeForge project
|
|
|
|
Please see the file "AUTHORS" for a list of contributors
|
|
|
|
|
|
|
|
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
|
|
|
|
|
|
|
|
*/
|
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
# include "config.h"
|
|
|
|
#endif
|
2003-01-15 15:31:36 +00:00
|
|
|
|
2001-04-15 04:18:22 +00:00
|
|
|
#ifdef HAVE_STRING_H
|
|
|
|
# include <string.h>
|
|
|
|
#endif
|
|
|
|
#ifdef HAVE_STRINGS_H
|
|
|
|
# include <strings.h>
|
|
|
|
#endif
|
|
|
|
#ifdef HAVE_UNISTD_H
|
|
|
|
# include <unistd.h>
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#define _BSD
|
|
|
|
#include <ctype.h>
|
|
|
|
#include <errno.h>
|
2001-08-27 01:00:03 +00:00
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdlib.h>
|
2001-04-15 04:18:22 +00:00
|
|
|
#include <X11/Xlib.h>
|
|
|
|
#include <X11/keysym.h>
|
2011-12-19 07:37:48 +00:00
|
|
|
#include <X11/XF86keysym.h>
|
|
|
|
#include <X11/Sunkeysym.h>
|
2001-09-18 04:53:01 +00:00
|
|
|
#include <X11/Xutil.h>
|
2002-01-08 19:33:42 +00:00
|
|
|
#include <X11/Xatom.h>
|
2001-04-15 04:18:22 +00:00
|
|
|
|
|
|
|
#ifdef HAVE_DGA
|
|
|
|
# include <X11/extensions/XShm.h>
|
2010-08-05 02:35:16 +00:00
|
|
|
# ifdef DGA_OLD_HEADERS
|
|
|
|
# include <X11/extensions/xf86dga.h>
|
|
|
|
# else
|
|
|
|
# include <X11/extensions/Xxf86dga.h>
|
|
|
|
#endif
|
2001-04-15 04:18:22 +00:00
|
|
|
#endif
|
|
|
|
|
2001-07-05 20:35:42 +00:00
|
|
|
#include "QF/cdaudio.h"
|
2001-04-15 04:18:22 +00:00
|
|
|
#include "QF/cmd.h"
|
|
|
|
#include "QF/cvar.h"
|
|
|
|
#include "QF/input.h"
|
|
|
|
#include "QF/joystick.h"
|
|
|
|
#include "QF/keys.h"
|
2001-04-15 07:18:04 +00:00
|
|
|
#include "QF/mathlib.h"
|
2001-04-15 04:18:22 +00:00
|
|
|
#include "QF/qargs.h"
|
2001-07-05 20:18:23 +00:00
|
|
|
#include "QF/sound.h"
|
2001-04-15 04:18:22 +00:00
|
|
|
#include "QF/sys.h"
|
|
|
|
|
2001-07-05 20:18:23 +00:00
|
|
|
#include "compat.h"
|
2001-04-15 07:18:04 +00:00
|
|
|
#include "context_x11.h"
|
|
|
|
#include "dga_check.h"
|
2012-02-17 07:13:56 +00:00
|
|
|
#include "vid_internal.h"
|
2001-04-15 04:18:22 +00:00
|
|
|
|
2002-08-21 00:04:35 +00:00
|
|
|
cvar_t *in_snd_block;
|
|
|
|
cvar_t *in_dga;
|
2003-09-04 22:29:40 +00:00
|
|
|
cvar_t *in_mouse_accel;
|
2001-04-15 04:18:22 +00:00
|
|
|
|
|
|
|
static qboolean dga_avail;
|
|
|
|
static qboolean dga_active;
|
|
|
|
static int p_mouse_x, p_mouse_y;
|
2010-11-27 00:25:29 +00:00
|
|
|
static int input_grabbed = 0;
|
2001-04-15 04:18:22 +00:00
|
|
|
|
2001-08-30 20:04:13 +00:00
|
|
|
static void
|
|
|
|
dga_on (void)
|
|
|
|
{
|
|
|
|
#ifdef HAVE_DGA
|
|
|
|
if (dga_avail && !dga_active) {
|
2010-11-27 00:25:29 +00:00
|
|
|
int ret;
|
|
|
|
ret = XF86DGADirectVideo (x_disp, DefaultScreen (x_disp),
|
2001-08-30 20:04:13 +00:00
|
|
|
XF86DGADirectMouse);
|
2010-11-27 00:25:29 +00:00
|
|
|
Sys_MaskPrintf (SYS_VID, "XF86DGADirectVideo returned %d\n", ret);
|
|
|
|
if (ret)
|
|
|
|
dga_active = true;
|
2001-08-30 20:04:13 +00:00
|
|
|
}
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
dga_off (void)
|
|
|
|
{
|
|
|
|
#ifdef HAVE_DGA
|
|
|
|
if (dga_avail && dga_active) {
|
2010-11-27 00:25:29 +00:00
|
|
|
int ret;
|
|
|
|
ret = XF86DGADirectVideo (x_disp, DefaultScreen (x_disp), 0);
|
|
|
|
Sys_MaskPrintf (SYS_VID, "XF86DGADirectVideo returned %d\n", ret);
|
|
|
|
if (ret)
|
|
|
|
dga_active = false;
|
2001-08-30 20:04:13 +00:00
|
|
|
}
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
in_dga_f (cvar_t *var)
|
|
|
|
{
|
2010-11-27 00:25:29 +00:00
|
|
|
if (var->int_val && input_grabbed) {
|
|
|
|
Sys_MaskPrintf (SYS_VID, "VID: in_dga_f on\n");
|
|
|
|
dga_on ();
|
|
|
|
} else {
|
|
|
|
Sys_MaskPrintf (SYS_VID, "VID: in_dga_f off\n");
|
|
|
|
dga_off ();
|
2001-08-30 20:04:13 +00:00
|
|
|
}
|
|
|
|
}
|
2001-08-27 01:00:03 +00:00
|
|
|
|
2003-09-04 22:29:40 +00:00
|
|
|
static void
|
|
|
|
in_mouse_accel_f (cvar_t *var)
|
|
|
|
{
|
|
|
|
if (var->int_val) {
|
|
|
|
X11_RestoreMouseAcceleration ();
|
|
|
|
} else {
|
|
|
|
X11_SaveMouseAcceleration ();
|
|
|
|
X11_RemoveMouseAcceleration ();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2001-10-30 18:20:56 +00:00
|
|
|
static void
|
|
|
|
in_paste_buffer_f (void)
|
|
|
|
{
|
2002-01-08 19:33:42 +00:00
|
|
|
Atom property;
|
|
|
|
|
|
|
|
if (XGetSelectionOwner (x_disp, XA_PRIMARY) == None)
|
2001-10-30 18:20:56 +00:00
|
|
|
return;
|
2002-01-08 19:33:42 +00:00
|
|
|
property = XInternAtom (x_disp, "GETCLIPBOARDDATA_PROP", False);
|
2002-01-08 20:07:19 +00:00
|
|
|
XConvertSelection (x_disp, XA_PRIMARY, XA_STRING, property, x_win, x_time);
|
2002-01-08 19:33:42 +00:00
|
|
|
XFlush (x_disp);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2002-01-08 20:07:19 +00:00
|
|
|
selection_notify (XEvent *event)
|
2002-01-08 19:33:42 +00:00
|
|
|
{
|
|
|
|
unsigned char *data, *p;
|
|
|
|
unsigned long num_bytes;
|
|
|
|
unsigned long tmp, len;
|
|
|
|
int format;
|
|
|
|
Atom type, property;
|
|
|
|
|
2002-01-08 20:07:19 +00:00
|
|
|
x_time = event->xselection.time;
|
|
|
|
|
2002-01-08 19:33:42 +00:00
|
|
|
if ((property = event->xselection.property) == None)
|
|
|
|
return;
|
|
|
|
|
|
|
|
XGetWindowProperty (x_disp, x_win, property, 0, 0, False, AnyPropertyType,
|
|
|
|
&type, &format, &len, &num_bytes, &data);
|
|
|
|
if (num_bytes <= 0)
|
|
|
|
return;
|
|
|
|
if (XGetWindowProperty (x_disp, x_win, property, 0, num_bytes, True,
|
2002-08-21 00:04:35 +00:00
|
|
|
AnyPropertyType, &type, &format, &len, &tmp, &data)
|
|
|
|
!= Success) {
|
2002-08-21 05:59:00 +00:00
|
|
|
XFree (data); // FIXME is this correct for this instance?
|
2002-01-08 19:33:42 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2001-10-30 18:20:56 +00:00
|
|
|
// get bytes to keys.c
|
2002-01-08 19:33:42 +00:00
|
|
|
for (p = data; num_bytes && *p; p++, num_bytes--) {
|
2001-10-30 18:20:56 +00:00
|
|
|
Key_Event (QFK_UNKNOWN, *p, 1);
|
|
|
|
Key_Event (QFK_UNKNOWN, 0, 0);
|
|
|
|
}
|
2002-01-08 19:33:42 +00:00
|
|
|
XFree (data);
|
2001-10-30 18:20:56 +00:00
|
|
|
}
|
|
|
|
|
2003-02-25 17:19:47 +00:00
|
|
|
static void
|
|
|
|
enter_notify (XEvent *event)
|
|
|
|
{
|
|
|
|
x_time = event->xcrossing.time;
|
|
|
|
|
|
|
|
p_mouse_x = event->xmotion.x;
|
|
|
|
p_mouse_y = event->xmotion.y;
|
|
|
|
}
|
|
|
|
|
2001-08-16 16:41:40 +00:00
|
|
|
static void
|
|
|
|
XLateKey (XKeyEvent * ev, int *k, int *u)
|
2001-04-15 04:18:22 +00:00
|
|
|
{
|
2005-06-08 06:35:48 +00:00
|
|
|
char buffer[4];
|
2011-06-19 01:48:02 +00:00
|
|
|
int unicode;
|
2001-04-15 04:18:22 +00:00
|
|
|
int key = 0;
|
2001-08-17 19:47:51 +00:00
|
|
|
KeySym keysym, shifted_keysym;
|
2001-08-16 16:41:40 +00:00
|
|
|
XComposeStatus compose;
|
2001-04-15 04:18:22 +00:00
|
|
|
|
2001-08-17 19:47:51 +00:00
|
|
|
keysym = XLookupKeysym (ev, 0);
|
2011-06-19 01:48:02 +00:00
|
|
|
XLookupString (ev, buffer, sizeof(buffer), &shifted_keysym,
|
2001-08-27 01:00:03 +00:00
|
|
|
&compose);
|
2005-06-08 06:35:48 +00:00
|
|
|
unicode = (byte) buffer[0];
|
2001-04-15 04:18:22 +00:00
|
|
|
|
|
|
|
switch (keysym) {
|
|
|
|
case XK_KP_Page_Up:
|
2001-10-28 04:23:37 +00:00
|
|
|
key = QFK_KP9;
|
2001-04-15 04:18:22 +00:00
|
|
|
break;
|
|
|
|
case XK_Page_Up:
|
2001-10-28 04:23:37 +00:00
|
|
|
key = QFK_PAGEUP;
|
2001-04-15 04:18:22 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case XK_KP_Page_Down:
|
2001-10-28 04:23:37 +00:00
|
|
|
key = QFK_KP3;
|
2001-04-15 04:18:22 +00:00
|
|
|
break;
|
|
|
|
case XK_Page_Down:
|
2001-10-28 04:23:37 +00:00
|
|
|
key = QFK_PAGEDOWN;
|
2001-04-15 04:18:22 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case XK_KP_Home:
|
2001-10-28 04:23:37 +00:00
|
|
|
key = QFK_KP7;
|
2001-04-15 04:18:22 +00:00
|
|
|
break;
|
|
|
|
case XK_Home:
|
2001-10-28 04:23:37 +00:00
|
|
|
key = QFK_HOME;
|
2001-04-15 04:18:22 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case XK_KP_End:
|
2001-10-28 04:23:37 +00:00
|
|
|
key = QFK_KP1;
|
2001-04-15 04:18:22 +00:00
|
|
|
break;
|
|
|
|
case XK_End:
|
2001-10-28 04:23:37 +00:00
|
|
|
key = QFK_END;
|
2001-04-15 04:18:22 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case XK_KP_Left:
|
2001-10-28 04:23:37 +00:00
|
|
|
key = QFK_KP4;
|
2001-04-15 04:18:22 +00:00
|
|
|
break;
|
|
|
|
case XK_Left:
|
2001-10-28 04:23:37 +00:00
|
|
|
key = QFK_LEFT;
|
2001-04-15 04:18:22 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case XK_KP_Right:
|
2001-10-28 04:23:37 +00:00
|
|
|
key = QFK_KP6;
|
2001-04-15 04:18:22 +00:00
|
|
|
break;
|
|
|
|
case XK_Right:
|
2001-10-28 04:23:37 +00:00
|
|
|
key = QFK_RIGHT;
|
2001-04-15 04:18:22 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case XK_KP_Down:
|
2001-10-28 04:23:37 +00:00
|
|
|
key = QFK_KP2;
|
2001-04-15 04:18:22 +00:00
|
|
|
break;
|
|
|
|
case XK_Down:
|
2001-10-28 04:23:37 +00:00
|
|
|
key = QFK_DOWN;
|
2001-04-15 04:18:22 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case XK_KP_Up:
|
2001-10-28 04:23:37 +00:00
|
|
|
key = QFK_KP8;
|
2001-04-15 04:18:22 +00:00
|
|
|
break;
|
|
|
|
case XK_Up:
|
2001-10-28 04:23:37 +00:00
|
|
|
key = QFK_UP;
|
2001-04-15 04:18:22 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case XK_Escape:
|
2001-10-28 04:23:37 +00:00
|
|
|
key = QFK_ESCAPE;
|
2001-04-15 04:18:22 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case XK_KP_Enter:
|
2001-10-28 04:23:37 +00:00
|
|
|
key = QFK_KP_ENTER;
|
2001-04-15 04:18:22 +00:00
|
|
|
break;
|
|
|
|
case XK_Return:
|
2001-10-28 04:23:37 +00:00
|
|
|
key = QFK_RETURN;
|
2001-04-15 04:18:22 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case XK_Tab:
|
2001-10-28 04:23:37 +00:00
|
|
|
key = QFK_TAB;
|
2001-04-15 04:18:22 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case XK_F1:
|
2001-10-28 04:23:37 +00:00
|
|
|
key = QFK_F1;
|
2001-04-15 04:18:22 +00:00
|
|
|
break;
|
|
|
|
case XK_F2:
|
2001-10-28 04:23:37 +00:00
|
|
|
key = QFK_F2;
|
2001-04-15 04:18:22 +00:00
|
|
|
break;
|
|
|
|
case XK_F3:
|
2001-10-28 04:23:37 +00:00
|
|
|
key = QFK_F3;
|
2001-04-15 04:18:22 +00:00
|
|
|
break;
|
|
|
|
case XK_F4:
|
2001-10-28 04:23:37 +00:00
|
|
|
key = QFK_F4;
|
2001-04-15 04:18:22 +00:00
|
|
|
break;
|
|
|
|
case XK_F5:
|
2001-10-28 04:23:37 +00:00
|
|
|
key = QFK_F5;
|
2001-04-15 04:18:22 +00:00
|
|
|
break;
|
|
|
|
case XK_F6:
|
2001-10-28 04:23:37 +00:00
|
|
|
key = QFK_F6;
|
2001-04-15 04:18:22 +00:00
|
|
|
break;
|
|
|
|
case XK_F7:
|
2001-10-28 04:23:37 +00:00
|
|
|
key = QFK_F7;
|
2001-04-15 04:18:22 +00:00
|
|
|
break;
|
|
|
|
case XK_F8:
|
2001-10-28 04:23:37 +00:00
|
|
|
key = QFK_F8;
|
2001-04-15 04:18:22 +00:00
|
|
|
break;
|
|
|
|
case XK_F9:
|
2001-10-28 04:23:37 +00:00
|
|
|
key = QFK_F9;
|
2001-04-15 04:18:22 +00:00
|
|
|
break;
|
|
|
|
case XK_F10:
|
2001-10-28 04:23:37 +00:00
|
|
|
key = QFK_F10;
|
2001-04-15 04:18:22 +00:00
|
|
|
break;
|
|
|
|
case XK_F11:
|
2001-10-28 04:23:37 +00:00
|
|
|
key = QFK_F11;
|
2001-04-15 04:18:22 +00:00
|
|
|
break;
|
|
|
|
case XK_F12:
|
2001-10-28 04:23:37 +00:00
|
|
|
key = QFK_F12;
|
2001-04-15 04:18:22 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case XK_BackSpace:
|
2001-10-28 04:23:37 +00:00
|
|
|
key = QFK_BACKSPACE;
|
2001-04-15 04:18:22 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case XK_KP_Delete:
|
2001-10-28 04:23:37 +00:00
|
|
|
key = QFK_KP_PERIOD;
|
2001-04-15 04:18:22 +00:00
|
|
|
break;
|
|
|
|
case XK_Delete:
|
2001-10-28 04:23:37 +00:00
|
|
|
key = QFK_DELETE;
|
2001-04-15 04:18:22 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case XK_Pause:
|
2001-10-28 04:23:37 +00:00
|
|
|
key = QFK_PAUSE;
|
2001-04-15 04:18:22 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case XK_Shift_L:
|
2001-10-28 04:23:37 +00:00
|
|
|
key = QFK_LSHIFT;
|
2001-08-16 16:41:40 +00:00
|
|
|
break;
|
2001-04-15 04:18:22 +00:00
|
|
|
case XK_Shift_R:
|
2001-10-28 04:23:37 +00:00
|
|
|
key = QFK_RSHIFT;
|
2001-04-15 04:18:22 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case XK_Execute:
|
|
|
|
case XK_Control_L:
|
2001-10-28 04:23:37 +00:00
|
|
|
key = QFK_LCTRL;
|
2001-08-16 16:41:40 +00:00
|
|
|
break;
|
2001-04-15 04:18:22 +00:00
|
|
|
case XK_Control_R:
|
2002-08-08 05:53:58 +00:00
|
|
|
key = QFK_RCTRL;
|
2001-04-15 04:18:22 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case XK_Mode_switch:
|
|
|
|
case XK_Alt_L:
|
2001-10-28 04:23:37 +00:00
|
|
|
key = QFK_LALT;
|
2001-08-16 16:41:40 +00:00
|
|
|
break;
|
2001-04-15 04:18:22 +00:00
|
|
|
case XK_Meta_L:
|
2001-10-28 04:23:37 +00:00
|
|
|
key = QFK_LMETA;
|
2001-08-16 16:41:40 +00:00
|
|
|
break;
|
2001-04-15 04:18:22 +00:00
|
|
|
case XK_Alt_R:
|
2001-10-28 04:23:37 +00:00
|
|
|
key = QFK_RALT;
|
2001-08-16 16:41:40 +00:00
|
|
|
break;
|
2001-04-15 04:18:22 +00:00
|
|
|
case XK_Meta_R:
|
2001-10-28 04:23:37 +00:00
|
|
|
key = QFK_RMETA;
|
2001-04-15 04:18:22 +00:00
|
|
|
break;
|
2009-03-18 00:26:34 +00:00
|
|
|
case XK_Super_L:
|
|
|
|
key = QFK_LSUPER;
|
|
|
|
break;
|
|
|
|
case XK_Super_R:
|
|
|
|
key = QFK_RSUPER;
|
|
|
|
break;
|
2001-04-15 04:18:22 +00:00
|
|
|
|
2002-04-27 00:25:40 +00:00
|
|
|
case XK_Multi_key:
|
|
|
|
key = QFK_COMPOSE;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case XK_Menu:
|
|
|
|
key = QFK_MENU;
|
|
|
|
break;
|
|
|
|
|
2001-04-15 04:18:22 +00:00
|
|
|
case XK_Caps_Lock:
|
2001-10-28 04:23:37 +00:00
|
|
|
key = QFK_CAPSLOCK;
|
2001-04-15 04:18:22 +00:00
|
|
|
break;
|
2002-08-08 05:53:58 +00:00
|
|
|
|
2001-04-15 04:18:22 +00:00
|
|
|
case XK_KP_Begin:
|
2001-10-28 04:23:37 +00:00
|
|
|
key = QFK_KP5;
|
2001-04-15 04:18:22 +00:00
|
|
|
break;
|
|
|
|
|
2002-04-27 00:07:47 +00:00
|
|
|
case XK_Print:
|
|
|
|
key = QFK_PRINT;
|
|
|
|
break;
|
|
|
|
|
2001-08-20 02:06:55 +00:00
|
|
|
case XK_Scroll_Lock:
|
2001-10-28 04:23:37 +00:00
|
|
|
key = QFK_SCROLLOCK;
|
2001-08-20 02:06:55 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case XK_Num_Lock:
|
2001-10-28 04:23:37 +00:00
|
|
|
key = QFK_NUMLOCK;
|
2001-08-20 02:06:55 +00:00
|
|
|
break;
|
|
|
|
|
2001-04-15 04:18:22 +00:00
|
|
|
case XK_Insert:
|
2001-10-28 04:23:37 +00:00
|
|
|
key = QFK_INSERT;
|
2001-04-15 04:18:22 +00:00
|
|
|
break;
|
|
|
|
case XK_KP_Insert:
|
2001-10-28 04:23:37 +00:00
|
|
|
key = QFK_KP0;
|
2001-04-15 04:18:22 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case XK_KP_Multiply:
|
2001-10-28 04:23:37 +00:00
|
|
|
key = QFK_KP_MULTIPLY;
|
2001-04-15 04:18:22 +00:00
|
|
|
break;
|
|
|
|
case XK_KP_Add:
|
2001-10-28 04:23:37 +00:00
|
|
|
key = QFK_KP_PLUS;
|
2001-04-15 04:18:22 +00:00
|
|
|
break;
|
|
|
|
case XK_KP_Subtract:
|
2001-10-28 04:23:37 +00:00
|
|
|
key = QFK_KP_MINUS;
|
2001-04-15 04:18:22 +00:00
|
|
|
break;
|
|
|
|
case XK_KP_Divide:
|
2001-10-28 04:23:37 +00:00
|
|
|
key = QFK_KP_DIVIDE;
|
2001-04-15 04:18:22 +00:00
|
|
|
break;
|
|
|
|
|
2002-08-21 00:04:35 +00:00
|
|
|
// For Sun keyboards
|
2001-04-15 04:18:22 +00:00
|
|
|
case XK_F27:
|
2001-10-28 04:23:37 +00:00
|
|
|
key = QFK_HOME;
|
2001-04-15 04:18:22 +00:00
|
|
|
break;
|
|
|
|
case XK_F29:
|
2001-10-28 04:23:37 +00:00
|
|
|
key = QFK_PAGEUP;
|
2001-04-15 04:18:22 +00:00
|
|
|
break;
|
|
|
|
case XK_F33:
|
2001-10-28 04:23:37 +00:00
|
|
|
key = QFK_END;
|
2001-04-15 04:18:22 +00:00
|
|
|
break;
|
|
|
|
case XK_F35:
|
2001-10-28 04:23:37 +00:00
|
|
|
key = QFK_PAGEDOWN;
|
2001-04-15 04:18:22 +00:00
|
|
|
break;
|
|
|
|
|
2002-08-21 00:04:35 +00:00
|
|
|
// Some high ASCII symbols, for azerty keymaps
|
2001-07-19 21:46:34 +00:00
|
|
|
case XK_twosuperior:
|
2001-10-28 04:23:37 +00:00
|
|
|
key = QFK_WORLD_18;
|
2001-07-19 21:46:34 +00:00
|
|
|
break;
|
|
|
|
case XK_eacute:
|
2001-10-28 04:23:37 +00:00
|
|
|
key = QFK_WORLD_63;
|
2001-07-19 21:46:34 +00:00
|
|
|
break;
|
|
|
|
case XK_section:
|
2001-10-28 04:23:37 +00:00
|
|
|
key = QFK_WORLD_7;
|
2001-07-19 21:46:34 +00:00
|
|
|
break;
|
|
|
|
case XK_egrave:
|
2001-10-28 04:23:37 +00:00
|
|
|
key = QFK_WORLD_72;
|
2001-07-19 21:46:34 +00:00
|
|
|
break;
|
|
|
|
case XK_ccedilla:
|
2001-10-28 04:23:37 +00:00
|
|
|
key = QFK_WORLD_71;
|
2001-07-19 21:46:34 +00:00
|
|
|
break;
|
|
|
|
case XK_agrave:
|
2001-10-28 04:23:37 +00:00
|
|
|
key = QFK_WORLD_64;
|
2001-07-19 21:46:34 +00:00
|
|
|
break;
|
|
|
|
|
2009-03-18 00:26:34 +00:00
|
|
|
case XK_Kanji:
|
|
|
|
key = QFK_KANJI;
|
|
|
|
break;
|
|
|
|
case XK_Muhenkan:
|
|
|
|
key = QFK_MUHENKAN;
|
|
|
|
break;
|
|
|
|
case XK_Henkan:
|
|
|
|
key = QFK_HENKAN;
|
|
|
|
break;
|
|
|
|
case XK_Romaji:
|
|
|
|
key = QFK_ROMAJI;
|
|
|
|
break;
|
|
|
|
case XK_Hiragana:
|
|
|
|
key = QFK_HIRAGANA;
|
|
|
|
break;
|
|
|
|
case XK_Katakana:
|
|
|
|
key = QFK_KATAKANA;
|
|
|
|
break;
|
|
|
|
case XK_Hiragana_Katakana:
|
2013-01-13 09:54:23 +00:00
|
|
|
key = QFK_HIRAGANA_KATAKANA;
|
2009-03-18 00:26:34 +00:00
|
|
|
break;
|
|
|
|
case XK_Zenkaku:
|
|
|
|
key = QFK_ZENKAKU;
|
|
|
|
break;
|
|
|
|
case XK_Hankaku:
|
|
|
|
key = QFK_HANKAKU;
|
|
|
|
break;
|
|
|
|
case XK_Zenkaku_Hankaku:
|
|
|
|
key = QFK_ZENKAKU_HANKAKU;
|
|
|
|
break;
|
|
|
|
case XK_Touroku:
|
|
|
|
key = QFK_TOUROKU;
|
|
|
|
break;
|
|
|
|
case XK_Massyo:
|
|
|
|
key = QFK_MASSYO;
|
|
|
|
break;
|
|
|
|
case XK_Kana_Lock:
|
|
|
|
key = QFK_KANA_LOCK;
|
|
|
|
break;
|
|
|
|
case XK_Kana_Shift:
|
|
|
|
key = QFK_KANA_SHIFT;
|
|
|
|
break;
|
|
|
|
case XK_Eisu_Shift:
|
|
|
|
key = QFK_EISU_SHIFT;
|
|
|
|
break;
|
|
|
|
case XK_Eisu_toggle:
|
|
|
|
key = QFK_EISU_TOGGLE;
|
|
|
|
break;
|
|
|
|
case XK_Kanji_Bangou:
|
|
|
|
key = QFK_KANJI_BANGOU;
|
|
|
|
break;
|
|
|
|
case XK_Zen_Koho:
|
|
|
|
key = QFK_ZEN_KOHO;
|
|
|
|
break;
|
|
|
|
case XK_Mae_Koho:
|
|
|
|
key = QFK_MAE_KOHO;
|
|
|
|
break;
|
2011-12-19 07:37:48 +00:00
|
|
|
case XF86XK_HomePage:
|
|
|
|
key = QFK_HOMEPAGE;
|
|
|
|
break;
|
|
|
|
case XF86XK_Search:
|
|
|
|
key = QFK_SEARCH;
|
|
|
|
break;
|
|
|
|
case XF86XK_Mail:
|
|
|
|
key = QFK_MAIL;
|
|
|
|
break;
|
|
|
|
case XF86XK_Favorites:
|
|
|
|
key = QFK_FAVORITES;
|
|
|
|
break;
|
|
|
|
case XF86XK_AudioMute:
|
|
|
|
key = QFK_AUDIOMUTE;
|
|
|
|
break;
|
|
|
|
case XF86XK_AudioLowerVolume:
|
|
|
|
key = QFK_AUDIOLOWERVOLUME;
|
|
|
|
break;
|
|
|
|
case XF86XK_AudioRaiseVolume:
|
|
|
|
key = QFK_AUDIORAISEVOLUME;
|
|
|
|
break;
|
|
|
|
case XF86XK_AudioPlay:
|
|
|
|
key = QFK_AUDIOPLAY;
|
|
|
|
break;
|
|
|
|
case XF86XK_Calculator:
|
|
|
|
key = QFK_CALCULATOR;
|
|
|
|
break;
|
|
|
|
case XK_Help:
|
|
|
|
key = QFK_HELP;
|
|
|
|
break;
|
|
|
|
case XK_Undo:
|
|
|
|
key = QFK_UNDO;
|
|
|
|
break;
|
|
|
|
case XK_Redo:
|
|
|
|
key = QFK_REDO;
|
|
|
|
break;
|
|
|
|
case XF86XK_New:
|
|
|
|
key = QFK_NEW;
|
|
|
|
break;
|
|
|
|
case XF86XK_Reload: // eh? it's open (hiraku) on my kb
|
|
|
|
key = QFK_RELOAD;
|
|
|
|
break;
|
|
|
|
case SunXK_Open:
|
|
|
|
//FALL THROUGH
|
|
|
|
case XF86XK_Open:
|
|
|
|
key = QFK_OPEN;
|
|
|
|
break;
|
|
|
|
case XF86XK_Close:
|
|
|
|
key = QFK_CLOSE;
|
|
|
|
break;
|
|
|
|
case XF86XK_Reply:
|
|
|
|
key = QFK_REPLY;
|
|
|
|
break;
|
|
|
|
case XF86XK_MailForward:
|
|
|
|
key = QFK_MAILFORWARD;
|
|
|
|
break;
|
|
|
|
case XF86XK_Send:
|
|
|
|
key = QFK_SEND;
|
|
|
|
break;
|
|
|
|
case XF86XK_Save:
|
|
|
|
key = QFK_SAVE;
|
|
|
|
break;
|
|
|
|
case XK_KP_Equal:
|
|
|
|
key = QFK_KP_EQUALS;
|
|
|
|
break;
|
|
|
|
case XK_parenleft:
|
|
|
|
key = QFK_LEFTPAREN;
|
|
|
|
break;
|
|
|
|
case XK_parenright:
|
|
|
|
key = QFK_RIGHTPAREN;
|
|
|
|
break;
|
|
|
|
case XF86XK_Back:
|
|
|
|
key = QFK_BACK;
|
|
|
|
break;
|
|
|
|
case XF86XK_Forward:
|
|
|
|
key = QFK_FORWARD;
|
|
|
|
break;
|
2009-03-18 00:26:34 +00:00
|
|
|
|
2001-04-15 04:18:22 +00:00
|
|
|
default:
|
2002-08-21 00:04:35 +00:00
|
|
|
if (keysym < 128) { // ASCII keys
|
2001-04-15 04:18:22 +00:00
|
|
|
key = keysym;
|
2001-08-16 16:41:40 +00:00
|
|
|
if ((key >= 'A') && (key <= 'Z')) {
|
2001-04-15 04:18:22 +00:00
|
|
|
key = key + ('a' - 'A');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
2001-08-16 16:41:40 +00:00
|
|
|
*k = key;
|
|
|
|
*u = unicode;
|
2001-04-15 04:18:22 +00:00
|
|
|
}
|
|
|
|
|
2013-01-14 03:53:42 +00:00
|
|
|
static void
|
2013-01-16 04:18:54 +00:00
|
|
|
x11_keydest_callback (keydest_t key_dest)
|
2013-01-14 03:53:42 +00:00
|
|
|
{
|
2021-01-30 05:49:42 +00:00
|
|
|
// if (key_dest == key_game) {
|
|
|
|
// XAutoRepeatOff (x_disp);
|
|
|
|
// } else {
|
|
|
|
// XAutoRepeatOn (x_disp);
|
|
|
|
// }
|
2013-01-14 03:53:42 +00:00
|
|
|
}
|
|
|
|
|
2001-04-15 04:18:22 +00:00
|
|
|
static void
|
2002-01-08 20:07:19 +00:00
|
|
|
event_key (XEvent *event)
|
2001-04-15 04:18:22 +00:00
|
|
|
{
|
2001-08-16 16:41:40 +00:00
|
|
|
int key, unicode;
|
2002-01-08 20:07:19 +00:00
|
|
|
|
|
|
|
x_time = event->xkey.time;
|
2001-08-16 16:41:40 +00:00
|
|
|
XLateKey (&event->xkey, &key, &unicode);
|
|
|
|
Key_Event (key, unicode, event->type == KeyPress);
|
2001-04-15 04:18:22 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2002-01-08 20:07:19 +00:00
|
|
|
event_button (XEvent *event)
|
2001-04-15 04:18:22 +00:00
|
|
|
{
|
2012-07-02 07:33:57 +00:00
|
|
|
unsigned but;
|
2001-04-15 04:18:22 +00:00
|
|
|
|
2002-01-08 20:07:19 +00:00
|
|
|
x_time = event->xbutton.time;
|
|
|
|
|
2001-04-15 04:18:22 +00:00
|
|
|
but = event->xbutton.button;
|
2012-07-02 07:33:57 +00:00
|
|
|
if (but > 32)
|
|
|
|
return;
|
2001-04-15 04:18:22 +00:00
|
|
|
if (but == 2)
|
|
|
|
but = 3;
|
|
|
|
else if (but == 3)
|
|
|
|
but = 2;
|
|
|
|
switch (but) {
|
2012-07-02 07:33:57 +00:00
|
|
|
default:
|
2001-10-28 04:23:37 +00:00
|
|
|
Key_Event (QFM_BUTTON1 + but - 1, 0, event->type == ButtonPress);
|
2001-04-15 04:18:22 +00:00
|
|
|
break;
|
|
|
|
case 4:
|
2001-10-28 04:23:37 +00:00
|
|
|
Key_Event (QFM_WHEEL_UP, 0, event->type == ButtonPress);
|
2001-04-15 04:18:22 +00:00
|
|
|
break;
|
|
|
|
case 5:
|
2001-10-28 04:23:37 +00:00
|
|
|
Key_Event (QFM_WHEEL_DOWN, 0, event->type == ButtonPress);
|
2001-04-15 04:18:22 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2001-07-05 20:18:23 +00:00
|
|
|
static void
|
2002-01-08 20:07:19 +00:00
|
|
|
event_focusout (XEvent *event)
|
2001-07-05 20:18:23 +00:00
|
|
|
{
|
2013-01-16 04:18:54 +00:00
|
|
|
Key_FocusEvent (0);
|
2005-03-06 08:22:15 +00:00
|
|
|
if (x_have_focus) {
|
|
|
|
x_have_focus = false;
|
|
|
|
if (in_snd_block->int_val) {
|
|
|
|
S_BlockSound ();
|
|
|
|
CDAudio_Pause ();
|
|
|
|
}
|
|
|
|
X11_RestoreGamma ();
|
2001-07-05 20:35:42 +00:00
|
|
|
}
|
2001-07-05 20:18:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2002-01-08 20:07:19 +00:00
|
|
|
event_focusin (XEvent *event)
|
2001-07-05 20:18:23 +00:00
|
|
|
{
|
2003-02-13 18:24:30 +00:00
|
|
|
x_have_focus = true;
|
2013-01-16 04:18:54 +00:00
|
|
|
Key_FocusEvent (1);
|
2002-08-21 01:40:21 +00:00
|
|
|
if (in_snd_block->int_val) {
|
|
|
|
S_UnblockSound ();
|
|
|
|
CDAudio_Resume ();
|
|
|
|
}
|
2003-02-13 18:24:30 +00:00
|
|
|
VID_UpdateGamma (vid_gamma);
|
2001-07-05 20:18:23 +00:00
|
|
|
}
|
2001-04-15 04:18:22 +00:00
|
|
|
|
|
|
|
static void
|
|
|
|
center_pointer (void)
|
|
|
|
{
|
2020-03-08 12:30:08 +00:00
|
|
|
XEvent event = {};
|
2001-04-15 04:18:22 +00:00
|
|
|
|
|
|
|
event.type = MotionNotify;
|
|
|
|
event.xmotion.display = x_disp;
|
|
|
|
event.xmotion.window = x_win;
|
2012-02-14 10:47:02 +00:00
|
|
|
event.xmotion.x = viddef.width / 2;
|
|
|
|
event.xmotion.y = viddef.height / 2;
|
2001-04-15 04:18:22 +00:00
|
|
|
XSendEvent (x_disp, x_win, False, PointerMotionMask, &event);
|
|
|
|
XWarpPointer (x_disp, None, x_win, 0, 0, 0, 0,
|
2012-02-14 10:47:02 +00:00
|
|
|
viddef.width / 2, viddef.height / 2);
|
2001-04-15 04:18:22 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2002-01-08 20:07:19 +00:00
|
|
|
event_motion (XEvent *event)
|
2001-04-15 04:18:22 +00:00
|
|
|
{
|
2002-01-08 20:07:19 +00:00
|
|
|
x_time = event->xmotion.time;
|
2004-03-21 05:21:27 +00:00
|
|
|
if (x_time <= x_mouse_time) {
|
|
|
|
p_mouse_x = event->xmotion.x;
|
|
|
|
p_mouse_y = event->xmotion.y;
|
|
|
|
return;
|
|
|
|
}
|
2002-01-08 20:07:19 +00:00
|
|
|
|
2001-04-15 04:18:22 +00:00
|
|
|
if (dga_active) {
|
2001-08-06 05:01:31 +00:00
|
|
|
in_mouse_x += event->xmotion.x_root;
|
|
|
|
in_mouse_y += event->xmotion.y_root;
|
2001-04-15 04:18:22 +00:00
|
|
|
} else {
|
2010-11-27 00:25:29 +00:00
|
|
|
if (vid_fullscreen->int_val || input_grabbed) {
|
2001-04-15 04:18:22 +00:00
|
|
|
if (!event->xmotion.send_event) {
|
2013-01-24 02:25:30 +00:00
|
|
|
unsigned dist_x = abs (viddef.width / 2 - event->xmotion.x);
|
|
|
|
unsigned dist_y = abs (viddef.height / 2 - event->xmotion.y);
|
2001-04-15 07:18:04 +00:00
|
|
|
in_mouse_x += (event->xmotion.x - p_mouse_x);
|
|
|
|
in_mouse_y += (event->xmotion.y - p_mouse_y);
|
2012-02-14 10:47:02 +00:00
|
|
|
if (dist_x > viddef.width / 4 || dist_y > viddef.height / 4) {
|
2001-04-15 04:18:22 +00:00
|
|
|
center_pointer ();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else {
|
2001-04-15 07:18:04 +00:00
|
|
|
in_mouse_x += (event->xmotion.x - p_mouse_x);
|
|
|
|
in_mouse_y += (event->xmotion.y - p_mouse_y);
|
2001-04-15 04:18:22 +00:00
|
|
|
}
|
|
|
|
p_mouse_x = event->xmotion.x;
|
|
|
|
p_mouse_y = event->xmotion.y;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2003-03-07 22:30:15 +00:00
|
|
|
static void
|
|
|
|
grab_error (int code, const char *device)
|
|
|
|
{
|
|
|
|
const char *reason;
|
|
|
|
|
|
|
|
switch (code) {
|
|
|
|
case AlreadyGrabbed:
|
|
|
|
reason = "already grabbed";
|
|
|
|
break;
|
|
|
|
case GrabNotViewable:
|
|
|
|
reason = "grab not viewable";
|
|
|
|
break;
|
|
|
|
case GrabFrozen:
|
|
|
|
reason = "grab frozen";
|
|
|
|
break;
|
|
|
|
case GrabInvalidTime:
|
|
|
|
reason = "grab invalid time";
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
reason = "unknown reason";
|
|
|
|
break;
|
|
|
|
}
|
2007-11-06 10:17:14 +00:00
|
|
|
Sys_Printf ("failed to grab %s: %s\n", device, reason);
|
2003-03-07 22:30:15 +00:00
|
|
|
}
|
|
|
|
|
2003-03-07 03:55:51 +00:00
|
|
|
void
|
|
|
|
IN_LL_Grab_Input (int grab)
|
2001-08-30 20:04:13 +00:00
|
|
|
{
|
2001-09-05 03:14:41 +00:00
|
|
|
if (!x_disp || !x_win)
|
2003-03-07 03:55:51 +00:00
|
|
|
return;
|
|
|
|
|
|
|
|
if (vid_fullscreen)
|
|
|
|
grab = grab || vid_fullscreen->int_val;
|
|
|
|
|
|
|
|
if ((input_grabbed && grab) || (!input_grabbed && !grab))
|
|
|
|
return;
|
|
|
|
|
2003-03-07 22:30:15 +00:00
|
|
|
if (grab) {
|
|
|
|
int ret;
|
|
|
|
|
2004-03-21 00:34:24 +00:00
|
|
|
ret = XGrabPointer (x_disp, x_win, True, X11_MOUSE_MASK, GrabModeAsync,
|
2003-03-07 22:30:15 +00:00
|
|
|
GrabModeAsync, x_win, None, CurrentTime);
|
|
|
|
if (ret != GrabSuccess) {
|
|
|
|
grab_error (ret, "mouse");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
ret = XGrabKeyboard (x_disp, x_win, 1, GrabModeAsync, GrabModeAsync,
|
|
|
|
CurrentTime);
|
|
|
|
if (ret != GrabSuccess) {
|
|
|
|
XUngrabPointer (x_disp, CurrentTime);
|
|
|
|
grab_error (ret, "keyboard");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
input_grabbed = 1;
|
2010-11-27 00:25:29 +00:00
|
|
|
in_dga_f (in_dga);
|
2003-03-07 22:30:15 +00:00
|
|
|
} else {
|
|
|
|
XUngrabPointer (x_disp, CurrentTime);
|
|
|
|
XUngrabKeyboard (x_disp, CurrentTime);
|
|
|
|
input_grabbed = 0;
|
2010-11-27 00:25:29 +00:00
|
|
|
in_dga_f (in_dga);
|
2003-03-07 03:55:51 +00:00
|
|
|
}
|
2001-04-15 04:18:22 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2003-04-08 18:45:12 +00:00
|
|
|
IN_LL_ProcessEvents (void)
|
2001-04-15 04:18:22 +00:00
|
|
|
{
|
2002-08-21 05:59:00 +00:00
|
|
|
X11_ProcessEvents (); // Get events from X server.
|
2001-04-15 04:18:22 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2001-04-15 07:18:04 +00:00
|
|
|
IN_LL_Shutdown (void)
|
2001-04-15 04:18:22 +00:00
|
|
|
{
|
2010-11-26 23:48:00 +00:00
|
|
|
Sys_MaskPrintf (SYS_VID, "IN_LL_Shutdown\n");
|
2001-04-15 07:18:04 +00:00
|
|
|
in_mouse_avail = 0;
|
2001-04-15 04:18:22 +00:00
|
|
|
if (x_disp) {
|
2021-01-30 05:49:42 +00:00
|
|
|
// XAutoRepeatOn (x_disp);
|
2001-08-30 20:32:27 +00:00
|
|
|
dga_off ();
|
2001-04-15 04:18:22 +00:00
|
|
|
}
|
2004-02-14 07:53:49 +00:00
|
|
|
if (in_mouse_accel && !in_mouse_accel->int_val)
|
2004-03-19 20:24:26 +00:00
|
|
|
X11_RestoreMouseAcceleration ();
|
2001-04-15 04:18:22 +00:00
|
|
|
X11_CloseDisplay ();
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2001-04-15 07:18:04 +00:00
|
|
|
IN_LL_Init (void)
|
2001-04-15 04:18:22 +00:00
|
|
|
{
|
|
|
|
// open the display
|
|
|
|
if (!x_disp)
|
2002-05-14 06:12:29 +00:00
|
|
|
Sys_Error ("IN: No display!!");
|
2001-04-15 04:18:22 +00:00
|
|
|
if (!x_win)
|
2002-05-14 06:12:29 +00:00
|
|
|
Sys_Error ("IN: No window!!");
|
2001-04-15 04:18:22 +00:00
|
|
|
|
|
|
|
X11_OpenDisplay (); // call to increment the reference counter
|
|
|
|
|
|
|
|
{
|
|
|
|
int attribmask = CWEventMask;
|
|
|
|
|
|
|
|
XWindowAttributes attribs_1;
|
|
|
|
XSetWindowAttributes attribs_2;
|
|
|
|
|
|
|
|
XGetWindowAttributes (x_disp, x_win, &attribs_1);
|
|
|
|
|
2004-03-21 00:34:24 +00:00
|
|
|
attribs_2.event_mask = attribs_1.your_event_mask | X11_INPUT_MASK;
|
2001-04-15 04:18:22 +00:00
|
|
|
|
|
|
|
XChangeWindowAttributes (x_disp, x_win, attribmask, &attribs_2);
|
|
|
|
}
|
|
|
|
|
|
|
|
X11_AddEvent (KeyPress, &event_key);
|
|
|
|
X11_AddEvent (KeyRelease, &event_key);
|
2001-07-05 20:18:23 +00:00
|
|
|
X11_AddEvent (FocusIn, &event_focusin);
|
|
|
|
X11_AddEvent (FocusOut, &event_focusout);
|
2002-01-08 19:33:42 +00:00
|
|
|
X11_AddEvent (SelectionNotify, &selection_notify);
|
2003-02-25 17:19:47 +00:00
|
|
|
X11_AddEvent (EnterNotify, &enter_notify);
|
2001-07-05 20:18:23 +00:00
|
|
|
|
|
|
|
if (!COM_CheckParm ("-nomouse")) {
|
|
|
|
dga_avail = VID_CheckDGA (x_disp, NULL, NULL, NULL);
|
2010-11-27 00:25:29 +00:00
|
|
|
Sys_MaskPrintf (SYS_VID, "VID_CheckDGA returned %d\n", dga_avail);
|
2001-07-05 20:18:23 +00:00
|
|
|
|
|
|
|
X11_AddEvent (ButtonPress, &event_button);
|
|
|
|
X11_AddEvent (ButtonRelease, &event_button);
|
|
|
|
X11_AddEvent (MotionNotify, &event_motion);
|
2001-07-06 00:17:09 +00:00
|
|
|
|
|
|
|
in_mouse_avail = 1;
|
2001-07-05 20:18:23 +00:00
|
|
|
}
|
2001-10-30 18:20:56 +00:00
|
|
|
|
2013-01-14 03:53:42 +00:00
|
|
|
Key_KeydestCallback (x11_keydest_callback);
|
|
|
|
|
2001-10-30 18:20:56 +00:00
|
|
|
Cmd_AddCommand ("in_paste_buffer", in_paste_buffer_f,
|
|
|
|
"Paste the contents of X's C&P buffer to the console");
|
2001-04-15 04:18:22 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2001-04-15 07:18:04 +00:00
|
|
|
IN_LL_Init_Cvars (void)
|
2001-04-15 04:18:22 +00:00
|
|
|
{
|
2002-08-21 00:04:35 +00:00
|
|
|
in_snd_block = Cvar_Get ("in_snd_block", "0", CVAR_ARCHIVE, NULL,
|
|
|
|
"block sound output on window focus loss");
|
2010-12-16 02:34:39 +00:00
|
|
|
in_dga = Cvar_Get ("in_dga", "0", CVAR_ARCHIVE, in_dga_f, //FIXME 0 until X fixed
|
2002-08-21 00:04:35 +00:00
|
|
|
"DGA Input support");
|
2003-09-04 22:29:40 +00:00
|
|
|
in_mouse_accel = Cvar_Get ("in_mouse_accel", "1", CVAR_ARCHIVE,
|
|
|
|
in_mouse_accel_f,
|
|
|
|
"set to 0 to remove mouse acceleration");
|
2001-04-15 04:18:22 +00:00
|
|
|
}
|
|
|
|
|
2001-04-17 15:55:33 +00:00
|
|
|
void
|
|
|
|
IN_LL_ClearStates (void)
|
|
|
|
{
|
|
|
|
}
|