mirror of
https://git.code.sf.net/p/quake/quakeforge-old
synced 2024-11-24 21:01:17 +00:00
renamed _windowed_mouse to in_grab
Also, FULL SCREEN QUAKE IS HERE!!! unfortunatly, so is full screen quake :/. ie if you have the vidmode extentions, you don't have a choice at the moment. Still, that's just a matter of cvars :), but not tonight.
This commit is contained in:
parent
a7e5fd3a16
commit
98aeb39780
15 changed files with 204 additions and 95 deletions
|
@ -394,7 +394,7 @@ extern cvar_t *m_yaw;
|
|||
extern cvar_t *m_forward;
|
||||
extern cvar_t *m_side;
|
||||
|
||||
extern cvar_t *_windowed_mouse;
|
||||
extern cvar_t *in_grab;
|
||||
|
||||
#define MAX_TEMP_ENTITIES 64 // lightning bolts, etc
|
||||
#define MAX_STATIC_ENTITIES 128 // torches, etc
|
||||
|
|
|
@ -69,8 +69,8 @@ extern int global_dx, global_dy;
|
|||
// globals
|
||||
//
|
||||
|
||||
//cvar_t _windowed_mouse = {"_windowed_mouse","1", CVAR_ARCHIVE};
|
||||
cvar_t *_windowed_mouse;
|
||||
//cvar_t in_grab = {"in_grab","1", CVAR_ARCHIVE};
|
||||
cvar_t *in_grab;
|
||||
int x_root, y_root;
|
||||
int x_root_old, y_root_old;
|
||||
//
|
||||
|
@ -105,7 +105,7 @@ void IN_CenterMouse( void )
|
|||
//
|
||||
static void CheckMouseState(void)
|
||||
{
|
||||
if (x_focus && _windowed_mouse->value && !x_grabbed) {
|
||||
if (x_focus && in_grab->value && !x_grabbed) {
|
||||
x_grabbed = true;
|
||||
printf("fooling with mouse!\n");
|
||||
if (XGetPointerControl( x_disp, &x_mouse_num, &x_mouse_denom, &x_mouse_thresh ))
|
||||
|
@ -127,7 +127,7 @@ static void CheckMouseState(void)
|
|||
// safe initial values
|
||||
x_root = x_root_old = vid.width >> 1;
|
||||
y_root = y_root_old = vid.height >> 1;
|
||||
} else if (x_grabbed && (!_windowed_mouse->value || !x_focus)) {
|
||||
} else if (x_grabbed && (!in_grab->value || !x_focus)) {
|
||||
printf("fooling with mouse!\n");
|
||||
x_grabbed = false;
|
||||
// undo mouse warp
|
||||
|
@ -149,8 +149,8 @@ void IN_Init (void)
|
|||
{
|
||||
if (!x_disp) Sys_Error( "X display not open!\n" );
|
||||
|
||||
// Cvar_RegisterVariable (&_windowed_mouse);
|
||||
_windowed_mouse = Cvar_Get ("_windowed_mouse","1", CVAR_ARCHIVE);
|
||||
// Cvar_RegisterVariable (&in_grab);
|
||||
in_grab = Cvar_Get ("in_grab","1", CVAR_ARCHIVE);
|
||||
|
||||
// we really really want to clean these up...
|
||||
atexit( IN_Shutdown );
|
||||
|
|
|
@ -64,7 +64,7 @@ static int mx, my;
|
|||
static void IN_init_kb();
|
||||
static void IN_init_mouse();
|
||||
|
||||
cvar_t *_windowed_mouse;
|
||||
cvar_t *in_grab;
|
||||
cvar_t *m_filter;
|
||||
static cvar_t *mouse_button_commands[3];
|
||||
|
||||
|
|
|
@ -66,7 +66,7 @@
|
|||
#include <strings.h>
|
||||
#endif
|
||||
|
||||
cvar_t *_windowed_mouse;
|
||||
cvar_t *in_grab;
|
||||
cvar_t *m_filter;
|
||||
#ifdef HAS_DGA
|
||||
cvar_t *in_dgamouse;
|
||||
|
@ -77,7 +77,7 @@ static qboolean mouse_avail;
|
|||
static float mouse_x, mouse_y;
|
||||
static float old_mouse_x, old_mouse_y;
|
||||
static int p_mouse_x, p_mouse_y;
|
||||
static float old_windowed_mouse;
|
||||
static float old_in_grab;
|
||||
static Cursor nullcursor = None;
|
||||
|
||||
|
||||
|
@ -302,9 +302,9 @@ event_motion(XEvent *event)
|
|||
} else
|
||||
#endif
|
||||
{
|
||||
//printf("_windowed_mouse: %f\n", _windowed_mouse->value);
|
||||
//printf("in_grab: %f\n", in_grab->value);
|
||||
//printf("CurrentTime: %ld\n", CurrentTime);
|
||||
if (_windowed_mouse->value) {
|
||||
if (in_grab->value) {
|
||||
if (!event->xmotion.send_event) {
|
||||
mouse_x += (event->xmotion.x - p_mouse_x);
|
||||
mouse_y += (event->xmotion.y - p_mouse_y);
|
||||
|
@ -331,10 +331,10 @@ event_motion(XEvent *event)
|
|||
void
|
||||
IN_Frame(void)
|
||||
{
|
||||
if (old_windowed_mouse != _windowed_mouse->value) {
|
||||
old_windowed_mouse = _windowed_mouse->value;
|
||||
if (old_in_grab != in_grab->value) {
|
||||
old_in_grab = in_grab->value;
|
||||
|
||||
if (!_windowed_mouse->value) {
|
||||
if (!in_grab->value) {
|
||||
/* ungrab the pointer */
|
||||
XUngrabPointer(x_disp,CurrentTime);
|
||||
} else {
|
||||
|
@ -400,14 +400,14 @@ static void IN_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);
|
||||
M_DrawCheckbox(220, options_draw_cursor, in_grab->value);
|
||||
}
|
||||
|
||||
static void IN_ExtraOptionCmd(int option_cursor)
|
||||
{
|
||||
switch (option_cursor) {
|
||||
case 1: // _windowed_mouse
|
||||
_windowed_mouse->value = !_windowed_mouse->value;
|
||||
case 1: // in_grab
|
||||
in_grab->value = !in_grab->value;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -457,32 +457,34 @@ IN_Init(void)
|
|||
XChangeWindowAttributes(x_disp, x_win, attribmask, &attribs_2);
|
||||
}
|
||||
|
||||
_windowed_mouse = Cvar_Get ("_windowed_mouse","0",CVAR_ARCHIVE,"None");
|
||||
in_grab = Cvar_Get ("in_grab","0",CVAR_ARCHIVE,"None");
|
||||
m_filter = Cvar_Get ("m_filter","0",CVAR_ARCHIVE,"None");
|
||||
#ifdef HAS_DGA
|
||||
vid_dga_mouseaccel = Cvar_Get ("vid_dga_mouseaccel","1",CVAR_ARCHIVE,
|
||||
"None");
|
||||
|
||||
if (!COM_CheckParm("-nodga")) {
|
||||
// XF86DGASetViewPort, XF86DGASetVidPage, and XF86DGADirectVideo's
|
||||
// XF86DGADirectVideo flag are disabled till someone has a chance to
|
||||
// figure out what's wrong with them (if anything) --KB
|
||||
// XF86DGASetViewPort, XF86DGASetVidPage, and XF86DGADirectVideo's
|
||||
// XF86DGADirectVideo flag are disabled till someone has a chance to
|
||||
// figure out what's wrong with them (if anything) --KB
|
||||
|
||||
// XF86DGASetViewPort(x_disp, DefaultScreen(x_disp), 0, 0);
|
||||
XF86DGADirectVideo(x_disp, DefaultScreen(x_disp),
|
||||
/*XF86DGADirectGraphics|*/
|
||||
XF86DGADirectMouse|XF86DGADirectKeyb);
|
||||
// XF86DGASetVidPage(x_disp, DefaultScreen(x_disp), 0);
|
||||
// XF86DGASetViewPort(x_disp, DefaultScreen(x_disp), 0, 0);
|
||||
XF86DGADirectVideo(x_disp, DefaultScreen(x_disp),
|
||||
/*XF86DGADirectGraphics|*/
|
||||
XF86DGADirectMouse|XF86DGADirectKeyb);
|
||||
// XF86DGASetVidPage(x_disp, DefaultScreen(x_disp), 0);
|
||||
|
||||
XGrabKeyboard(x_disp, x_win, True, GrabModeAsync, GrabModeAsync, CurrentTime);
|
||||
XGrabPointer(x_disp, x_win, True, MOUSE_MASK, GrabModeAsync, GrabModeAsync,
|
||||
x_win, None, CurrentTime);
|
||||
XGrabKeyboard(x_disp, x_win, True, GrabModeAsync, GrabModeAsync,
|
||||
CurrentTime);
|
||||
XGrabPointer(x_disp, x_win, True, MOUSE_MASK,
|
||||
GrabModeAsync, GrabModeAsync,
|
||||
x_win, None, CurrentTime);
|
||||
|
||||
in_dgamouse = Cvar_Get ("in_dgamouse", "1", CVAR_ROM,
|
||||
"1 if you have DGA mouse support");
|
||||
in_dgamouse = Cvar_Get ("in_dgamouse", "1", CVAR_ROM,
|
||||
"1 if you have DGA mouse support");
|
||||
} else
|
||||
in_dgamouse = Cvar_Get ("in_dgamouse", "0", CVAR_ROM,
|
||||
"1 if you have DGA mouse support");
|
||||
"1 if you have DGA mouse support");
|
||||
|
||||
#endif
|
||||
if (COM_CheckParm("-nomouse")) return 1;
|
||||
|
|
|
@ -58,7 +58,7 @@ cvar_t *_vid_default_mode_win;
|
|||
cvar_t *vid_config_x;
|
||||
cvar_t *vid_config_y;
|
||||
cvar_t *vid_stretch_by_2;
|
||||
cvar_t *_windowed_mouse;
|
||||
cvar_t *in_grab;
|
||||
cvar_t *vid_fullscreen_mode;
|
||||
cvar_t *vid_windowed_mode;
|
||||
cvar_t *block_switch;
|
||||
|
@ -114,7 +114,7 @@ void VID_Init (unsigned char *palette)
|
|||
vid_config_y = Cvar_Get ("vid_config_y","600",CVAR_ARCHIVE,"None");
|
||||
vid_stretch_by_2 = Cvar_Get ("vid_stretch_by_2","1",CVAR_ARCHIVE,
|
||||
"None");
|
||||
_windowed_mouse = Cvar_Get ("_windowed_mouse","0",CVAR_ARCHIVE,"None");
|
||||
in_grab = Cvar_Get ("in_grab","0",CVAR_ARCHIVE,"None");
|
||||
vid_fullscreen_mode = Cvar_Get ("vid_fullscreen_mode","3",CVAR_ARCHIVE,
|
||||
"None");
|
||||
vid_windowed_mode = Cvar_Get ("vid_windowed_mode","0",CVAR_ARCHIVE,
|
||||
|
|
|
@ -52,7 +52,7 @@
|
|||
extern viddef_t vid; // global video state
|
||||
unsigned short d_8to16table[256];
|
||||
|
||||
cvar_t *_windowed_mouse;
|
||||
cvar_t *in_grab;
|
||||
cvar_t *m_filter;
|
||||
|
||||
#define NUM_STDBUTTONS 3
|
||||
|
@ -62,7 +62,7 @@ static qboolean mouse_avail;
|
|||
static float mouse_x, mouse_y;
|
||||
static float old_mouse_x, old_mouse_y;
|
||||
static int p_mouse_x, p_mouse_y;
|
||||
static float old_windowed_mouse;
|
||||
static float oldin_grab;
|
||||
|
||||
static ggi_visual_t ggivis = NULL;
|
||||
static ggi_mode mode;
|
||||
|
@ -889,15 +889,15 @@ void IN_Frame(void)
|
|||
{
|
||||
/* Only supported by LibGII 0.7 or later. */
|
||||
#ifdef GII_CMDCODE_PREFER_RELPTR
|
||||
if (old_windowed_mouse != _windowed_mouse->value) {
|
||||
if (oldin_grab != in_grab->value) {
|
||||
gii_event ev;
|
||||
|
||||
old_windowed_mouse = _windowed_mouse->value;
|
||||
oldin_grab = in_grab->value;
|
||||
|
||||
ev.cmd.size = sizeof(gii_cmd_nodata_event);
|
||||
ev.cmd.type = evCommand;
|
||||
ev.cmd.target = GII_EV_TARGET_ALL;
|
||||
ev.cmd.code = (int)_windowed_mouse->value ? GII_CMDCODE_PREFER_RELPTR
|
||||
ev.cmd.code = (int)in_grab->value ? GII_CMDCODE_PREFER_RELPTR
|
||||
: GII_CMDCODE_PREFER_ABSPTR;
|
||||
|
||||
ggiEventSend(ggivis, &ev);
|
||||
|
@ -909,9 +909,9 @@ void IN_Frame(void)
|
|||
void
|
||||
IN_Init(void)
|
||||
{
|
||||
_windowed_mouse = Cvar_Get("_windowed_mouse", "0", CVAR_ARCHIVE,
|
||||
in_grab = Cvar_Get("in_grab", "0", CVAR_ARCHIVE,
|
||||
"None");
|
||||
old_windowed_mouse = -1; /* Force update */
|
||||
oldin_grab = -1; /* Force update */
|
||||
m_filter = Cvar_Get("m_filter","0",CVAR_ARCHIVE, "None");
|
||||
if (COM_CheckParm ("-nomouse")) return;
|
||||
|
||||
|
@ -971,7 +971,7 @@ 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);
|
||||
M_DrawCheckbox (220, options_draw_cursor, in_grab->value);
|
||||
}
|
||||
|
||||
|
||||
|
@ -979,8 +979,8 @@ void
|
|||
VID_ExtraOptionCmd(int option_cursor)
|
||||
{
|
||||
switch(option_cursor) {
|
||||
case 1: // _windowed_mouse
|
||||
_windowed_mouse->value = !_windowed_mouse->value;
|
||||
case 1: // in_grab
|
||||
in_grab->value = !in_grab->value;
|
||||
break;
|
||||
|
||||
}
|
||||
|
|
|
@ -30,6 +30,7 @@
|
|||
$Id$
|
||||
*/
|
||||
|
||||
#include <values.h>
|
||||
#include <qtypes.h>
|
||||
#include <quakedef.h>
|
||||
#include <glquake.h>
|
||||
|
@ -165,6 +166,8 @@ VID_Shutdown(void)
|
|||
if (hasvidmode) {
|
||||
int i;
|
||||
|
||||
XF86VidModeSwitchToMode (x_disp, DefaultScreen (x_disp),
|
||||
vidmodes[0]);
|
||||
for (i = 0; i < nummodes; i++) {
|
||||
if (vidmodes[i]->private) XFree(vidmodes[i]->private);
|
||||
}
|
||||
|
@ -417,7 +420,6 @@ void VID_Init(unsigned char *palette)
|
|||
|
||||
vid_mode = Cvar_Get ("vid_mode","0",0,"None");
|
||||
gl_ztrick = Cvar_Get ("gl_ztrick","0",CVAR_ARCHIVE,"None");
|
||||
_windowed_mouse = Cvar_Get ("_windowed_mouse","0",CVAR_ARCHIVE,"None");
|
||||
vid_glx_fullscreen = Cvar_Get ("vid_glx_fullscreen","0",0,"None");
|
||||
#ifdef HAS_DGA
|
||||
vid_dga_mouseaccel = Cvar_Get("vid_dga_mouseaccel","1",CVAR_ARCHIVE,
|
||||
|
@ -508,9 +510,9 @@ void VID_Init(unsigned char *palette)
|
|||
const char *str = getenv("MESA_GLX_FX");
|
||||
if (str != NULL && *str != 'd') {
|
||||
if (tolower(*str) == 'w') {
|
||||
vid_glx_fullscreen->value = 0;
|
||||
Cvar_Set (vid_glx_fullscreen, "0");
|
||||
} else {
|
||||
vid_glx_fullscreen->value = 1;
|
||||
Cvar_Set (vid_glx_fullscreen, "1");
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
@ -526,10 +528,49 @@ void VID_Init(unsigned char *palette)
|
|||
attr.event_mask = X_MASK;
|
||||
mask = CWBackPixel | CWBorderPixel | CWColormap | CWEventMask;
|
||||
|
||||
#ifdef HAS_VIDMODE
|
||||
if (hasvidmode) {
|
||||
int smallest_mode=0, x=MAXINT, y=MAXINT;
|
||||
|
||||
attr.override_redirect=1;
|
||||
mask|=CWOverrideRedirect;
|
||||
|
||||
// FIXME: does this depend on mode line order in XF86Config?
|
||||
for (i=0; i<nummodes; i++) {
|
||||
if (x>vidmodes[i]->hdisplay || y>vidmodes[i]->vdisplay) {
|
||||
smallest_mode=i;
|
||||
x=vidmodes[i]->hdisplay;
|
||||
y=vidmodes[i]->vdisplay;
|
||||
}
|
||||
}
|
||||
// chose the smallest mode that our window fits into;
|
||||
for (i=smallest_mode;
|
||||
i!=(smallest_mode+1)%nummodes;
|
||||
i=(i?i-1:nummodes-1)) {
|
||||
if (vidmodes[i]->hdisplay>=width
|
||||
&& vidmodes[i]->vdisplay>=height) {
|
||||
XF86VidModeSwitchToMode (x_disp, DefaultScreen (x_disp),
|
||||
vidmodes[i]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
XF86VidModeSetViewPort(x_disp, DefaultScreen (x_disp), 0, 0);
|
||||
in_grab = Cvar_Get ("in_grab","1",CVAR_ARCHIVE|CVAR_ROM,"None");
|
||||
} else
|
||||
#endif
|
||||
in_grab = Cvar_Get ("in_grab","0",CVAR_ARCHIVE,"None");
|
||||
|
||||
x_win = XCreateWindow(x_disp, root, 0, 0, width, height,
|
||||
0, visinfo->depth, InputOutput,
|
||||
visinfo->visual, mask, &attr);
|
||||
XMapWindow(x_disp, x_win);
|
||||
#ifdef HAS_VIDMODE
|
||||
if (hasvidmode) {
|
||||
XRaiseWindow(x_disp, x_win);
|
||||
XGrabKeyboard(x_disp, x_win, 1, GrabModeAsync, GrabModeAsync,
|
||||
CurrentTime);
|
||||
}
|
||||
#endif
|
||||
|
||||
XSync(x_disp, 0);
|
||||
|
||||
|
|
|
@ -40,10 +40,10 @@
|
|||
#include <client.h>
|
||||
|
||||
|
||||
cvar_t *_windowed_mouse;
|
||||
cvar_t *in_grab;
|
||||
|
||||
|
||||
static float old_windowed_mouse = 0;
|
||||
static float oldin_grab = 0;
|
||||
|
||||
extern viddef_t vid; // global video state
|
||||
unsigned short d_8to16table[256];
|
||||
|
@ -336,7 +336,7 @@ void Sys_SendKeyEvents(void)
|
|||
break;
|
||||
|
||||
case SDL_MOUSEMOTION:
|
||||
if (_windowed_mouse->value)
|
||||
if (in_grab->value)
|
||||
{
|
||||
if ((event.motion.x != (vid.width/2)) ||
|
||||
(event.motion.y != (vid.height/2)) ) {
|
||||
|
@ -360,9 +360,9 @@ void Sys_SendKeyEvents(void)
|
|||
break;
|
||||
}
|
||||
}
|
||||
if (old_windowed_mouse != _windowed_mouse->value)
|
||||
{ old_windowed_mouse = _windowed_mouse->value;
|
||||
if (_windowed_mouse->value && !COM_CheckParm("-nomouse"))
|
||||
if (oldin_grab != in_grab->value)
|
||||
{ oldin_grab = in_grab->value;
|
||||
if (in_grab->value && !COM_CheckParm("-nomouse"))
|
||||
{ mouse_avail = 1;
|
||||
}
|
||||
else
|
||||
|
@ -373,9 +373,9 @@ void Sys_SendKeyEvents(void)
|
|||
|
||||
void IN_Init (void)
|
||||
{
|
||||
_windowed_mouse = Cvar_Get ("_windowed_mouse","0",CVAR_ARCHIVE,"None");
|
||||
in_grab = Cvar_Get ("in_grab","0",CVAR_ARCHIVE,"None");
|
||||
|
||||
if ( COM_CheckParm("-nomouse") && !_windowed_mouse->value)
|
||||
if ( COM_CheckParm("-nomouse") && !in_grab->value)
|
||||
return;
|
||||
|
||||
mouse_x = mouse_y = 0.0;
|
||||
|
@ -457,14 +457,14 @@ 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);
|
||||
M_DrawCheckbox (220, options_draw_cursor, in_grab->value);
|
||||
}
|
||||
|
||||
void VID_ExtraOptionCmd(int option_cursor)
|
||||
{
|
||||
switch(option_cursor) {
|
||||
case 1: // _windowed_mouse
|
||||
_windowed_mouse->value = !_windowed_mouse->value;
|
||||
case 1: // in_grab
|
||||
in_grab->value = !in_grab->value;
|
||||
break;
|
||||
|
||||
}
|
||||
|
|
|
@ -66,7 +66,7 @@
|
|||
#include <input.h>
|
||||
#include <context_x11.h>
|
||||
|
||||
cvar_t *_windowed_mouse;
|
||||
cvar_t *in_grab;
|
||||
cvar_t *m_filter;
|
||||
|
||||
static qboolean mouse_avail;
|
||||
|
@ -1158,14 +1158,14 @@ 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);
|
||||
M_DrawCheckbox(220, options_draw_cursor, in_grab->value);
|
||||
}
|
||||
|
||||
void VID_ExtraOptionCmd(int option_cursor)
|
||||
{
|
||||
switch (option_cursor) {
|
||||
case 1: // _windowed_mouse
|
||||
_windowed_mouse->value = !_windowed_mouse->value;
|
||||
case 1: // in_grab
|
||||
in_grab->value = !in_grab->value;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -58,9 +58,9 @@
|
|||
#define MIN_WIDTH 320
|
||||
#define MIN_HEIGHT 200
|
||||
|
||||
cvar_t *_windowed_mouse;
|
||||
cvar_t *in_grab;
|
||||
cvar_t *m_filter;
|
||||
float old_windowed_mouse;
|
||||
float oldin_grab;
|
||||
|
||||
// The following X property format is defined in Motif 1.1's
|
||||
// Xm/MwmUtils.h, but QUAKE should not depend on that header
|
||||
|
@ -832,7 +832,7 @@ void GetEvent(void)
|
|||
|
||||
case MotionNotify:
|
||||
|
||||
if (_windowed_mouse->value) {
|
||||
if (in_grab->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));
|
||||
//printf("m: x=%d,y=%d, mx=%3.2f,my=%3.2f\n",
|
||||
|
@ -900,10 +900,10 @@ void GetEvent(void)
|
|||
#endif
|
||||
}
|
||||
|
||||
if (old_windowed_mouse != _windowed_mouse->value) {
|
||||
old_windowed_mouse = _windowed_mouse->value;
|
||||
if (oldin_grab != in_grab->value) {
|
||||
oldin_grab = in_grab->value;
|
||||
|
||||
if (!_windowed_mouse->value) {
|
||||
if (!in_grab->value) {
|
||||
/* ungrab the pointer */
|
||||
XUngrabPointer(x_disp,CurrentTime);
|
||||
} else {
|
||||
|
@ -1195,7 +1195,7 @@ void IN_SendKeyEvents (void)
|
|||
|
||||
void IN_Init (void)
|
||||
{
|
||||
_windowed_mouse = Cvar_Get ("_windowed_mouse","0",CVAR_ARCHIVE,"None");
|
||||
in_grab = Cvar_Get ("in_grab","0",CVAR_ARCHIVE,"None");
|
||||
m_filter = Cvar_Get ("m_filter","0",CVAR_ARCHIVE,"None");
|
||||
if ( COM_CheckParm ("-nomouse") )
|
||||
return;
|
||||
|
@ -1270,14 +1270,14 @@ 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);
|
||||
M_DrawCheckbox (220, options_draw_cursor, in_grab->value);
|
||||
}
|
||||
|
||||
void VID_ExtraOptionCmd(int option_cursor)
|
||||
{
|
||||
switch(option_cursor) {
|
||||
case 1: // _windowed_mouse
|
||||
_windowed_mouse->value = !_windowed_mouse->value;
|
||||
case 1: // in_grab
|
||||
in_grab->value = !in_grab->value;
|
||||
break;
|
||||
|
||||
}
|
||||
|
|
|
@ -170,7 +170,7 @@ cvar_t *_vid_wait_override;
|
|||
cvar_t *vid_config_x;
|
||||
cvar_t *vid_config_y;
|
||||
cvar_t *vid_stretch_by_2;
|
||||
cvar_t *_windowed_mouse;
|
||||
cvar_t *in_grab;
|
||||
|
||||
int window_center_x, window_center_y, window_x, window_y, window_width, window_height;
|
||||
RECT window_rect;
|
||||
|
@ -409,7 +409,7 @@ int VID_SetMode (int modenum, unsigned char *palette)
|
|||
// Set either the fullscreen or windowed mode
|
||||
if (modelist[modenum].type == MS_WINDOWED)
|
||||
{
|
||||
if (_windowed_mouse->value && key_dest == key_game)
|
||||
if (in_grab->value && key_dest == key_game)
|
||||
{
|
||||
stat = VID_SetWindowedMode(modenum);
|
||||
IN_ActivateMouse ();
|
||||
|
@ -690,7 +690,7 @@ void GL_EndRendering (void)
|
|||
// handle the mouse state when windowed if that's changed
|
||||
if (modestate == MS_WINDOWED)
|
||||
{
|
||||
if (!_windowed_mouse->value) {
|
||||
if (!in_grab->value) {
|
||||
if (windowed_mouse) {
|
||||
IN_DeactivateMouse ();
|
||||
IN_ShowMouse ();
|
||||
|
@ -1007,7 +1007,7 @@ void AppActivate(BOOL fActive, BOOL minimize)
|
|||
ShowWindow(mainwindow, SW_SHOWNORMAL);
|
||||
}
|
||||
}
|
||||
else if ((modestate == MS_WINDOWED) && _windowed_mouse->value && key_dest == key_game)
|
||||
else if ((modestate == MS_WINDOWED) && in_grab->value && key_dest == key_game)
|
||||
{
|
||||
IN_ActivateMouse ();
|
||||
IN_HideMouse ();
|
||||
|
@ -1025,7 +1025,7 @@ void AppActivate(BOOL fActive, BOOL minimize)
|
|||
vid_wassuspended = true;
|
||||
}
|
||||
}
|
||||
else if ((modestate == MS_WINDOWED) && _windowed_mouse->value)
|
||||
else if ((modestate == MS_WINDOWED) && in_grab->value)
|
||||
{
|
||||
IN_DeactivateMouse ();
|
||||
IN_ShowMouse ();
|
||||
|
@ -1621,7 +1621,7 @@ void VID_Init (unsigned char *palette)
|
|||
vid_config_y = Cvar_Get ("vid_config_y","600",CVAR_ARCHIVE,"None");
|
||||
vid_stretch_by_2 = Cvar_Get ("vid_stretch_by_2","1",CVAR_ARCHIVE,
|
||||
"None");
|
||||
_windowed_mouse = Cvar_Get ("_windowed_mouse","1",CVAR_ARCHIVE,"None");
|
||||
in_grab = Cvar_Get ("in_grab","1",CVAR_ARCHIVE,"None");
|
||||
gl_ztrick = Cvar_Get ("gl_ztrick","1",CVAR_ARCHIVE,"None");
|
||||
|
||||
Cmd_AddCommand ("vid_nummodes", VID_NumModes_f);
|
||||
|
@ -1983,15 +1983,15 @@ 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);
|
||||
M_DrawCheckbox (220, options_draw_cursor, in_grab->value);
|
||||
}
|
||||
|
||||
void
|
||||
VID_ExtraOptionCmd ( int option_cursor )
|
||||
{
|
||||
switch(option_cursor) {
|
||||
case 1: // _windowed_mouse
|
||||
_windowed_mouse->value = !_windowed_mouse->value;
|
||||
case 1: // in_grab
|
||||
in_grab->value = !in_grab->value;
|
||||
break;
|
||||
|
||||
}
|
||||
|
|
|
@ -107,7 +107,7 @@ cvar_t *_vid_wait_override;
|
|||
cvar_t *vid_config_x;
|
||||
cvar_t *vid_config_y;
|
||||
cvar_t *vid_stretch_by_2;
|
||||
cvar_t *_windowed_mouse;
|
||||
cvar_t *in_grab;
|
||||
cvar_t *vid_fullscreen_mode;
|
||||
cvar_t *vid_windowed_mode;
|
||||
cvar_t *block_switch;
|
||||
|
@ -1682,7 +1682,7 @@ int VID_SetMode (int modenum, unsigned char *palette)
|
|||
// Set either the fullscreen or windowed mode
|
||||
if (modelist[modenum].type == MS_WINDOWED)
|
||||
{
|
||||
if (_windowed_mouse->value && key_dest == key_game)
|
||||
if (in_grab->value && key_dest == key_game)
|
||||
{
|
||||
stat = VID_SetWindowedMode(modenum);
|
||||
IN_ActivateMouse ();
|
||||
|
@ -2159,7 +2159,7 @@ void VID_Init (unsigned char *palette)
|
|||
vid_config_y = Cvar_Get ("vid_config_y","600",CVAR_ARCHIVE,"None");
|
||||
vid_stretch_by_2 = Cvar_Get ("vid_stretch_by_2","1",CVAR_ARCHIVE,
|
||||
"None");
|
||||
_windowed_mouse = Cvar_Get ("_windowed_mouse","0",CVAR_ARCHIVE,"None");
|
||||
in_grab = Cvar_Get ("in_grab","0",CVAR_ARCHIVE,"None");
|
||||
vid_fullscreen_mode = Cvar_Get ("vid_fullscreen_mode","3",CVAR_ARCHIVE,
|
||||
"None");
|
||||
vid_windowed_mode = Cvar_Get ("vid_windowed_mode","0",CVAR_ARCHIVE,
|
||||
|
@ -2471,7 +2471,7 @@ void VID_Update (vrect_t *rects)
|
|||
// handle the mouse state when windowed if that's changed
|
||||
if (modestate == MS_WINDOWED)
|
||||
{
|
||||
if (!_windowed_mouse->value) {
|
||||
if (!in_grab->value) {
|
||||
if (windowed_mouse) {
|
||||
IN_DeactivateMouse ();
|
||||
IN_ShowMouse ();
|
||||
|
@ -2851,7 +2851,7 @@ void AppActivate(BOOL fActive, BOOL minimize)
|
|||
IN_ActivateMouse ();
|
||||
IN_HideMouse ();
|
||||
}
|
||||
else if ((modestate == MS_WINDOWED) && _windowed_mouse->value && key_dest == key_game)
|
||||
else if ((modestate == MS_WINDOWED) && in_grab->value && key_dest == key_game)
|
||||
{
|
||||
IN_ActivateMouse ();
|
||||
IN_HideMouse ();
|
||||
|
@ -2883,7 +2883,7 @@ void AppActivate(BOOL fActive, BOOL minimize)
|
|||
IN_DeactivateMouse ();
|
||||
IN_ShowMouse ();
|
||||
}
|
||||
else if ((modestate == MS_WINDOWED) && _windowed_mouse->value)
|
||||
else if ((modestate == MS_WINDOWED) && in_grab->value)
|
||||
{
|
||||
IN_DeactivateMouse ();
|
||||
IN_ShowMouse ();
|
||||
|
@ -2901,7 +2901,7 @@ VID_HandlePause
|
|||
void VID_HandlePause (qboolean pause)
|
||||
{ // Why?
|
||||
#if 0
|
||||
if ((modestate == MS_WINDOWED) && _windowed_mouse->value)
|
||||
if ((modestate == MS_WINDOWED) && in_grab->value)
|
||||
{
|
||||
if (pause)
|
||||
{
|
||||
|
@ -3470,15 +3470,15 @@ void VID_ExtraOptionDraw(unsigned int options_draw_cursor)
|
|||
if (modestate == MS_WINDOWED) {
|
||||
// Windowed 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, in_grab->value);
|
||||
}
|
||||
}
|
||||
|
||||
void VID_ExtraOptionCmd(int option_cursor)
|
||||
{
|
||||
switch(option_cursor) {
|
||||
case 1: // _windowed_mouse
|
||||
_windowed_mouse->value = !_windowed_mouse->value;
|
||||
case 1: // in_grab
|
||||
in_grab->value = !in_grab->value;
|
||||
break;
|
||||
|
||||
}
|
||||
|
|
|
@ -33,6 +33,7 @@
|
|||
#define _BSD
|
||||
#include <config.h>
|
||||
|
||||
#include <values.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
@ -64,6 +65,10 @@
|
|||
#include <client.h>
|
||||
#include <input.h>
|
||||
#include <context_x11.h>
|
||||
#ifdef HAS_VIDMODE
|
||||
# include <X11/extensions/xf86vmode.h>
|
||||
#endif
|
||||
#include <dga_check.h>
|
||||
|
||||
#ifdef HAVE_STRINGS_H
|
||||
#include <strings.h>
|
||||
|
@ -79,6 +84,11 @@ static Visual *x_vis;
|
|||
static XVisualInfo *x_visinfo;
|
||||
static Atom aWMDelete = 0;
|
||||
|
||||
#ifdef HAS_VIDMODE
|
||||
static XF86VidModeModeInfo **vidmodes;
|
||||
static int nummodes, hasvidmode = 0;
|
||||
#endif
|
||||
|
||||
int XShmQueryExtension(Display *);
|
||||
int XShmGetEventBase(Display *);
|
||||
|
||||
|
@ -474,6 +484,18 @@ void VID_Init (unsigned char *palette)
|
|||
// open the display
|
||||
x11_open_display();
|
||||
|
||||
#ifdef HAS_VIDMODE
|
||||
hasvidmode = VID_CheckVMode(x_disp, NULL, NULL);
|
||||
if (hasvidmode) {
|
||||
if (! XF86VidModeGetAllModeLines(x_disp, DefaultScreen(x_disp),
|
||||
&nummodes, &vidmodes)
|
||||
|| nummodes <= 0) {
|
||||
hasvidmode = 0;
|
||||
}
|
||||
}
|
||||
Con_SafePrintf ("hasvidmode = %i\nnummodes = %i\n", hasvidmode, nummodes);
|
||||
#endif
|
||||
|
||||
// check for command-line window size
|
||||
if ((pnum=COM_CheckParm("-winsize")))
|
||||
{
|
||||
|
@ -558,6 +580,38 @@ void VID_Init (unsigned char *palette)
|
|||
attribs.event_mask = STD_EVENT_MASK;
|
||||
attribs.border_pixel = 0;
|
||||
|
||||
#ifdef HAS_VIDMODE
|
||||
if (hasvidmode) {
|
||||
int smallest_mode=0, x=MAXINT, y=MAXINT;
|
||||
|
||||
attribs.override_redirect=1;
|
||||
attribmask|=CWOverrideRedirect;
|
||||
|
||||
// FIXME: does this depend on mode line order in XF86Config?
|
||||
for (i=0; i<nummodes; i++) {
|
||||
if (x>vidmodes[i]->hdisplay || y>vidmodes[i]->vdisplay) {
|
||||
smallest_mode=i;
|
||||
x=vidmodes[i]->hdisplay;
|
||||
y=vidmodes[i]->vdisplay;
|
||||
}
|
||||
}
|
||||
// chose the smallest mode that our window fits into;
|
||||
for (i=smallest_mode;
|
||||
i!=(smallest_mode+1)%nummodes;
|
||||
i=(i?i-1:nummodes-1)) {
|
||||
if (vidmodes[i]->hdisplay>=vid.width
|
||||
&& vidmodes[i]->vdisplay>=vid.height) {
|
||||
XF86VidModeSwitchToMode (x_disp, DefaultScreen (x_disp),
|
||||
vidmodes[i]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
XF86VidModeSetViewPort(x_disp, DefaultScreen (x_disp), 0, 0);
|
||||
in_grab = Cvar_Get ("in_grab","1",CVAR_ARCHIVE|CVAR_ROM,"None");
|
||||
} else
|
||||
#endif
|
||||
in_grab = Cvar_Get ("in_grab","0",CVAR_ARCHIVE,"None");
|
||||
|
||||
/* Create the main window */
|
||||
x_win = XCreateWindow(x_disp,
|
||||
XRootWindow(x_disp, x_visinfo->screen),
|
||||
|
@ -691,6 +745,18 @@ VID_Shutdown(void)
|
|||
{
|
||||
Sys_Printf("VID_Shutdown\n");
|
||||
if (x_disp) {
|
||||
#ifdef HAS_VIDMODE
|
||||
if (hasvidmode) {
|
||||
int i;
|
||||
|
||||
XF86VidModeSwitchToMode (x_disp, DefaultScreen (x_disp),
|
||||
vidmodes[0]);
|
||||
for (i = 0; i < nummodes; i++) {
|
||||
if (vidmodes[i]->private) XFree(vidmodes[i]->private);
|
||||
}
|
||||
XFree(vidmodes);
|
||||
}
|
||||
#endif
|
||||
XAutoRepeatOn(x_disp);
|
||||
x11_close_display();
|
||||
x_disp = 0;
|
||||
|
|
|
@ -176,7 +176,7 @@ $(BUILD_DIR)/common_lib.a: $(ALL_COMMON_LIB_OBJS)
|
|||
ifneq ($(X11QUAKE),)
|
||||
|
||||
ALL_X11_SRC = $(SW_REND_SRC) @X11_VID_SRC@\
|
||||
model.c in_x11.c context_x11.c
|
||||
model.c dga_check.c in_x11.c context_x11.c
|
||||
ALL_X11_OBJS = $(patsubst %,$(BUILD_DIR)/%,$(addsuffix .@OBJEXT@,\
|
||||
$(basename $(ALL_X11_SRC) .c .s))) \
|
||||
$(BUILD_DIR)/common_lib.a $(TARGET_DIR)/sound_lib.a
|
||||
|
|
|
@ -180,8 +180,8 @@ $(BUILD_DIR)/common_lib.a: $(ALL_COMMON_LIB_OBJS)
|
|||
|
||||
ifneq ($(X11QUAKE),)
|
||||
|
||||
ALL_X11_SRC = $(CD_AUDIO_SRC) $(SW_REND_SRC) @X11_VID_SRC@ model.c in_x11.c \
|
||||
context_x11.c
|
||||
ALL_X11_SRC = $(CD_AUDIO_SRC) $(SW_REND_SRC) @X11_VID_SRC@ model.c \
|
||||
dga_check.c in_x11.c context_x11.c
|
||||
ALL_X11_OBJS = $(patsubst %,$(BUILD_DIR)/%,$(addsuffix .@OBJEXT@,\
|
||||
$(basename $(ALL_X11_SRC) .c .s))) \
|
||||
$(BUILD_DIR)/common_lib.a \
|
||||
|
|
Loading…
Reference in a new issue