mirror of
https://git.code.sf.net/p/quake/quakeforge-old
synced 2024-11-22 20:02:09 +00:00
Reverting away from modules in the main branch..
-3dfx, -x11, and -glx all work, at least for qw-client, no promices on uquake. I can't test any other targets at the moment, so....
This commit is contained in:
parent
6b9563b880
commit
0fae0e01d3
21 changed files with 359 additions and 954 deletions
|
@ -20,8 +20,7 @@ mandir := @mandir@
|
||||||
|
|
||||||
TARGET_DIR := $(PROJECT_ODIR)/targets
|
TARGET_DIR := $(PROJECT_ODIR)/targets
|
||||||
BUILD_DIR := $(TARGET_DIR)/common
|
BUILD_DIR := $(TARGET_DIR)/common
|
||||||
OBJ_PATTERN := $(BUILD_DIR)/sound_lib/%.o $(BUILD_DIR)/common_lib/%.o \
|
OBJ_PATTERN := $(BUILD_DIR)/sound_lib/%.o $(BUILD_DIR)/common_lib/%.o
|
||||||
$(BUILD_DIR)/input_libs/%.o
|
|
||||||
|
|
||||||
SOUND_LIB := sound_lib.a
|
SOUND_LIB := sound_lib.a
|
||||||
|
|
||||||
|
@ -61,15 +60,7 @@ else
|
||||||
OPTFLAGS = -g
|
OPTFLAGS = -g
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq ($(HAS_SVGA),yes)
|
lib_targets = $(SOUND_LIB) $(CD_LIB) $(COMMON_LIB)
|
||||||
IN_SVGALIB_LIB := in_svgalib.so
|
|
||||||
endif
|
|
||||||
|
|
||||||
ifeq ($(HAS_X11),yes)
|
|
||||||
IN_X11_LIB := in_x11.so
|
|
||||||
endif
|
|
||||||
|
|
||||||
lib_targets = $(SOUND_LIB) $(CD_LIB) $(COMMON_LIB) $(IN_SVGALIB_LIB) $(IN_X11_LIB)
|
|
||||||
targets = $(lib_targets)
|
targets = $(lib_targets)
|
||||||
CLEAN_TARGETS = $(patsubst %,clean-%, $(targets))
|
CLEAN_TARGETS = $(patsubst %,clean-%, $(targets))
|
||||||
.PHONY: $(targets) $(CLEAN_TARGETS)
|
.PHONY: $(targets) $(CLEAN_TARGETS)
|
||||||
|
@ -167,31 +158,6 @@ $(TARGET_DIR)/sound_lib.a: $(SOUND_LIB_OBJS)
|
||||||
ar cru $@ $(SOUND_LIB_OBJS)
|
ar cru $@ $(SOUND_LIB_OBJS)
|
||||||
@RANLIB@ $@
|
@RANLIB@ $@
|
||||||
|
|
||||||
# Input lib targets..
|
|
||||||
|
|
||||||
in_input_DIR:
|
|
||||||
@DIR=input_libs; $(MAKE_SURE_DIR)
|
|
||||||
|
|
||||||
ifneq ($(IN_SVGALIB_LIB),)
|
|
||||||
|
|
||||||
IN_SVGALIB_OBJS = $(BUILD_DIR)/input_libs/in_svgalib.@OBJEXT@
|
|
||||||
|
|
||||||
$(IN_SVGALIB_LIB): in_input_DIR $(TARGET_DIR)/$(IN_SVGALIB_LIB)
|
|
||||||
|
|
||||||
$(TARGET_DIR)/$(IN_SVGALIB_LIB): $(IN_SVGALIB_OBJS)
|
|
||||||
$(CC) $(CFLAGS) $(LDFLAGS) @SHARED@ -o $@ @USE_SHARED_LIBS@ $(IN_SVGALIB_OBJS)
|
|
||||||
endif
|
|
||||||
|
|
||||||
ifneq ($(IN_X11_LIB),)
|
|
||||||
|
|
||||||
IN_X11_OBJS = $(BUILD_DIR)/input_libs/in_x11.@OBJEXT@
|
|
||||||
|
|
||||||
$(IN_X11_LIB): in_input_DIR $(TARGET_DIR)/$(IN_X11_LIB)
|
|
||||||
|
|
||||||
$(TARGET_DIR)/$(IN_X11_LIB): $(IN_X11_OBJS)
|
|
||||||
$(CC) $(CFLAGS) $(LDFLAGS) @SHARED@ @USE_SHARED_LIBS@ -o $@ $(IN_X11_OBJS)
|
|
||||||
endif
|
|
||||||
|
|
||||||
###########################################################################
|
###########################################################################
|
||||||
#
|
#
|
||||||
# Misc targets
|
# Misc targets
|
||||||
|
@ -206,10 +172,7 @@ $(CLEAN_TARGETS):
|
||||||
clean-sound_lib:
|
clean-sound_lib:
|
||||||
rm -f $(BUILD_DIR)/$(subst clean-,,$@)/*
|
rm -f $(BUILD_DIR)/$(subst clean-,,$@)/*
|
||||||
|
|
||||||
clean-input_libs:
|
clean: clean-sound_lib $(CLEAN_TARGETS)
|
||||||
rm -f $(BUILD_DIR)/$(subst clean-,,$@)/*
|
|
||||||
|
|
||||||
clean: clean-sound_lib clean-input_libs $(CLEAN_TARGETS)
|
|
||||||
-rmdir $(BUILD_DIR)
|
-rmdir $(BUILD_DIR)
|
||||||
|
|
||||||
install: $(targets)
|
install: $(targets)
|
||||||
|
|
|
@ -33,7 +33,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
#include <console.h>
|
#include <console.h>
|
||||||
#include <net.h>
|
#include <net.h>
|
||||||
#include <protocol.h>
|
#include <protocol.h>
|
||||||
#include <plugin.h>
|
#include <input.h>
|
||||||
|
|
||||||
cvar_t cl_nodelta = {"cl_nodelta","0"};
|
cvar_t cl_nodelta = {"cl_nodelta","0"};
|
||||||
|
|
||||||
|
@ -437,7 +437,7 @@ void CL_SendCmd (void)
|
||||||
CL_BaseMove (cmd);
|
CL_BaseMove (cmd);
|
||||||
|
|
||||||
// allow mice or other external controllers to add to the move
|
// allow mice or other external controllers to add to the move
|
||||||
IN->Move (cmd);
|
IN_Move (cmd);
|
||||||
|
|
||||||
// if we are spectator, try autocam
|
// if we are spectator, try autocam
|
||||||
if (cl.spectator)
|
if (cl.spectator)
|
||||||
|
|
|
@ -63,7 +63,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
#include <view.h>
|
#include <view.h>
|
||||||
#include <sbar.h>
|
#include <sbar.h>
|
||||||
#include <cdaudio.h>
|
#include <cdaudio.h>
|
||||||
#include <plugin.h>
|
#include <input.h>
|
||||||
|
|
||||||
#ifdef __sun
|
#ifdef __sun
|
||||||
/* Sun's model_t in sys/model.h conflicts w/ Quake's model_t */
|
/* Sun's model_t in sys/model.h conflicts w/ Quake's model_t */
|
||||||
|
@ -1401,7 +1401,7 @@ void CL_SendCmd (void)
|
||||||
|
|
||||||
// allow mice or other external controllers to add to the move
|
// allow mice or other external controllers to add to the move
|
||||||
//(*IN_Move) (&cmd);
|
//(*IN_Move) (&cmd);
|
||||||
IN->Move(&cmd);
|
IN_Move(&cmd);
|
||||||
|
|
||||||
// send the unreliable message
|
// send the unreliable message
|
||||||
CL_SendMove (&cmd);
|
CL_SendMove (&cmd);
|
||||||
|
|
|
@ -33,7 +33,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
#include <draw.h>
|
#include <draw.h>
|
||||||
#include <cmd.h>
|
#include <cmd.h>
|
||||||
#include <sys.h>
|
#include <sys.h>
|
||||||
#include <plugin.h>
|
#include <input.h>
|
||||||
|
|
||||||
int con_ormask;
|
int con_ormask;
|
||||||
console_t con_main;
|
console_t con_main;
|
||||||
|
@ -675,7 +675,7 @@ void Con_NotifyBox (char *text)
|
||||||
{
|
{
|
||||||
t1 = Sys_DoubleTime ();
|
t1 = Sys_DoubleTime ();
|
||||||
SCR_UpdateScreen ();
|
SCR_UpdateScreen ();
|
||||||
IN->SendKeyEvents ();
|
IN_SendKeyEvents ();
|
||||||
t2 = Sys_DoubleTime ();
|
t2 = Sys_DoubleTime ();
|
||||||
realtime += t2-t1; // make the cursor blink
|
realtime += t2-t1; // make the cursor blink
|
||||||
} while (key_count < 0);
|
} while (key_count < 0);
|
||||||
|
|
98
common/context_x11.c
Normal file
98
common/context_x11.c
Normal file
|
@ -0,0 +1,98 @@
|
||||||
|
/*
|
||||||
|
context_x11.c - general x11 context layer.
|
||||||
|
Copyright (C) 1996-1997 Id Software, Inc.
|
||||||
|
Copyright (C) 1999-2000 contributors of the QuakeForge project
|
||||||
|
Copyright (C) 2000 Zephaniah E. Hull <warp@whitestar.soark.net>
|
||||||
|
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 the Free Software
|
||||||
|
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <config.h>
|
||||||
|
|
||||||
|
#include <ctype.h>
|
||||||
|
#include <sys/time.h>
|
||||||
|
#include <sys/types.h>
|
||||||
|
#ifdef HAVE_UNISTD_H
|
||||||
|
#include <unistd.h>
|
||||||
|
#endif
|
||||||
|
#include <signal.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <sys/ipc.h>
|
||||||
|
#include <sys/shm.h>
|
||||||
|
#include <X11/Xlib.h>
|
||||||
|
#include <X11/Xutil.h>
|
||||||
|
#include <X11/Xatom.h>
|
||||||
|
#include <X11/keysym.h>
|
||||||
|
#include <X11/extensions/XShm.h>
|
||||||
|
#include <errno.h>
|
||||||
|
|
||||||
|
#include <context_x11.h>
|
||||||
|
#include <qtypes.h>
|
||||||
|
|
||||||
|
static void (*event_handlers[LASTEvent])(XEvent *);
|
||||||
|
qboolean oktodraw = false;
|
||||||
|
int x_shmeventtype;
|
||||||
|
|
||||||
|
qboolean x11_add_event(int event, void (*event_handler)(XEvent *))
|
||||||
|
{
|
||||||
|
if (event >= LASTEvent) {
|
||||||
|
printf("event: %d, LASTEvent: %d\n", event, LASTEvent);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (event_handlers[event] != NULL)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
event_handlers[event] = event_handler;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
qboolean x11_del_event(int event, void (*event_handler)(XEvent *))
|
||||||
|
{
|
||||||
|
if (event >= LASTEvent)
|
||||||
|
return false;
|
||||||
|
if (event_handlers[event] != event_handler)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
event_handlers[event] = NULL;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void x11_process_event(void)
|
||||||
|
{
|
||||||
|
XEvent x_event;
|
||||||
|
|
||||||
|
XNextEvent(x_disp, &x_event);
|
||||||
|
if (x_event.type >= LASTEvent) {
|
||||||
|
// FIXME: KLUGE!!!!!!
|
||||||
|
if (x_event.type == x_shmeventtype)
|
||||||
|
oktodraw = 1;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (event_handlers[x_event.type])
|
||||||
|
event_handlers[x_event.type](&x_event);
|
||||||
|
}
|
||||||
|
|
||||||
|
void x11_process_events(void)
|
||||||
|
{
|
||||||
|
/* Get events from X server. */
|
||||||
|
while (XPending(x_disp)) {
|
||||||
|
x11_process_event();
|
||||||
|
}
|
||||||
|
}
|
43
common/context_x11.h
Normal file
43
common/context_x11.h
Normal file
|
@ -0,0 +1,43 @@
|
||||||
|
/*
|
||||||
|
input.h
|
||||||
|
Copyright (C) 1996-1997 Id Software, Inc.
|
||||||
|
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 the Free Software
|
||||||
|
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef __CONTEXT_X11_H__
|
||||||
|
#define __CONTEXT_X11_H__
|
||||||
|
|
||||||
|
#include <qtypes.h>
|
||||||
|
#include <X11/Xlib.h>
|
||||||
|
|
||||||
|
void GetEvent();
|
||||||
|
|
||||||
|
extern Display *x_disp;
|
||||||
|
extern Window x_win;
|
||||||
|
extern qboolean doShm;
|
||||||
|
extern int x_shmeventtype;
|
||||||
|
extern qboolean oktodraw;
|
||||||
|
|
||||||
|
extern qboolean x11_add_event(int event, void (*event_handler)(XEvent *));
|
||||||
|
extern qboolean x11_del_event(int event, void (*event_handler)(XEvent *));
|
||||||
|
extern void x11_process_event(void);
|
||||||
|
extern void x11_process_events(void);
|
||||||
|
|
||||||
|
#endif // __CONTEXT_X11_H__
|
|
@ -71,44 +71,24 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
#define WARP_WIDTH 320
|
#define WARP_WIDTH 320
|
||||||
#define WARP_HEIGHT 200
|
#define WARP_HEIGHT 200
|
||||||
|
|
||||||
static Display *dpy = NULL;
|
Display *x_disp = NULL;
|
||||||
static int screen;
|
static int screen;
|
||||||
static Window win;
|
Window x_win;
|
||||||
static Cursor cursor = None;
|
|
||||||
static GLXContext ctx = NULL;
|
static GLXContext ctx = NULL;
|
||||||
|
|
||||||
#define KEY_MASK (KeyPressMask | KeyReleaseMask)
|
#define X_MASK (VisibilityChangeMask | StructureNotifyMask)
|
||||||
#define MOUSE_MASK (ButtonPressMask | ButtonReleaseMask | \
|
|
||||||
PointerMotionMask)
|
|
||||||
#define X_MASK (KEY_MASK | MOUSE_MASK | VisibilityChangeMask | \
|
|
||||||
StructureNotifyMask)
|
|
||||||
|
|
||||||
unsigned short d_8to16table[256];
|
unsigned short d_8to16table[256];
|
||||||
unsigned d_8to24table[256];
|
unsigned d_8to24table[256];
|
||||||
unsigned char d_15to8table[65536];
|
unsigned char d_15to8table[65536];
|
||||||
|
|
||||||
cvar_t _windowed_mouse = {"_windowed_mouse", "0", CVAR_ARCHIVE};
|
|
||||||
cvar_t m_filter = {"m_filter", "0"};
|
|
||||||
cvar_t vid_mode = {"vid_mode", "0", CVAR_NONE};
|
cvar_t vid_mode = {"vid_mode", "0", CVAR_NONE};
|
||||||
cvar_t vid_glx_fullscreen = {"vid_glx_fullscreen", "0", CVAR_NONE};
|
cvar_t vid_glx_fullscreen = {"vid_glx_fullscreen", "0", CVAR_NONE};
|
||||||
|
|
||||||
static int fullscreen = 0;
|
|
||||||
|
|
||||||
static float mouse_x, mouse_y;
|
|
||||||
static float old_mouse_x, old_mouse_y;
|
|
||||||
static int mouse_grabbed = 0;
|
|
||||||
#define mouse_shouldgrab ((int)vid_glx_fullscreen.value ||(int)_windowed_mouse.value)
|
|
||||||
|
|
||||||
#ifdef HAS_DGA
|
#ifdef HAS_DGA
|
||||||
static int nummodes;
|
static int nummodes;
|
||||||
static XF86VidModeModeInfo **vidmodes;
|
static XF86VidModeModeInfo **vidmodes;
|
||||||
static int hasdgavideo = 0, hasvidmode = 0;
|
static int hasdgavideo = 0, hasvidmode = 0;
|
||||||
static int dgamouse = 0;
|
|
||||||
static cvar_t vid_dga_mouseaccel = {"vid_dga_mouseaccel", "1", CVAR_ARCHIVE};
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef XMESA
|
|
||||||
static int xmesafullscreen = 0;
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_DLOPEN
|
#ifdef HAVE_DLOPEN
|
||||||
|
@ -158,162 +138,12 @@ void D_EndDirectRect (int x, int y, int width, int height)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void
|
|
||||||
blank_cursor(void)
|
|
||||||
{
|
|
||||||
Pixmap blank;
|
|
||||||
XColor dummy;
|
|
||||||
char data[1] = {0};
|
|
||||||
|
|
||||||
blank = XCreateBitmapFromData(dpy, win, data, 1, 1);
|
|
||||||
if (blank == None) {
|
|
||||||
fprintf(stderr,"Could not create cursor: Out of memory.\n");
|
|
||||||
} else {
|
|
||||||
cursor = XCreatePixmapCursor(dpy, blank, blank,
|
|
||||||
&dummy, &dummy, 0, 0);
|
|
||||||
XFreePixmap(dpy, blank);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static void
|
|
||||||
do_grabs(int grab)
|
|
||||||
{
|
|
||||||
if (grab == mouse_grabbed) return;
|
|
||||||
|
|
||||||
if (grab) {
|
|
||||||
/*
|
|
||||||
Grab mouse
|
|
||||||
*/
|
|
||||||
if (cursor == None) {
|
|
||||||
blank_cursor();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (XGrabPointer(dpy, win, True, 0, GrabModeAsync,
|
|
||||||
GrabModeAsync, win, cursor, CurrentTime)
|
|
||||||
!= GrabSuccess) {
|
|
||||||
Con_Printf("Unable to grab pointer\n");
|
|
||||||
Cvar_SetValue("vid_glx_fullscreen", 0);
|
|
||||||
Cvar_SetValue("_windowed_mouse", 0);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* We can live with this failing. */
|
|
||||||
XGrabKeyboard(dpy, win, False, GrabModeAsync, GrabModeAsync,
|
|
||||||
CurrentTime);
|
|
||||||
|
|
||||||
#ifdef HAS_DGA
|
|
||||||
if (hasdga) {
|
|
||||||
XF86DGADirectVideo(dpy, screen, XF86DGADirectMouse);
|
|
||||||
dgamouse = 1;
|
|
||||||
} else
|
|
||||||
#endif
|
|
||||||
{
|
|
||||||
XWarpPointer(dpy, None, win, 0, 0, 0, 0,
|
|
||||||
vid.width / 2, vid.height / 2);
|
|
||||||
}
|
|
||||||
mouse_grabbed = 1;
|
|
||||||
} else {
|
|
||||||
/*
|
|
||||||
Release grab
|
|
||||||
*/
|
|
||||||
#ifdef HAS_DGA
|
|
||||||
if (dgamouse) {
|
|
||||||
XF86DGADirectVideo(dpy, screen, 0);
|
|
||||||
dgamouse = 0;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
XUngrabKeyboard(dpy, CurrentTime);
|
|
||||||
XUngrabPointer(dpy, CurrentTime);
|
|
||||||
mouse_grabbed = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static void
|
|
||||||
do_fullscreen(int full)
|
|
||||||
{
|
|
||||||
if (full == fullscreen) return;
|
|
||||||
|
|
||||||
#ifdef XMESA
|
|
||||||
if (QF_XMesaSetFXmode) {
|
|
||||||
if (QF_XMesaSetFXmode(full ? XMESA_FX_FULLSCREEN
|
|
||||||
: XMESA_FX_WINDOW)) {
|
|
||||||
fullscreen = full;
|
|
||||||
xmesafullscreen = full;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (xmesafullscreen) {
|
|
||||||
/* We are in XMesa fullscren mode and couldn't switch
|
|
||||||
back to windowed mode ??? */
|
|
||||||
Cvar_SetValue("vid_glx_fullscreen", fullscreen);
|
|
||||||
do_grabs(mouse_shouldgrab);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
#ifdef HAS_DGA
|
|
||||||
if (hasdga && hasvidmode) {
|
|
||||||
static int prev_x = 0, prev_y = 0, prev_w = 640, prev_h = 480;
|
|
||||||
|
|
||||||
if (full) {
|
|
||||||
Window dumwin;
|
|
||||||
unsigned int dummy, i, curw = 65535, curh = 65535;
|
|
||||||
int curmode = -1;
|
|
||||||
|
|
||||||
XGetGeometry(dpy, win, &dumwin, &prev_x, &prev_y,
|
|
||||||
&prev_w, &prev_h, &dummy, &dummy);
|
|
||||||
|
|
||||||
for (i = 0; i < nummodes; i++) {
|
|
||||||
if (vidmodes[i]->hdisplay == scr_width &&
|
|
||||||
vidmodes[i]->vdisplay == scr_height) {
|
|
||||||
curmode = i;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
if (vidmodes[i]->hdisplay
|
|
||||||
>= (scr_width - 10) &&
|
|
||||||
vidmodes[i]->vdisplay
|
|
||||||
>= (scr_height - 10) &&
|
|
||||||
vidmodes[i]->hdisplay <= curw &&
|
|
||||||
vidmodes[i]->vdisplay <= curh) {
|
|
||||||
curw = vidmodes[i]->hdisplay;
|
|
||||||
curh = vidmodes[i]->vdisplay;
|
|
||||||
curmode = i;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (curmode >= 0 &&
|
|
||||||
XF86VidModeSwitchToMode(dpy,
|
|
||||||
screen, vidmodes[curmode])) {
|
|
||||||
XSync(dpy, 0);
|
|
||||||
XF86VidModeSetViewPort(dpy, screen, 0, 0);
|
|
||||||
XMoveResizeWindow(dpy, win, 0, 0,
|
|
||||||
vidmodes[curmode]->hdisplay,
|
|
||||||
vidmodes[curmode]->vdisplay);
|
|
||||||
fullscreen = full;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
XF86VidModeSwitchToMode(dpy, screen, vidmodes[0]);
|
|
||||||
XSync(dpy, 0);
|
|
||||||
XMoveResizeWindow(dpy, win, prev_x, prev_y,
|
|
||||||
prev_w, prev_h);
|
|
||||||
fullscreen = full;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
/* Failed to change anything */
|
|
||||||
Cvar_SetValue("vid_glx_fullscreen", fullscreen);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
VID_Shutdown(void)
|
VID_Shutdown(void)
|
||||||
{
|
{
|
||||||
if (!ctx) return;
|
if (!ctx) return;
|
||||||
|
|
||||||
glXDestroyContext(dpy, ctx);
|
glXDestroyContext(x_disp, ctx);
|
||||||
ctx = NULL;
|
ctx = NULL;
|
||||||
#ifdef HAS_DGA
|
#ifdef HAS_DGA
|
||||||
if (hasvidmode) {
|
if (hasvidmode) {
|
||||||
|
@ -332,8 +162,8 @@ VID_Shutdown(void)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
XCloseDisplay(dpy);
|
XCloseDisplay(x_disp);
|
||||||
dpy = NULL;
|
x_disp = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -514,7 +344,7 @@ void GL_BeginRendering (int *x, int *y, int *width, int *height)
|
||||||
void GL_EndRendering (void)
|
void GL_EndRendering (void)
|
||||||
{
|
{
|
||||||
glFlush();
|
glFlush();
|
||||||
glXSwapBuffers(dpy, win);
|
glXSwapBuffers(x_disp, x_win);
|
||||||
}
|
}
|
||||||
|
|
||||||
qboolean VID_Is8bit(void)
|
qboolean VID_Is8bit(void)
|
||||||
|
@ -580,9 +410,6 @@ void VID_Init(unsigned char *palette)
|
||||||
Cvar_RegisterVariable(&gl_ztrick);
|
Cvar_RegisterVariable(&gl_ztrick);
|
||||||
Cvar_RegisterVariable(&_windowed_mouse);
|
Cvar_RegisterVariable(&_windowed_mouse);
|
||||||
Cvar_RegisterVariable(&vid_glx_fullscreen);
|
Cvar_RegisterVariable(&vid_glx_fullscreen);
|
||||||
#ifdef HAS_DGA
|
|
||||||
Cvar_RegisterVariable(&vid_dga_mouseaccel);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
vid.maxwarpwidth = WARP_WIDTH;
|
vid.maxwarpwidth = WARP_WIDTH;
|
||||||
vid.maxwarpheight = WARP_HEIGHT;
|
vid.maxwarpheight = WARP_HEIGHT;
|
||||||
|
@ -613,16 +440,16 @@ void VID_Init(unsigned char *palette)
|
||||||
if ( i != 0 ) // Set console height, but no smaller than 200 px
|
if ( i != 0 ) // Set console height, but no smaller than 200 px
|
||||||
vid.conheight = min(Q_atoi(com_argv[i+1]), 200);
|
vid.conheight = min(Q_atoi(com_argv[i+1]), 200);
|
||||||
|
|
||||||
dpy = XOpenDisplay(NULL);
|
x_disp = XOpenDisplay(NULL);
|
||||||
if ( !dpy ) {
|
if ( !x_disp ) {
|
||||||
fprintf(stderr, "Error couldn't open the X display\n");
|
fprintf(stderr, "Error couldn't open the X display\n");
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
screen = DefaultScreen(dpy);
|
screen = DefaultScreen(x_disp);
|
||||||
root = RootWindow(dpy, screen);
|
root = RootWindow(x_disp, screen);
|
||||||
|
|
||||||
visinfo = glXChooseVisual(dpy, screen, attrib);
|
visinfo = glXChooseVisual(x_disp, screen, attrib);
|
||||||
if (!visinfo) {
|
if (!visinfo) {
|
||||||
fprintf(stderr, "Error couldn't get an RGB, Double-buffered, Depth visual\n");
|
fprintf(stderr, "Error couldn't get an RGB, Double-buffered, Depth visual\n");
|
||||||
exit(1);
|
exit(1);
|
||||||
|
@ -632,14 +459,14 @@ void VID_Init(unsigned char *palette)
|
||||||
{
|
{
|
||||||
int maj_ver;
|
int maj_ver;
|
||||||
|
|
||||||
hasdga = VID_CheckDGA(dpy, &maj_ver, NULL, &hasdgavideo);
|
hasdga = VID_CheckDGA(x_disp, &maj_ver, NULL, &hasdgavideo);
|
||||||
if (!hasdga || maj_ver < 1) {
|
if (!hasdga || maj_ver < 1) {
|
||||||
hasdga = hasdgavideo = 0;
|
hasdga = hasdgavideo = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
hasvidmode = VID_CheckVMode(dpy, NULL, NULL);
|
hasvidmode = VID_CheckVMode(x_disp, NULL, NULL);
|
||||||
if (hasvidmode) {
|
if (hasvidmode) {
|
||||||
if (! XF86VidModeGetAllModeLines(dpy, DefaultScreen(dpy),
|
if (! XF86VidModeGetAllModeLines(x_disp, DefaultScreen(x_disp),
|
||||||
&nummodes, &vidmodes)
|
&nummodes, &vidmodes)
|
||||||
|| nummodes <= 0) {
|
|| nummodes <= 0) {
|
||||||
hasvidmode = 0;
|
hasvidmode = 0;
|
||||||
|
@ -651,8 +478,7 @@ void VID_Init(unsigned char *palette)
|
||||||
if (dlhand) {
|
if (dlhand) {
|
||||||
QF_XMesaSetFXmode = dlsym(dlhand, "XMesaSetFXmode");
|
QF_XMesaSetFXmode = dlsym(dlhand, "XMesaSetFXmode");
|
||||||
if (!QF_XMesaSetFXmode) {
|
if (!QF_XMesaSetFXmode) {
|
||||||
QF_XMesaSetFXmode = dlsym(dlhand,
|
QF_XMesaSetFXmode = dlsym(dlhand, "_XMesaSetFXmode");
|
||||||
"_XMesaSetFXmode");
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
QF_XMesaSetFXmode = NULL;
|
QF_XMesaSetFXmode = NULL;
|
||||||
|
@ -681,20 +507,20 @@ void VID_Init(unsigned char *palette)
|
||||||
/* window attributes */
|
/* window attributes */
|
||||||
attr.background_pixel = 0;
|
attr.background_pixel = 0;
|
||||||
attr.border_pixel = 0;
|
attr.border_pixel = 0;
|
||||||
attr.colormap = XCreateColormap(dpy, root, visinfo->visual, AllocNone);
|
attr.colormap = XCreateColormap(x_disp, root, visinfo->visual, AllocNone);
|
||||||
attr.event_mask = X_MASK;
|
attr.event_mask = X_MASK;
|
||||||
mask = CWBackPixel | CWBorderPixel | CWColormap | CWEventMask;
|
mask = CWBackPixel | CWBorderPixel | CWColormap | CWEventMask;
|
||||||
|
|
||||||
win = XCreateWindow(dpy, root, 0, 0, width, height,
|
x_win = XCreateWindow(x_disp, root, 0, 0, width, height,
|
||||||
0, visinfo->depth, InputOutput,
|
0, visinfo->depth, InputOutput,
|
||||||
visinfo->visual, mask, &attr);
|
visinfo->visual, mask, &attr);
|
||||||
XMapWindow(dpy, win);
|
XMapWindow(x_disp, x_win);
|
||||||
|
|
||||||
XSync(dpy, 0);
|
XSync(x_disp, 0);
|
||||||
|
|
||||||
ctx = glXCreateContext(dpy, visinfo, NULL, True);
|
ctx = glXCreateContext(x_disp, visinfo, NULL, True);
|
||||||
|
|
||||||
glXMakeCurrent(dpy, win, ctx);
|
glXMakeCurrent(x_disp, x_win, ctx);
|
||||||
|
|
||||||
scr_width = width;
|
scr_width = width;
|
||||||
scr_height = height;
|
scr_height = height;
|
||||||
|
@ -724,357 +550,4 @@ void VID_Init(unsigned char *palette)
|
||||||
Con_SafePrintf ("Video mode %dx%d initialized.\n", width, height);
|
Con_SafePrintf ("Video mode %dx%d initialized.\n", width, height);
|
||||||
|
|
||||||
vid.recalc_refdef = 1; // force a surface cache flush
|
vid.recalc_refdef = 1; // force a surface cache flush
|
||||||
|
|
||||||
do_grabs(mouse_shouldgrab);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static int
|
|
||||||
XLateKey(XKeyEvent *ev)
|
|
||||||
{
|
|
||||||
int key = 0;
|
|
||||||
char buf[64];
|
|
||||||
KeySym keysym;
|
|
||||||
|
|
||||||
XLookupString(ev, buf, sizeof(buf), &keysym, 0);
|
|
||||||
|
|
||||||
switch(keysym) {
|
|
||||||
case XK_KP_Page_Up: key = KP_PGUP; break;
|
|
||||||
case XK_Page_Up: key = K_PGUP; break;
|
|
||||||
|
|
||||||
case XK_KP_Page_Down: key = KP_PGDN; break;
|
|
||||||
case XK_Page_Down: key = K_PGDN; break;
|
|
||||||
|
|
||||||
case XK_KP_Home: key = KP_HOME; break;
|
|
||||||
case XK_Home: key = K_HOME; break;
|
|
||||||
|
|
||||||
case XK_KP_End: key = KP_END; break;
|
|
||||||
case XK_End: key = K_END; break;
|
|
||||||
|
|
||||||
case XK_KP_Left: key = KP_LEFTARROW; break;
|
|
||||||
case XK_Left: key = K_LEFTARROW; break;
|
|
||||||
|
|
||||||
case XK_KP_Right: key = KP_RIGHTARROW; break;
|
|
||||||
case XK_Right: key = K_RIGHTARROW; break;
|
|
||||||
|
|
||||||
case XK_KP_Down: key = KP_DOWNARROW; break;
|
|
||||||
case XK_Down: key = K_DOWNARROW; break;
|
|
||||||
|
|
||||||
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: key = KP_ENTER; break;
|
|
||||||
case XK_Return: key = K_ENTER; break;
|
|
||||||
|
|
||||||
case XK_Tab: key = K_TAB; break;
|
|
||||||
|
|
||||||
case XK_F1: key = K_F1; break;
|
|
||||||
case XK_F2: key = K_F2; break;
|
|
||||||
case XK_F3: key = K_F3; break;
|
|
||||||
case XK_F4: key = K_F4; break;
|
|
||||||
case XK_F5: key = K_F5; break;
|
|
||||||
case XK_F6: key = K_F6; break;
|
|
||||||
case XK_F7: key = K_F7; break;
|
|
||||||
case XK_F8: key = K_F8; break;
|
|
||||||
case XK_F9: key = K_F9; break;
|
|
||||||
case XK_F10: key = K_F10; break;
|
|
||||||
case XK_F11: key = K_F11; break;
|
|
||||||
case XK_F12: key = K_F12; break;
|
|
||||||
|
|
||||||
case XK_BackSpace: key = K_BACKSPACE; break;
|
|
||||||
|
|
||||||
case XK_KP_Delete: key = KP_DEL; break;
|
|
||||||
case XK_Delete: key = K_DEL; break;
|
|
||||||
|
|
||||||
case XK_Pause: key = K_PAUSE; break;
|
|
||||||
|
|
||||||
case XK_Shift_L:
|
|
||||||
case XK_Shift_R: key = K_SHIFT; break;
|
|
||||||
|
|
||||||
case XK_Execute:
|
|
||||||
case XK_Control_L:
|
|
||||||
case XK_Control_R: key = K_CTRL; break;
|
|
||||||
|
|
||||||
case XK_Mode_switch:
|
|
||||||
case XK_Alt_L:
|
|
||||||
case XK_Meta_L:
|
|
||||||
case XK_Alt_R:
|
|
||||||
case XK_Meta_R: key = K_ALT; break;
|
|
||||||
|
|
||||||
case XK_KP_Begin: key = K_AUX30; break;
|
|
||||||
|
|
||||||
case XK_Insert: key = K_INS; break;
|
|
||||||
case XK_KP_Insert: key = KP_INS; 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;
|
|
||||||
|
|
||||||
/* For Sun keyboards */
|
|
||||||
case XK_F27: key = K_HOME; break;
|
|
||||||
case XK_F29: key = K_PGUP; break;
|
|
||||||
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:
|
|
||||||
key = *(unsigned char*)buf;
|
|
||||||
if (key >= 'A' && key <= 'Z') {
|
|
||||||
key = key + ('a' - 'A');
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
return key;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static void
|
|
||||||
GetEvent(void)
|
|
||||||
{
|
|
||||||
XEvent x_event;
|
|
||||||
int but;
|
|
||||||
|
|
||||||
if (!dpy) return;
|
|
||||||
|
|
||||||
XNextEvent(dpy, &x_event);
|
|
||||||
|
|
||||||
switch (x_event.type) {
|
|
||||||
case KeyPress:
|
|
||||||
case KeyRelease:
|
|
||||||
Key_Event(XLateKey(&x_event.xkey), x_event.type == KeyPress);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case ButtonPress:
|
|
||||||
but = x_event.xbutton.button;
|
|
||||||
if (but == 2) but = 3;
|
|
||||||
else if (but == 3) but = 2;
|
|
||||||
switch(but) {
|
|
||||||
case 1:
|
|
||||||
case 2:
|
|
||||||
case 3:
|
|
||||||
Key_Event(K_MOUSE1 + but - 1, true);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case ButtonRelease:
|
|
||||||
but = x_event.xbutton.button;
|
|
||||||
if (but == 2) but = 3;
|
|
||||||
else if (but == 3) but = 2;
|
|
||||||
switch(but) {
|
|
||||||
case 1:
|
|
||||||
case 2:
|
|
||||||
case 3:
|
|
||||||
Key_Event(K_MOUSE1 + but - 1, false);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case MotionNotify:
|
|
||||||
#ifdef HAS_DGA
|
|
||||||
if (dgamouse) {
|
|
||||||
mouse_x += (float)x_event.xmotion.x_root
|
|
||||||
* vid_dga_mouseaccel.value;
|
|
||||||
mouse_y += (float)x_event.xmotion.y_root
|
|
||||||
* vid_dga_mouseaccel.value;
|
|
||||||
} else
|
|
||||||
#endif
|
|
||||||
{
|
|
||||||
if (_windowed_mouse.value) {
|
|
||||||
mouse_x += (float) ((int)x_event.xmotion.x
|
|
||||||
- (int)(vid.width/2));
|
|
||||||
mouse_y += (float) ((int)x_event.xmotion.y
|
|
||||||
- (int)(vid.height/2));
|
|
||||||
|
|
||||||
/* move the mouse to the window center again */
|
|
||||||
XSelectInput(dpy, win, X_MASK & ~PointerMotionMask);
|
|
||||||
XWarpPointer(dpy, None, win, 0, 0, 0, 0,
|
|
||||||
(vid.width/2), (vid.height/2));
|
|
||||||
XSelectInput(dpy, win, X_MASK);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case ConfigureNotify:
|
|
||||||
if (scr_width == x_event.xconfigure.width &&
|
|
||||||
scr_height == x_event.xconfigure.height) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
scr_width = x_event.xconfigure.width;
|
|
||||||
scr_height = x_event.xconfigure.height;
|
|
||||||
|
|
||||||
if (scr_width < 320) scr_width = 320;
|
|
||||||
if (scr_height < 200) scr_height = 200;
|
|
||||||
|
|
||||||
scr_width &= ~7; /* make it a multiple of eight */
|
|
||||||
|
|
||||||
XResizeWindow(dpy, win, scr_width, scr_height);
|
|
||||||
|
|
||||||
vid.width = vid.conwidth = scr_width;
|
|
||||||
vid.height = scr_height;
|
|
||||||
|
|
||||||
/* pick a conheight that matches with correct aspect */
|
|
||||||
vid.conheight = vid.conwidth*3 / 4;
|
|
||||||
|
|
||||||
vid.aspect = ((float)vid.height / (float)vid.width)
|
|
||||||
* (320.0 / 240.0);
|
|
||||||
|
|
||||||
vid.recalc_refdef = 1; /* force a surface cache flush */
|
|
||||||
Con_CheckResize();
|
|
||||||
Con_Clear_f();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (mouse_shouldgrab != mouse_grabbed) {
|
|
||||||
do_grabs(mouse_shouldgrab);
|
|
||||||
}
|
|
||||||
if (vid_glx_fullscreen.value != fullscreen) {
|
|
||||||
do_fullscreen(vid_glx_fullscreen.value);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void Sys_SendKeyEvents(void)
|
|
||||||
{
|
|
||||||
if (dpy) {
|
|
||||||
while (XPending(dpy))
|
|
||||||
GetEvent();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void Force_CenterView_f (void)
|
|
||||||
{
|
|
||||||
cl.viewangles[PITCH] = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
void IN_Init(void)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void IN_Shutdown(void)
|
|
||||||
{
|
|
||||||
if (dpy) {
|
|
||||||
do_grabs(0);
|
|
||||||
do_fullscreen(0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
===========
|
|
||||||
IN_Commands
|
|
||||||
===========
|
|
||||||
*/
|
|
||||||
void IN_Commands (void)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
===========
|
|
||||||
IN_Move
|
|
||||||
===========
|
|
||||||
*/
|
|
||||||
void
|
|
||||||
IN_MouseMove(usercmd_t *cmd)
|
|
||||||
{
|
|
||||||
if (m_filter.value) {
|
|
||||||
mouse_x = (mouse_x + old_mouse_x) * 0.5;
|
|
||||||
mouse_y = (mouse_y + old_mouse_y) * 0.5;
|
|
||||||
}
|
|
||||||
old_mouse_x = mouse_x;
|
|
||||||
old_mouse_y = mouse_y;
|
|
||||||
|
|
||||||
mouse_x *= sensitivity.value;
|
|
||||||
mouse_y *= sensitivity.value;
|
|
||||||
|
|
||||||
/* add mouse X/Y movement to cmd */
|
|
||||||
if ((in_strafe.state & 1) ||
|
|
||||||
(lookstrafe.value && (in_mlook.state & 1))) {
|
|
||||||
cmd->sidemove += m_side.value * mouse_x;
|
|
||||||
} else {
|
|
||||||
cl.viewangles[YAW] -= m_yaw.value * mouse_x;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (in_mlook.state & 1) V_StopPitchDrift();
|
|
||||||
|
|
||||||
if ((in_mlook.state & 1) && !(in_strafe.state & 1)) {
|
|
||||||
cl.viewangles[PITCH] += m_pitch.value * mouse_y;
|
|
||||||
if (cl.viewangles[PITCH] > 80)
|
|
||||||
cl.viewangles[PITCH] = 80;
|
|
||||||
if (cl.viewangles[PITCH] < -70)
|
|
||||||
cl.viewangles[PITCH] = -70;
|
|
||||||
} else {
|
|
||||||
if ((in_strafe.state & 1) && noclip_anglehack) {
|
|
||||||
cmd->upmove -= m_forward.value * mouse_y;
|
|
||||||
} else {
|
|
||||||
cmd->forwardmove -= m_forward.value * mouse_y;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
mouse_x = mouse_y = 0.0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void IN_Move (usercmd_t *cmd)
|
|
||||||
{
|
|
||||||
IN_MouseMove(cmd);
|
|
||||||
}
|
|
||||||
|
|
||||||
void VID_ExtraOptionDraw(unsigned int options_draw_cursor)
|
|
||||||
{
|
|
||||||
/* Windowed Mouse */
|
|
||||||
M_Print(16, options_draw_cursor+=8, " Use Mouse");
|
|
||||||
M_DrawCheckbox(220, options_draw_cursor, _windowed_mouse.value);
|
|
||||||
|
|
||||||
#if defined(XMESA) || defined(HAS_DGA)
|
|
||||||
if (hasdga || QF_XMesaSetFXmode) {
|
|
||||||
/* Mesa has a fullscreen / windowed glx hack. */
|
|
||||||
M_Print(16, options_draw_cursor+=8, " Fullscreen");
|
|
||||||
M_DrawCheckbox(220, options_draw_cursor,
|
|
||||||
vid_glx_fullscreen.value);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
void VID_ExtraOptionCmd(int option_cursor)
|
|
||||||
{
|
|
||||||
switch(option_cursor) {
|
|
||||||
case 1: // _windowed_mouse
|
|
||||||
Cvar_SetValue("_windowed_mouse", !_windowed_mouse.value);
|
|
||||||
break;
|
|
||||||
|
|
||||||
#if defined(XMESA) || defined(HAS_DGA)
|
|
||||||
case 2:
|
|
||||||
if (hasdga || QF_XMesaSetFXmode) {
|
|
||||||
Cvar_SetValue("vid_glx_fullscreen",
|
|
||||||
!vid_glx_fullscreen.value);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,7 +34,7 @@
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <setjmp.h>
|
#include <setjmp.h>
|
||||||
|
|
||||||
#include <plugin.h>
|
#include <input.h>
|
||||||
#include <net.h>
|
#include <net.h>
|
||||||
#include <console.h>
|
#include <console.h>
|
||||||
#include <quakedef.h>
|
#include <quakedef.h>
|
||||||
|
@ -253,10 +253,11 @@ Host_FrameMain ( float time )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// get new key events
|
// get new key events
|
||||||
IN->SendKeyEvents ();
|
IN_SendKeyEvents ();
|
||||||
|
IN_Frame();
|
||||||
|
|
||||||
// allow mice or other external controllers to add commands
|
// allow mice or other external controllers to add commands
|
||||||
IN->Commands ();
|
IN_Commands ();
|
||||||
|
|
||||||
// process console commands
|
// process console commands
|
||||||
Cbuf_Execute ();
|
Cbuf_Execute ();
|
||||||
|
@ -580,9 +581,9 @@ Host_Init ( quakeparms_t *parms)
|
||||||
Sys_Error ("Couldn't load gfx/colormap.lmp");
|
Sys_Error ("Couldn't load gfx/colormap.lmp");
|
||||||
|
|
||||||
// plugin_load("./in_x11.so");
|
// plugin_load("./in_x11.so");
|
||||||
// IN->Init();
|
|
||||||
// Not the best place to load the plugin...
|
// Not the best place to load the plugin...
|
||||||
VID_Init(host_basepal);
|
VID_Init(host_basepal);
|
||||||
|
IN_Init();
|
||||||
// DDOI - I made this so host.c wouldn't try to unload a plugin
|
// DDOI - I made this so host.c wouldn't try to unload a plugin
|
||||||
// that it hasn't loaded. Could be done better I'm sure.
|
// that it hasn't loaded. Could be done better I'm sure.
|
||||||
vid_initialized = true;
|
vid_initialized = true;
|
||||||
|
@ -649,8 +650,8 @@ Host_Shutdown( void )
|
||||||
S_Shutdown();
|
S_Shutdown();
|
||||||
// Don't unload what hasn't been loaded!
|
// Don't unload what hasn't been loaded!
|
||||||
if (vid_initialized == true) {
|
if (vid_initialized == true) {
|
||||||
IN->Shutdown();
|
IN_Shutdown();
|
||||||
plugin_unload(IN->handle);
|
//plugin_unload(IN->handle);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if QUAKEWORLD
|
#if QUAKEWORLD
|
||||||
|
|
|
@ -39,7 +39,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
#include <vga.h>
|
#include <vga.h>
|
||||||
#include <vgakeyboard.h>
|
#include <vgakeyboard.h>
|
||||||
#include <vgamouse.h>
|
#include <vgamouse.h>
|
||||||
#include <plugin.h>
|
|
||||||
|
|
||||||
|
|
||||||
static int UseKeyboard = 1;
|
static int UseKeyboard = 1;
|
||||||
|
@ -101,7 +100,7 @@ void Force_CenterView_f(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int S_IN_Init(void)
|
int IN_Init(void)
|
||||||
{
|
{
|
||||||
if (COM_CheckParm("-nokbd")) UseKeyboard = 0;
|
if (COM_CheckParm("-nokbd")) UseKeyboard = 0;
|
||||||
if (COM_CheckParm("-nomouse")) UseMouse = 0;
|
if (COM_CheckParm("-nomouse")) UseMouse = 0;
|
||||||
|
@ -274,7 +273,7 @@ static void IN_init_mouse()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void S_IN_Shutdown(void)
|
void IN_Shutdown(void)
|
||||||
{
|
{
|
||||||
if (UseMouse) mouse_close();
|
if (UseMouse) mouse_close();
|
||||||
if (UseKeyboard) keyboard_close();
|
if (UseKeyboard) keyboard_close();
|
||||||
|
@ -282,17 +281,17 @@ void S_IN_Shutdown(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void S_IN_SendKeyEvents(void)
|
void IN_SendKeyEvents(void)
|
||||||
{
|
{
|
||||||
if (!in_svgalib_inited) return;
|
if (!in_svgalib_inited) return;
|
||||||
|
|
||||||
if (UseKeyboard) {
|
if (UseKeyboard) {
|
||||||
while (keyboard_update());
|
while ((keyboard_update()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void S_IN_Commands(void)
|
void IN_Commands(void)
|
||||||
{
|
{
|
||||||
#ifdef QUAKEWORLD
|
#ifdef QUAKEWORLD
|
||||||
if (UseMouse)
|
if (UseMouse)
|
||||||
|
@ -331,7 +330,7 @@ void S_IN_Commands(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void S_IN_Move(usercmd_t *cmd)
|
void IN_Move(usercmd_t *cmd)
|
||||||
{
|
{
|
||||||
if (!UseMouse) return;
|
if (!UseMouse) return;
|
||||||
|
|
||||||
|
@ -380,20 +379,3 @@ void S_IN_Move(usercmd_t *cmd)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
input_pi svgalib_ip =
|
|
||||||
{
|
|
||||||
NULL,
|
|
||||||
NULL,
|
|
||||||
"svgalib input module",
|
|
||||||
S_IN_Init,
|
|
||||||
S_IN_Shutdown,
|
|
||||||
S_IN_Commands,
|
|
||||||
S_IN_SendKeyEvents,
|
|
||||||
S_IN_Move,
|
|
||||||
};
|
|
||||||
|
|
||||||
input_pi *get_input_plugin_info()
|
|
||||||
{
|
|
||||||
return &svgalib_ip;
|
|
||||||
}
|
|
||||||
|
|
311
common/in_x11.c
311
common/in_x11.c
|
@ -55,7 +55,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
#include <draw.h>
|
#include <draw.h>
|
||||||
#include <console.h>
|
#include <console.h>
|
||||||
#include <client.h>
|
#include <client.h>
|
||||||
#include <plugin.h>
|
#include <context_x11.h>
|
||||||
|
|
||||||
#ifdef HAVE_STRINGS_H
|
#ifdef HAVE_STRINGS_H
|
||||||
#include <strings.h>
|
#include <strings.h>
|
||||||
|
@ -63,159 +63,26 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
cvar_t _windowed_mouse = {"_windowed_mouse","0", CVAR_ARCHIVE};
|
cvar_t _windowed_mouse = {"_windowed_mouse","0", CVAR_ARCHIVE};
|
||||||
cvar_t m_filter = {"m_filter","0", CVAR_ARCHIVE};
|
cvar_t m_filter = {"m_filter","0", CVAR_ARCHIVE};
|
||||||
|
#ifdef HAS_DGA
|
||||||
|
qboolean dgamouse = 0;
|
||||||
|
static cvar_t vid_dga_mouseaccel = {"vid_dga_mouseaccel", "1", CVAR_ARCHIVE};
|
||||||
|
#endif
|
||||||
|
|
||||||
static qboolean mouse_avail;
|
static qboolean mouse_avail;
|
||||||
static float mouse_x, mouse_y;
|
static float mouse_x, mouse_y;
|
||||||
static float old_mouse_x, old_mouse_y;
|
static float old_mouse_x, old_mouse_y;
|
||||||
static int p_mouse_x, p_mouse_y;
|
static int p_mouse_x, p_mouse_y;
|
||||||
static qboolean mouse_in_window = false;
|
|
||||||
static float old_windowed_mouse;
|
static float old_windowed_mouse;
|
||||||
|
|
||||||
static Display *x_disp = NULL;
|
#define KEY_MASK (KeyPressMask | KeyReleaseMask)
|
||||||
static Window x_win;
|
#define MOUSE_MASK (ButtonPressMask | ButtonReleaseMask | PointerMotionMask)
|
||||||
static Atom aWMDelete = 0;
|
#define INPUT_MASK (KEY_MASK | MOUSE_MASK)
|
||||||
|
|
||||||
|
|
||||||
int XShmQueryExtension(Display *);
|
|
||||||
int XShmGetEventBase(Display *);
|
|
||||||
|
|
||||||
static qboolean doShm;
|
|
||||||
static int x_shmeventtype;
|
|
||||||
|
|
||||||
static qboolean oktodraw = false;
|
|
||||||
|
|
||||||
static int verbose = 0;
|
|
||||||
|
|
||||||
int VID_options_items = 1;
|
|
||||||
|
|
||||||
#define STD_EVENT_MASK \
|
|
||||||
(KeyPressMask | KeyReleaseMask | ButtonPressMask | ButtonReleaseMask \
|
|
||||||
| PointerMotionMask | EnterWindowMask | LeaveWindowMask \
|
|
||||||
| VisibilityChangeMask | ExposureMask | StructureNotifyMask)
|
|
||||||
|
|
||||||
|
|
||||||
// ========================================================================
|
|
||||||
// makes a null cursor
|
|
||||||
// ========================================================================
|
|
||||||
|
|
||||||
static Cursor CreateNullCursor(Display *display, Window root)
|
|
||||||
{
|
|
||||||
Pixmap cursormask;
|
|
||||||
XGCValues xgc;
|
|
||||||
GC gc;
|
|
||||||
XColor dummycolour;
|
|
||||||
Cursor cursor;
|
|
||||||
|
|
||||||
cursormask = XCreatePixmap(display, root, 1, 1, 1/*depth*/);
|
|
||||||
xgc.function = GXclear;
|
|
||||||
gc = XCreateGC(display, cursormask, GCFunction, &xgc);
|
|
||||||
XFillRectangle(display, cursormask, gc, 0, 0, 1, 1);
|
|
||||||
dummycolour.pixel = 0;
|
|
||||||
dummycolour.red = 0;
|
|
||||||
dummycolour.flags = 04;
|
|
||||||
cursor = XCreatePixmapCursor(display, cursormask, cursormask,
|
|
||||||
&dummycolour,&dummycolour, 0,0);
|
|
||||||
XFreePixmap(display,cursormask);
|
|
||||||
XFreeGC(display,gc);
|
|
||||||
return cursor;
|
|
||||||
}
|
|
||||||
|
|
||||||
// ========================================================================
|
|
||||||
// Tragic death handler
|
|
||||||
// ========================================================================
|
|
||||||
|
|
||||||
static void TragicDeath(int signal_num)
|
|
||||||
{
|
|
||||||
XAutoRepeatOn(x_disp);
|
|
||||||
XCloseDisplay(x_disp);
|
|
||||||
Sys_Error("This death brought to you by the number %d\n", signal_num);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static int X_IN_Init (unsigned char *palette)
|
|
||||||
{
|
|
||||||
int template_mask;
|
|
||||||
int screen;
|
|
||||||
|
|
||||||
srandom(getpid());
|
|
||||||
|
|
||||||
verbose=COM_CheckParm("-verbose");
|
|
||||||
|
|
||||||
// open the display
|
|
||||||
x_disp = XOpenDisplay(NULL);
|
|
||||||
if (!x_disp)
|
|
||||||
{
|
|
||||||
if (getenv("DISPLAY"))
|
|
||||||
Sys_Error("IN: Could not open display [%s]\n",
|
|
||||||
getenv("DISPLAY"));
|
|
||||||
else
|
|
||||||
Sys_Error("IN: Could not open local display\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
// catch signals so i can turn on auto-repeat
|
|
||||||
|
|
||||||
{
|
|
||||||
struct sigaction sa;
|
|
||||||
sigaction(SIGINT, 0, &sa);
|
|
||||||
sa.sa_handler = TragicDeath;
|
|
||||||
sigaction(SIGINT, &sa, 0);
|
|
||||||
sigaction(SIGTERM, &sa, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
XAutoRepeatOff(x_disp);
|
|
||||||
|
|
||||||
// for debugging only
|
|
||||||
XSynchronize(x_disp, True);
|
|
||||||
|
|
||||||
|
|
||||||
template_mask = 0;
|
|
||||||
|
|
||||||
screen = XDefaultScreen(x_disp);
|
|
||||||
|
|
||||||
/* Setup attributes for main window */
|
|
||||||
{
|
|
||||||
int attribmask = CWEventMask | CWBorderPixel;
|
|
||||||
XSetWindowAttributes attribs;
|
|
||||||
|
|
||||||
attribs.event_mask = STD_EVENT_MASK;
|
|
||||||
attribs.border_pixel = 0;
|
|
||||||
|
|
||||||
/* Create the main window */
|
|
||||||
x_win = XCreateWindow(x_disp,
|
|
||||||
XRootWindow(x_disp, screen),
|
|
||||||
0, 0, 300, 200,
|
|
||||||
0, /* borderwidth */
|
|
||||||
0, InputOutput, CopyFromParent,
|
|
||||||
attribmask, &attribs);
|
|
||||||
|
|
||||||
/* Give it a title */
|
|
||||||
XStoreName(x_disp, x_win, "QF X11 Input");
|
|
||||||
|
|
||||||
/* Make window respond to Delete events */
|
|
||||||
aWMDelete = XInternAtom(x_disp, "WM_DELETE_WINDOW", False);
|
|
||||||
XSetWMProtocols(x_disp, x_win, &aWMDelete, 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
XDefineCursor(x_disp, x_win, CreateNullCursor(x_disp, x_win));
|
|
||||||
|
|
||||||
// map the window
|
|
||||||
XMapWindow(x_disp, x_win);
|
|
||||||
|
|
||||||
// XSynchronize(x_disp, False);
|
|
||||||
|
|
||||||
Cvar_RegisterVariable(&_windowed_mouse);
|
|
||||||
Cvar_RegisterVariable(&m_filter);
|
|
||||||
if (COM_CheckParm("-nomouse")) return 1;
|
|
||||||
mouse_x = mouse_y = 0.0;
|
|
||||||
mouse_avail = 1;
|
|
||||||
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Called at shutdown
|
Called at shutdown
|
||||||
*/
|
*/
|
||||||
static void X_IN_Shutdown(void)
|
void IN_Shutdown(void)
|
||||||
{
|
{
|
||||||
Con_Printf("IN_Shutdown\n");
|
Con_Printf("IN_Shutdown\n");
|
||||||
mouse_avail = 0;
|
mouse_avail = 0;
|
||||||
|
@ -226,7 +93,7 @@ static void X_IN_Shutdown(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static int XLateKey(XKeyEvent *ev)
|
int XLateKey(XKeyEvent *ev)
|
||||||
{
|
{
|
||||||
int key = 0;
|
int key = 0;
|
||||||
char buf[64];
|
char buf[64];
|
||||||
|
@ -348,89 +215,53 @@ static int XLateKey(XKeyEvent *ev)
|
||||||
return key;
|
return key;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void GetEvent(void)
|
static void event_key(XEvent *event)
|
||||||
|
{
|
||||||
|
Key_Event(XLateKey(&event->xkey), event->type == KeyPress);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void event_button(XEvent *event)
|
||||||
{
|
{
|
||||||
XEvent x_event;
|
|
||||||
int but;
|
int but;
|
||||||
|
|
||||||
XNextEvent(x_disp, &x_event);
|
but = event->xbutton.button;
|
||||||
switch(x_event.type) {
|
|
||||||
case KeyPress:
|
|
||||||
Key_Event(XLateKey(&x_event.xkey), true);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case KeyRelease:
|
|
||||||
Key_Event(XLateKey(&x_event.xkey), false);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case ButtonPress:
|
|
||||||
but = x_event.xbutton.button;
|
|
||||||
if (but == 2) but = 3;
|
if (but == 2) but = 3;
|
||||||
else if (but == 3) but = 2;
|
else if (but == 3) but = 2;
|
||||||
switch(but) {
|
switch(but) {
|
||||||
case 1:
|
case 1:
|
||||||
case 2:
|
case 2:
|
||||||
case 3:
|
case 3:
|
||||||
Key_Event(K_MOUSE1 + but - 1, true);
|
Key_Event(K_MOUSE1 + but - 1, event->type == ButtonPress);
|
||||||
}
|
}
|
||||||
break;
|
}
|
||||||
|
|
||||||
case ButtonRelease:
|
static void event_motion(XEvent *event)
|
||||||
but = x_event.xbutton.button;
|
{
|
||||||
if (but == 2) but = 3;
|
#ifdef HAS_DGA
|
||||||
else if (but == 3) but = 2;
|
if (dgamouse) {
|
||||||
switch(but) {
|
mouse_x += event->xmotion.x_root * vid_dga_mouseaccel.value;
|
||||||
case 1:
|
mouse_y += event->xmotion.y_root * vid_dga_mouseaccel.value;
|
||||||
case 2:
|
} else
|
||||||
case 3:
|
#endif
|
||||||
Key_Event(K_MOUSE1 + but - 1, false);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case MotionNotify:
|
|
||||||
if (_windowed_mouse.value) {
|
if (_windowed_mouse.value) {
|
||||||
mouse_x = (float) ((int)x_event.xmotion.x - (int)(vid.width/2));
|
mouse_x = (float) ((int) event->xmotion.x - ((int) vid.width / 2));
|
||||||
mouse_y = (float) ((int)x_event.xmotion.y - (int)(vid.height/2));
|
mouse_y = (float) ((int) event->xmotion.y - ((int) vid.height / 2));
|
||||||
//printf("m: x=%d,y=%d, mx=%3.2f,my=%3.2f\n",
|
|
||||||
// x_event.xmotion.x, x_event.xmotion.y, mouse_x, mouse_y);
|
|
||||||
|
|
||||||
/* move the mouse to the window center again */
|
/* move the mouse to the window center again */
|
||||||
XSelectInput(x_disp,x_win,StructureNotifyMask|KeyPressMask
|
XSelectInput(x_disp, x_win, INPUT_MASK & ~PointerMotionMask);
|
||||||
|KeyReleaseMask|ExposureMask
|
XWarpPointer(x_disp, None, x_win, 0, 0, 0, 0,
|
||||||
|ButtonPressMask
|
(vid.width / 2), (vid.height / 2));
|
||||||
|ButtonReleaseMask);
|
XSelectInput(x_disp, x_win, INPUT_MASK);
|
||||||
XWarpPointer(x_disp,None,x_win,0,0,0,0,
|
|
||||||
(vid.width/2),(vid.height/2));
|
|
||||||
XSelectInput(x_disp,x_win,StructureNotifyMask|KeyPressMask
|
|
||||||
|KeyReleaseMask|ExposureMask
|
|
||||||
|PointerMotionMask|ButtonPressMask
|
|
||||||
|ButtonReleaseMask);
|
|
||||||
} else {
|
} else {
|
||||||
mouse_x = (float) (x_event.xmotion.x-p_mouse_x);
|
mouse_x = (event->xmotion.x - p_mouse_x);
|
||||||
mouse_y = (float) (x_event.xmotion.y-p_mouse_y);
|
mouse_y = (event->xmotion.y - p_mouse_y);
|
||||||
p_mouse_x=x_event.xmotion.x;
|
p_mouse_x = event->xmotion.x;
|
||||||
p_mouse_y=x_event.xmotion.y;
|
p_mouse_y = event->xmotion.y;
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case EnterNotify:
|
|
||||||
mouse_in_window = true;
|
|
||||||
break;
|
|
||||||
case LeaveNotify:
|
|
||||||
mouse_in_window = false;
|
|
||||||
break;
|
|
||||||
/* Host_Quit_f only available in uquake */
|
|
||||||
#ifdef UQUAKE
|
|
||||||
case ClientMessage:
|
|
||||||
if (x_event.xclient.data.l[0] == aWMDelete) Host_Quit_f();
|
|
||||||
break;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
default:
|
|
||||||
if (doShm && x_event.type == x_shmeventtype)
|
|
||||||
oktodraw = true;
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void IN_Frame()
|
||||||
|
{
|
||||||
if (old_windowed_mouse != _windowed_mouse.value) {
|
if (old_windowed_mouse != _windowed_mouse.value) {
|
||||||
old_windowed_mouse = _windowed_mouse.value;
|
old_windowed_mouse = _windowed_mouse.value;
|
||||||
|
|
||||||
|
@ -445,23 +276,19 @@ static void GetEvent(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void X_IN_SendKeyEvents(void)
|
void IN_SendKeyEvents(void)
|
||||||
{
|
{
|
||||||
/* Get events from X server. */
|
/* Get events from X server. */
|
||||||
if (x_disp) {
|
x11_process_events();
|
||||||
while (XPending(x_disp)) {
|
|
||||||
GetEvent();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void X_IN_Commands(void)
|
void IN_Commands(void)
|
||||||
{
|
{
|
||||||
/* Nothing to do here */
|
/* Nothing to do here */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void X_IN_Move(usercmd_t *cmd)
|
void IN_Move(usercmd_t *cmd)
|
||||||
{
|
{
|
||||||
if (!mouse_avail)
|
if (!mouse_avail)
|
||||||
return;
|
return;
|
||||||
|
@ -500,14 +327,14 @@ static void X_IN_Move(usercmd_t *cmd)
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
static void X_IN_ExtraOptionDraw(unsigned int options_draw_cursor)
|
static void IN_ExtraOptionDraw(unsigned int options_draw_cursor)
|
||||||
{
|
{
|
||||||
// Windowed Mouse
|
// Windowed Mouse
|
||||||
M_Print(16, options_draw_cursor+=8, " Use Mouse");
|
M_Print(16, options_draw_cursor+=8, " Use Mouse");
|
||||||
M_DrawCheckbox(220, options_draw_cursor, _windowed_mouse.value);
|
M_DrawCheckbox(220, options_draw_cursor, _windowed_mouse.value);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void X_IN_ExtraOptionCmd(int option_cursor)
|
static void IN_ExtraOptionCmd(int option_cursor)
|
||||||
{
|
{
|
||||||
switch (option_cursor) {
|
switch (option_cursor) {
|
||||||
case 1: // _windowed_mouse
|
case 1: // _windowed_mouse
|
||||||
|
@ -517,20 +344,38 @@ static void X_IN_ExtraOptionCmd(int option_cursor)
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static input_pi x11_ip =
|
int IN_Init ()
|
||||||
{
|
{
|
||||||
NULL,
|
// open the display
|
||||||
NULL,
|
if (!x_disp)
|
||||||
"X11 input module",
|
Sys_Error("IN: No display!!\n");
|
||||||
X_IN_Init,
|
if (!x_win)
|
||||||
X_IN_Shutdown,
|
Sys_Error("IN: No window!!\n");
|
||||||
X_IN_Commands,
|
|
||||||
X_IN_SendKeyEvents,
|
|
||||||
X_IN_Move,
|
|
||||||
};
|
|
||||||
|
|
||||||
input_pi *get_input_plugin_info()
|
{
|
||||||
{
|
int attribmask = CWEventMask;
|
||||||
return &x11_ip;
|
XWindowAttributes attribs_1;
|
||||||
|
XSetWindowAttributes attribs_2;
|
||||||
|
|
||||||
|
XGetWindowAttributes(x_disp, x_win, &attribs_1);
|
||||||
|
|
||||||
|
attribs_2.event_mask = attribs_1.your_event_mask | INPUT_MASK;
|
||||||
|
|
||||||
|
XChangeWindowAttributes(x_disp, x_win, attribmask, &attribs_2);
|
||||||
|
}
|
||||||
|
|
||||||
|
Cvar_RegisterVariable(&_windowed_mouse);
|
||||||
|
Cvar_RegisterVariable(&m_filter);
|
||||||
|
Cvar_RegisterVariable(&vid_dga_mouseaccel);
|
||||||
|
if (COM_CheckParm("-nomouse")) return 1;
|
||||||
|
mouse_x = mouse_y = 0.0;
|
||||||
|
mouse_avail = 1;
|
||||||
|
|
||||||
|
x11_add_event(KeyPress, &event_key);
|
||||||
|
x11_add_event(KeyRelease, &event_key);
|
||||||
|
x11_add_event(ButtonPress, &event_button);
|
||||||
|
x11_add_event(ButtonRelease, &event_button);
|
||||||
|
x11_add_event(MotionNotify, &event_motion);
|
||||||
|
|
||||||
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
34
common/input.h
Normal file
34
common/input.h
Normal file
|
@ -0,0 +1,34 @@
|
||||||
|
/*
|
||||||
|
input.h
|
||||||
|
Copyright (C) 1996-1997 Id Software, Inc.
|
||||||
|
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 the Free Software
|
||||||
|
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef __INPUT_H__
|
||||||
|
#define __INPUT_H__
|
||||||
|
|
||||||
|
int IN_Init();
|
||||||
|
void IN_Shutdown();
|
||||||
|
void IN_SendKeyEvents();
|
||||||
|
void IN_Commands();
|
||||||
|
void IN_Move();
|
||||||
|
void IN_Frame();
|
||||||
|
|
||||||
|
#endif // __INPUT_H__
|
|
@ -43,8 +43,6 @@
|
||||||
|
|
||||||
cvar_t drv_path = {"drv_path", ".:" LIBDIR "/quakeforge"};
|
cvar_t drv_path = {"drv_path", ".:" LIBDIR "/quakeforge"};
|
||||||
|
|
||||||
input_pi *IN;
|
|
||||||
|
|
||||||
void *_plugin_load(const char *filename)
|
void *_plugin_load(const char *filename)
|
||||||
{
|
{
|
||||||
void *h;
|
void *h;
|
||||||
|
@ -76,6 +74,7 @@ int plugin_load(char *filename)
|
||||||
|
|
||||||
if ((h=_plugin_load(filename))) {
|
if ((h=_plugin_load(filename))) {
|
||||||
if ((gpi = dlsym(h, "get_input_plugin_info"))) {
|
if ((gpi = dlsym(h, "get_input_plugin_info"))) {
|
||||||
|
/*
|
||||||
input_pi *p;
|
input_pi *p;
|
||||||
|
|
||||||
p = (input_pi *) gpi();
|
p = (input_pi *) gpi();
|
||||||
|
@ -83,7 +82,6 @@ int plugin_load(char *filename)
|
||||||
p->filename = filename;
|
p->filename = filename;
|
||||||
|
|
||||||
IN = p;
|
IN = p;
|
||||||
/*
|
|
||||||
} else if (gpi = dlsym(h, "get_sound_plugin_info")) {
|
} else if (gpi = dlsym(h, "get_sound_plugin_info")) {
|
||||||
sound_pi *p;
|
sound_pi *p;
|
||||||
|
|
||||||
|
|
|
@ -26,22 +26,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
#include <net.h>
|
#include <net.h>
|
||||||
|
|
||||||
// Input plugin interface.
|
|
||||||
typedef struct
|
|
||||||
{
|
|
||||||
void *handle;
|
|
||||||
char *filename;
|
|
||||||
char *description;
|
|
||||||
|
|
||||||
int (*Init)();
|
|
||||||
void (*Shutdown)();
|
|
||||||
void (*Commands)();
|
|
||||||
void (*SendKeyEvents)();
|
|
||||||
void (*Move)(usercmd_t *);
|
|
||||||
} input_pi;
|
|
||||||
|
|
||||||
extern input_pi *IN;
|
|
||||||
|
|
||||||
int plugin_load(char *filename);
|
int plugin_load(char *filename);
|
||||||
void plugin_unload(void *handle);
|
void plugin_unload(void *handle);
|
||||||
|
|
||||||
|
|
|
@ -56,7 +56,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
#include <common.h>
|
#include <common.h>
|
||||||
#include <sys.h>
|
#include <sys.h>
|
||||||
#include <client.h>
|
#include <client.h>
|
||||||
#include <plugin.h>
|
#include <input.h>
|
||||||
|
|
||||||
cvar_t _windowed_mouse = {"_windowed_mouse","0", CVAR_ARCHIVE};
|
cvar_t _windowed_mouse = {"_windowed_mouse","0", CVAR_ARCHIVE};
|
||||||
cvar_t m_filter = {"m_filter","0", CVAR_ARCHIVE};
|
cvar_t m_filter = {"m_filter","0", CVAR_ARCHIVE};
|
||||||
|
@ -535,8 +535,7 @@ void VID_Init (unsigned char *palette)
|
||||||
int num_visuals;
|
int num_visuals;
|
||||||
int template_mask;
|
int template_mask;
|
||||||
|
|
||||||
plugin_load("in_x11.so");
|
//plugin_load("in_x11.so");
|
||||||
IN->Init();
|
|
||||||
S_Init(); // sound is initialized here
|
S_Init(); // sound is initialized here
|
||||||
|
|
||||||
Cmd_AddCommand("gamma", VID_Gamma_f);
|
Cmd_AddCommand("gamma", VID_Gamma_f);
|
||||||
|
@ -751,6 +750,7 @@ void VID_Init (unsigned char *palette)
|
||||||
D_InitCaches (surfcache, sizeof(surfcache));
|
D_InitCaches (surfcache, sizeof(surfcache));
|
||||||
|
|
||||||
// XSynchronize(x_disp, False);
|
// XSynchronize(x_disp, False);
|
||||||
|
IN_Init();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -32,7 +32,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
#include <cmd.h>
|
#include <cmd.h>
|
||||||
#include <sys.h>
|
#include <sys.h>
|
||||||
#include <console.h>
|
#include <console.h>
|
||||||
#include <plugin.h>
|
#include <input.h>
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#ifdef HAVE_UNISTD_H
|
#ifdef HAVE_UNISTD_H
|
||||||
|
@ -492,8 +492,7 @@ VID_Init(unsigned char *palette)
|
||||||
int w, h, d;
|
int w, h, d;
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
plugin_load("in_svgalib.so");
|
//plugin_load("in_svgalib.so");
|
||||||
IN->Init();
|
|
||||||
/* Sound gets initialized here */
|
/* Sound gets initialized here */
|
||||||
S_Init();
|
S_Init();
|
||||||
|
|
||||||
|
@ -551,6 +550,7 @@ VID_Init(unsigned char *palette)
|
||||||
/* XoXus: Running in background is just plain bad... */
|
/* XoXus: Running in background is just plain bad... */
|
||||||
vga_runinbackground(0);
|
vga_runinbackground(0);
|
||||||
}
|
}
|
||||||
|
IN_Init();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -25,6 +25,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
#define _BSD
|
#define _BSD
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
|
|
||||||
|
#include <context_x11.h>
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
|
@ -56,7 +57,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
#include <draw.h>
|
#include <draw.h>
|
||||||
#include <console.h>
|
#include <console.h>
|
||||||
#include <client.h>
|
#include <client.h>
|
||||||
#include <plugin.h>
|
#include <input.h>
|
||||||
|
|
||||||
#ifdef HAVE_STRINGS_H
|
#ifdef HAVE_STRINGS_H
|
||||||
#include <strings.h>
|
#include <strings.h>
|
||||||
|
@ -65,8 +66,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
viddef_t vid; // global video state
|
viddef_t vid; // global video state
|
||||||
unsigned short d_8to16table[256];
|
unsigned short d_8to16table[256];
|
||||||
|
|
||||||
static Display *x_disp = NULL;
|
Display *x_disp = NULL;
|
||||||
static Window x_win;
|
Window x_win;
|
||||||
static Colormap x_cmap;
|
static Colormap x_cmap;
|
||||||
static GC x_gc;
|
static GC x_gc;
|
||||||
static Visual *x_vis;
|
static Visual *x_vis;
|
||||||
|
@ -77,12 +78,9 @@ static Atom aWMDelete = 0;
|
||||||
int XShmQueryExtension(Display *);
|
int XShmQueryExtension(Display *);
|
||||||
int XShmGetEventBase(Display *);
|
int XShmGetEventBase(Display *);
|
||||||
|
|
||||||
static qboolean doShm;
|
qboolean doShm;
|
||||||
static int x_shmeventtype;
|
|
||||||
static XShmSegmentInfo x_shminfo[2];
|
static XShmSegmentInfo x_shminfo[2];
|
||||||
|
|
||||||
static qboolean oktodraw = false;
|
|
||||||
|
|
||||||
static int current_framebuffer;
|
static int current_framebuffer;
|
||||||
static XImage *x_framebuffer[2] = { 0, 0 };
|
static XImage *x_framebuffer[2] = { 0, 0 };
|
||||||
|
|
||||||
|
@ -103,9 +101,7 @@ static unsigned long r_mask,g_mask,b_mask;
|
||||||
static long X11_highhunkmark;
|
static long X11_highhunkmark;
|
||||||
|
|
||||||
#define STD_EVENT_MASK \
|
#define STD_EVENT_MASK \
|
||||||
(KeyPressMask | KeyReleaseMask | ButtonPressMask | ButtonReleaseMask \
|
( VisibilityChangeMask | ExposureMask | StructureNotifyMask)
|
||||||
| PointerMotionMask | EnterWindowMask | LeaveWindowMask \
|
|
||||||
| VisibilityChangeMask | ExposureMask | StructureNotifyMask)
|
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -292,6 +288,16 @@ void VID_Gamma_f (void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ========================================================================
|
||||||
|
// Tragic death handler
|
||||||
|
// ========================================================================
|
||||||
|
|
||||||
|
static void TragicDeath(int signal_num)
|
||||||
|
{
|
||||||
|
XCloseDisplay(x_disp);
|
||||||
|
Sys_Error("This death brought to you by the number %d\n", signal_num);
|
||||||
|
}
|
||||||
|
|
||||||
// ========================================================================
|
// ========================================================================
|
||||||
// makes a null cursor
|
// makes a null cursor
|
||||||
// ========================================================================
|
// ========================================================================
|
||||||
|
@ -461,6 +467,12 @@ ResetSharedFrameBuffers(void)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void event_shm(XEvent *event)
|
||||||
|
{
|
||||||
|
if (doShm)
|
||||||
|
oktodraw = true;
|
||||||
|
}
|
||||||
|
|
||||||
// Called at startup to set up translation tables, takes 256 8 bit RGB values
|
// Called at startup to set up translation tables, takes 256 8 bit RGB values
|
||||||
// the palette data will go away after the call, so it must be copied off if
|
// the palette data will go away after the call, so it must be copied off if
|
||||||
// the video driver will need it again
|
// the video driver will need it again
|
||||||
|
@ -472,8 +484,7 @@ void VID_Init (unsigned char *palette)
|
||||||
int num_visuals;
|
int num_visuals;
|
||||||
int template_mask;
|
int template_mask;
|
||||||
|
|
||||||
plugin_load("in_x11.so");
|
//plugin_load("in_x11.so");
|
||||||
IN->Init();
|
|
||||||
S_Init(); // sound is initialized here
|
S_Init(); // sound is initialized here
|
||||||
|
|
||||||
Cmd_AddCommand("gamma", VID_Gamma_f);
|
Cmd_AddCommand("gamma", VID_Gamma_f);
|
||||||
|
@ -504,6 +515,15 @@ void VID_Init (unsigned char *palette)
|
||||||
Sys_Error("VID: Could not open local display\n");
|
Sys_Error("VID: Could not open local display\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// catch signals
|
||||||
|
{
|
||||||
|
struct sigaction sa;
|
||||||
|
sigaction(SIGINT, 0, &sa);
|
||||||
|
sa.sa_handler = TragicDeath;
|
||||||
|
sigaction(SIGINT, &sa, 0);
|
||||||
|
sigaction(SIGTERM, &sa, 0);
|
||||||
|
}
|
||||||
|
|
||||||
// for debugging only
|
// for debugging only
|
||||||
XSynchronize(x_disp, True);
|
XSynchronize(x_disp, True);
|
||||||
|
|
||||||
|
@ -645,6 +665,7 @@ void VID_Init (unsigned char *palette)
|
||||||
|
|
||||||
// even if MITSHM is available, make sure it's a local connection
|
// even if MITSHM is available, make sure it's a local connection
|
||||||
if (XShmQueryExtension(x_disp))
|
if (XShmQueryExtension(x_disp))
|
||||||
|
//if (0)
|
||||||
{
|
{
|
||||||
char *displayname;
|
char *displayname;
|
||||||
doShm = true;
|
doShm = true;
|
||||||
|
@ -678,7 +699,7 @@ void VID_Init (unsigned char *palette)
|
||||||
vid.aspect = ((float)vid.height / (float)vid.width) * (320.0 / 240.0);
|
vid.aspect = ((float)vid.height / (float)vid.width) * (320.0 / 240.0);
|
||||||
|
|
||||||
// XSynchronize(x_disp, False);
|
// XSynchronize(x_disp, False);
|
||||||
|
x11_add_event(x_shmeventtype, event_shm);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -735,43 +756,6 @@ static int config_notify=0;
|
||||||
static int config_notify_width;
|
static int config_notify_width;
|
||||||
static int config_notify_height;
|
static int config_notify_height;
|
||||||
|
|
||||||
static void
|
|
||||||
GetEvent(void)
|
|
||||||
{
|
|
||||||
XEvent x_event;
|
|
||||||
|
|
||||||
XNextEvent(x_disp, &x_event);
|
|
||||||
switch(x_event.type) {
|
|
||||||
case KeyPress:
|
|
||||||
case KeyRelease:
|
|
||||||
case ButtonPress:
|
|
||||||
case ButtonRelease:
|
|
||||||
case MotionNotify:
|
|
||||||
case EnterNotify:
|
|
||||||
case LeaveNotify:
|
|
||||||
break;
|
|
||||||
case ConfigureNotify:
|
|
||||||
config_notify_width = x_event.xconfigure.width;
|
|
||||||
config_notify_height = x_event.xconfigure.height;
|
|
||||||
if (config_notify_width != vid.width ||
|
|
||||||
config_notify_height != vid.height) {
|
|
||||||
config_notify = 1;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
/* Host_Quit_f only available in uquake */
|
|
||||||
#ifdef UQUAKE
|
|
||||||
case ClientMessage:
|
|
||||||
if (x_event.xclient.data.l[0] == aWMDelete) Host_Quit_f();
|
|
||||||
break;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
default:
|
|
||||||
if (doShm && x_event.type == x_shmeventtype)
|
|
||||||
oktodraw = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Flushes the given rectangles from the view buffer to the screen.
|
Flushes the given rectangles from the view buffer to the screen.
|
||||||
*/
|
*/
|
||||||
|
@ -819,7 +803,7 @@ VID_Update(vrect_t *rects)
|
||||||
Sys_Error("VID_Update: XShmPutImage failed\n");
|
Sys_Error("VID_Update: XShmPutImage failed\n");
|
||||||
}
|
}
|
||||||
oktodraw = false;
|
oktodraw = false;
|
||||||
while (!oktodraw) GetEvent();
|
while (!oktodraw) x11_process_event();
|
||||||
rects = rects->pnext;
|
rects = rects->pnext;
|
||||||
}
|
}
|
||||||
current_framebuffer = !current_framebuffer;
|
current_framebuffer = !current_framebuffer;
|
||||||
|
|
|
@ -311,7 +311,7 @@ $(BUILD_DIR)/common_lib.a: $(BUILD_DIR)/common_lib $(ALL_COMMON_LIB_OBJS)
|
||||||
ifneq ($(X11QUAKE),)
|
ifneq ($(X11QUAKE),)
|
||||||
|
|
||||||
ALL_X11_SRC = $(SW_REND_SRC) @X11_VID_SRC@\
|
ALL_X11_SRC = $(SW_REND_SRC) @X11_VID_SRC@\
|
||||||
model.c
|
model.c in_x11.c context_x11.c
|
||||||
ALL_X11_OBJS = $(patsubst %,$(BUILD_DIR)/%,$(addsuffix .@OBJEXT@,\
|
ALL_X11_OBJS = $(patsubst %,$(BUILD_DIR)/%,$(addsuffix .@OBJEXT@,\
|
||||||
$(basename $(ALL_X11_SRC) .c .s))) \
|
$(basename $(ALL_X11_SRC) .c .s))) \
|
||||||
$(BUILD_DIR)/common_lib.a $(TARGET_DIR)/sound_lib.a
|
$(BUILD_DIR)/common_lib.a $(TARGET_DIR)/sound_lib.a
|
||||||
|
@ -443,7 +443,7 @@ endif
|
||||||
|
|
||||||
ifneq ($(GLQUAKE),)
|
ifneq ($(GLQUAKE),)
|
||||||
|
|
||||||
GLX_GL_SRC = gl_vidglx.c dga_check.c
|
GLX_GL_SRC = gl_vidglx.c dga_check.c in_x11.c context_x11.c
|
||||||
ALL_GL_SRC = $(GL_REND_SRC) $(GLX_GL_SRC)
|
ALL_GL_SRC = $(GL_REND_SRC) $(GLX_GL_SRC)
|
||||||
|
|
||||||
GL_REND_OBJS = $(patsubst %,$(BUILD_DIR)/gl/%,$(addsuffix .@OBJEXT@,\
|
GL_REND_OBJS = $(patsubst %,$(BUILD_DIR)/gl/%,$(addsuffix .@OBJEXT@,\
|
||||||
|
@ -478,7 +478,7 @@ endif
|
||||||
ifneq ($(TDFXQUAKE),)
|
ifneq ($(TDFXQUAKE),)
|
||||||
|
|
||||||
ALL_TDFX_SRC = $(GL_REND_SRC) \
|
ALL_TDFX_SRC = $(GL_REND_SRC) \
|
||||||
gl_vidlinux_3dfx.c
|
gl_vidlinux_3dfx.c in_svgalib.c
|
||||||
ALL_TDFX_OBJS = $(patsubst %,$(BUILD_DIR)/%,$(addsuffix .@OBJEXT@,\
|
ALL_TDFX_OBJS = $(patsubst %,$(BUILD_DIR)/%,$(addsuffix .@OBJEXT@,\
|
||||||
$(basename $(ALL_TDFX_SRC) .c .s))) \
|
$(basename $(ALL_TDFX_SRC) .c .s))) \
|
||||||
$(BUILD_DIR)/common_lib.a $(TARGET_DIR)/sound_lib.a
|
$(BUILD_DIR)/common_lib.a $(TARGET_DIR)/sound_lib.a
|
||||||
|
|
|
@ -35,7 +35,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
#include "sbar.h"
|
#include "sbar.h"
|
||||||
#include "menu.h"
|
#include "menu.h"
|
||||||
#include "sound.h"
|
#include "sound.h"
|
||||||
#include <plugin.h>
|
#include <input.h>
|
||||||
|
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
|
||||||
|
@ -1030,7 +1030,7 @@ int SCR_ModalMessage (char *text)
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
key_count = -1; // wait for a key down and up
|
key_count = -1; // wait for a key down and up
|
||||||
IN->SendKeyEvents();
|
IN_SendKeyEvents();
|
||||||
} while (key_lastpress != 'y' && key_lastpress != 'n' && key_lastpress != K_ESCAPE);
|
} while (key_lastpress != 'y' && key_lastpress != 'n' && key_lastpress != K_ESCAPE);
|
||||||
|
|
||||||
scr_fullupdate = 0;
|
scr_fullupdate = 0;
|
||||||
|
|
|
@ -33,7 +33,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
#include <sound.h>
|
#include <sound.h>
|
||||||
#include <screen.h>
|
#include <screen.h>
|
||||||
#include <menu.h>
|
#include <menu.h>
|
||||||
#include <plugin.h>
|
#include <input.h>
|
||||||
|
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
|
||||||
|
@ -973,7 +973,7 @@ int SCR_ModalMessage (char *text)
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
key_count = -1; // wait for a key down and up
|
key_count = -1; // wait for a key down and up
|
||||||
IN->SendKeyEvents ();
|
IN_SendKeyEvents ();
|
||||||
} while (key_lastpress != 'y' && key_lastpress != 'n' && key_lastpress != K_ESCAPE);
|
} while (key_lastpress != 'y' && key_lastpress != 'n' && key_lastpress != K_ESCAPE);
|
||||||
|
|
||||||
scr_fullupdate = 0;
|
scr_fullupdate = 0;
|
||||||
|
|
|
@ -800,7 +800,7 @@ int SCR_ModalMessage (char *text)
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
key_count = -1; // wait for a key down and up
|
key_count = -1; // wait for a key down and up
|
||||||
IN->SendKeyEvents ();
|
IN_SendKeyEvents ();
|
||||||
} while (key_lastpress != 'y' && key_lastpress != 'n' && key_lastpress != K_ESCAPE);
|
} while (key_lastpress != 'y' && key_lastpress != 'n' && key_lastpress != K_ESCAPE);
|
||||||
|
|
||||||
scr_fullupdate = 0;
|
scr_fullupdate = 0;
|
||||||
|
|
|
@ -845,7 +845,7 @@ int SCR_ModalMessage (char *text)
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
key_count = -1; // wait for a key down and up
|
key_count = -1; // wait for a key down and up
|
||||||
IN->SendKeyEvents ();
|
IN_SendKeyEvents ();
|
||||||
} while (key_lastpress != 'y' && key_lastpress != 'n' && key_lastpress != K_ESCAPE);
|
} while (key_lastpress != 'y' && key_lastpress != 'n' && key_lastpress != K_ESCAPE);
|
||||||
|
|
||||||
scr_fullupdate = 0;
|
scr_fullupdate = 0;
|
||||||
|
|
Loading…
Reference in a new issue