2004-09-26 03:39:27 +00:00
|
|
|
/*
|
|
|
|
Copyright (C) 1996-1997 Id Software, Inc.
|
|
|
|
|
|
|
|
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.
|
|
|
|
|
|
|
|
*/
|
|
|
|
// vid_x.c -- general x video driver
|
|
|
|
|
|
|
|
#define _BSD
|
|
|
|
|
|
|
|
#include "quakedef.h"
|
|
|
|
#include "d_local.h"
|
|
|
|
|
2006-11-01 07:23:08 +00:00
|
|
|
// these need to be fixed to assured n-bit types
|
2004-09-26 03:39:27 +00:00
|
|
|
typedef unsigned short PIXEL;
|
2006-11-01 07:23:08 +00:00
|
|
|
typedef unsigned int PIXEL32;
|
2004-09-26 03:39:27 +00:00
|
|
|
|
|
|
|
#include <ctype.h>
|
|
|
|
#include <sys/time.h>
|
|
|
|
#include <sys/types.h>
|
|
|
|
#include <unistd.h>
|
|
|
|
#include <signal.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <string.h>
|
|
|
|
#ifdef __CYGWIN__
|
|
|
|
#include <cygwin/ipc.h>
|
|
|
|
#include <cygwin/shm.h>
|
|
|
|
#else
|
|
|
|
#include <sys/ipc.h>
|
|
|
|
#include <sys/shm.h>
|
|
|
|
#endif
|
|
|
|
#include <X11/Xlib.h>
|
|
|
|
#include <X11/Xutil.h>
|
|
|
|
#include <X11/Xatom.h>
|
|
|
|
#include <X11/keysym.h>
|
|
|
|
#include <X11/extensions/XShm.h>
|
|
|
|
|
2007-07-23 11:48:53 +00:00
|
|
|
#ifdef __linux__
|
|
|
|
#define WITH_VMODE //undefine this if the following include fails.
|
2004-09-26 03:39:27 +00:00
|
|
|
#endif
|
2007-07-23 11:48:53 +00:00
|
|
|
#ifdef WITH_VMODE
|
|
|
|
#include <X11/extensions/xf86vmode.h>
|
2004-09-26 03:39:27 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
|
2007-07-23 11:48:53 +00:00
|
|
|
#undef free
|
2004-09-26 03:39:27 +00:00
|
|
|
|
2007-07-23 11:48:53 +00:00
|
|
|
#ifdef __CYGWIN__
|
|
|
|
#define NOSHM
|
2004-09-26 03:39:27 +00:00
|
|
|
#endif
|
|
|
|
|
2007-07-23 11:48:53 +00:00
|
|
|
#define NOSHM
|
|
|
|
|
2004-09-26 03:39:27 +00:00
|
|
|
cvar_t m_filter = {"m_filter","0", NULL, CVAR_ARCHIVE};
|
2005-08-06 22:39:28 +00:00
|
|
|
cvar_t m_accel = {"m_accel", "0"};
|
2004-09-26 03:39:27 +00:00
|
|
|
#ifdef IN_XFLIP
|
|
|
|
cvar_t in_xflip = {"in_xflip", "0"};
|
|
|
|
#endif
|
2007-07-23 11:48:53 +00:00
|
|
|
static qboolean old_windowed_mouse;
|
2004-09-26 03:39:27 +00:00
|
|
|
|
2007-07-23 11:48:53 +00:00
|
|
|
static qboolean mouse_avail;
|
|
|
|
static qboolean mouseactive;
|
|
|
|
static int mouse_buttons=3;
|
|
|
|
static int mouse_oldbuttonstate;
|
|
|
|
static int mouse_buttonstate;
|
2004-09-26 03:39:27 +00:00
|
|
|
float mouse_x, mouse_y;
|
2007-07-23 11:48:53 +00:00
|
|
|
static float old_mouse_x, old_mouse_y;
|
|
|
|
static int p_mouse_x;
|
|
|
|
static int p_mouse_y;
|
|
|
|
static int ignorenext;
|
|
|
|
|
|
|
|
static int focusedapp;
|
2004-09-26 03:39:27 +00:00
|
|
|
|
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
int input;
|
|
|
|
int output;
|
|
|
|
} keymap_t;
|
|
|
|
|
|
|
|
viddef_t vid; // global video state
|
|
|
|
//unsigned short d_8to16table[256];
|
|
|
|
|
|
|
|
#ifdef RGLQUAKE
|
|
|
|
extern Display *vid_dpy;
|
|
|
|
#else
|
|
|
|
static Display *vid_dpy = NULL;
|
|
|
|
#endif
|
|
|
|
static Colormap x_cmap;
|
|
|
|
static Window x_win;
|
|
|
|
static GC x_gc;
|
|
|
|
static Visual *x_vis;
|
|
|
|
static XVisualInfo *x_visinfo;
|
|
|
|
//static XImage *x_image;
|
|
|
|
|
|
|
|
static qboolean oktodraw = false;
|
|
|
|
|
2007-07-23 11:48:53 +00:00
|
|
|
#ifndef NOSHM
|
|
|
|
static int x_shmeventtype;
|
|
|
|
static qboolean doShm;
|
2004-09-26 03:39:27 +00:00
|
|
|
int XShmQueryExtension(Display *);
|
|
|
|
int XShmGetEventBase(Display *);
|
|
|
|
static XShmSegmentInfo x_shminfo[2];
|
2007-07-23 11:48:53 +00:00
|
|
|
#endif
|
2004-09-26 03:39:27 +00:00
|
|
|
|
2007-07-23 11:48:53 +00:00
|
|
|
static int current_framebuffer;
|
|
|
|
static XImage *x_framebuffer[2] = { 0, 0 };
|
2004-09-26 03:39:27 +00:00
|
|
|
|
|
|
|
qbyte vid_curpal[768];
|
|
|
|
|
|
|
|
static long X11_highhunkmark;
|
|
|
|
static long X11_buffersize;
|
|
|
|
|
2007-07-23 11:48:53 +00:00
|
|
|
static int vid_surfcachesize;
|
|
|
|
static void *vid_surfcache;
|
2004-09-26 03:39:27 +00:00
|
|
|
|
|
|
|
static PIXEL st2d_8to16table[256];
|
|
|
|
static PIXEL32 st3d_8to32table[256];
|
|
|
|
static int shiftmask_fl=0;
|
|
|
|
static long r_shift,g_shift,b_shift;
|
|
|
|
static unsigned long r_mask,g_mask,b_mask;
|
|
|
|
|
|
|
|
void shiftmask_init()
|
|
|
|
{
|
|
|
|
unsigned int x;
|
|
|
|
r_mask=x_vis->red_mask;
|
|
|
|
g_mask=x_vis->green_mask;
|
|
|
|
b_mask=x_vis->blue_mask;
|
|
|
|
for(r_shift=-8,x=1;x<r_mask;x=x<<1)r_shift++;
|
|
|
|
for(g_shift=-8,x=1;x<g_mask;x=x<<1)g_shift++;
|
|
|
|
for(b_shift=-8,x=1;x<b_mask;x=x<<1)b_shift++;
|
|
|
|
shiftmask_fl=1;
|
|
|
|
|
|
|
|
redshift = 0;//r_shift;
|
|
|
|
greenshift = 5;//g_shift;
|
|
|
|
blueshift = 10;//b_shift;
|
|
|
|
|
|
|
|
redbits = 5;
|
|
|
|
greenbits = 5;
|
|
|
|
bluebits = 5;
|
|
|
|
}
|
|
|
|
|
|
|
|
PIXEL xlib_rgb(int r,int g,int b)
|
|
|
|
{
|
|
|
|
PIXEL p;
|
|
|
|
if(shiftmask_fl==0) shiftmask_init();
|
|
|
|
p=0;
|
|
|
|
|
|
|
|
if(r_shift>0) {
|
|
|
|
p=(r<<(r_shift))&r_mask;
|
|
|
|
} else if(r_shift<0) {
|
|
|
|
p=(r>>(-r_shift))&r_mask;
|
|
|
|
} else p|=(r&r_mask);
|
|
|
|
|
|
|
|
if(g_shift>0) {
|
|
|
|
p|=(g<<(g_shift))&g_mask;
|
|
|
|
} else if(g_shift<0) {
|
|
|
|
p|=(g>>(-g_shift))&g_mask;
|
|
|
|
} else p|=(g&g_mask);
|
|
|
|
|
|
|
|
if(b_shift>0) {
|
|
|
|
p|=(b<<(b_shift))&b_mask;
|
|
|
|
} else if(b_shift<0) {
|
|
|
|
p|=(b>>(-b_shift))&b_mask;
|
|
|
|
} else p|=(b&b_mask);
|
|
|
|
|
|
|
|
return p;
|
|
|
|
}
|
|
|
|
PIXEL32 xlib_rgb32(int r, int g, int b)
|
|
|
|
{
|
|
|
|
PIXEL32 p=0;
|
|
|
|
p = r<<16;
|
|
|
|
p|= g<<8;
|
|
|
|
p|= b;
|
2007-07-20 17:40:36 +00:00
|
|
|
return p;
|
2004-09-26 03:39:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void st2_fixup( XImage *framebuf, int x, int y, int width, int height)
|
|
|
|
{
|
|
|
|
int xi,yi;
|
|
|
|
unsigned char *src;
|
|
|
|
PIXEL *dest;
|
|
|
|
|
|
|
|
if (r_pixbytes == 2)
|
|
|
|
return;
|
|
|
|
|
|
|
|
if( (x<0)||(y<0) )return;
|
|
|
|
|
2007-07-23 11:48:53 +00:00
|
|
|
for (yi = y; yi < (y+height); yi++)
|
|
|
|
{
|
2004-09-26 03:39:27 +00:00
|
|
|
src = &framebuf->data [yi * framebuf->bytes_per_line];
|
|
|
|
dest = (PIXEL*)src;
|
2007-07-23 11:48:53 +00:00
|
|
|
for(xi = (x+width-1); xi >= x; xi--)
|
|
|
|
{
|
2004-09-26 03:39:27 +00:00
|
|
|
dest[xi] = st2d_8to16table[src[xi]];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void st3_fixup( XImage *framebuf, int x, int y, int width, int height)
|
|
|
|
{
|
|
|
|
int xi, yi;
|
|
|
|
unsigned char *src;
|
|
|
|
PIXEL32 *dest;
|
|
|
|
if (r_pixbytes == 4)
|
|
|
|
return;
|
2007-07-23 11:48:53 +00:00
|
|
|
for (yi = y; yi < (y+height); yi++)
|
|
|
|
{
|
2004-09-26 03:39:27 +00:00
|
|
|
src = &framebuf->data [yi * framebuf->bytes_per_line];
|
|
|
|
dest = (PIXEL32*)src;
|
2007-07-23 11:48:53 +00:00
|
|
|
for (xi = (x+width-1); xi >= x; xi--)
|
|
|
|
{
|
2004-09-26 03:39:27 +00:00
|
|
|
dest[xi] = st3d_8to32table[src[xi]];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// ========================================================================
|
|
|
|
// Tragic death handler
|
|
|
|
// ========================================================================
|
|
|
|
|
|
|
|
void TragicDeath(int signal_num)
|
|
|
|
{
|
|
|
|
XAutoRepeatOn(vid_dpy);
|
|
|
|
XCloseDisplay(vid_dpy);
|
|
|
|
vid_dpy = NULL;
|
|
|
|
Sys_Error("This death brought to you by the number %d\n", signal_num);
|
|
|
|
}
|
|
|
|
|
|
|
|
// ========================================================================
|
|
|
|
// 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;
|
|
|
|
}
|
|
|
|
|
|
|
|
void ResetFrameBuffer(void)
|
|
|
|
{
|
|
|
|
int mem;
|
|
|
|
int pwidth;
|
|
|
|
|
|
|
|
if (x_framebuffer[0])
|
|
|
|
{
|
|
|
|
BZ_Free(x_framebuffer[0]->data);
|
|
|
|
free(x_framebuffer[0]);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (d_pzbuffer)
|
|
|
|
{
|
|
|
|
D_FlushCaches ();
|
|
|
|
Hunk_FreeToHighMark (X11_highhunkmark);
|
|
|
|
d_pzbuffer = NULL;
|
|
|
|
}
|
|
|
|
X11_highhunkmark = Hunk_HighMark ();
|
|
|
|
|
|
|
|
// alloc an extra line in case we want to wrap, and allocate the z-buffer
|
|
|
|
X11_buffersize = vid.width * vid.height * sizeof (*d_pzbuffer);
|
|
|
|
|
|
|
|
vid_surfcachesize = D_SurfaceCacheForRes (vid.width, vid.height, 0);
|
|
|
|
|
|
|
|
X11_buffersize += vid_surfcachesize;
|
|
|
|
|
|
|
|
d_pzbuffer = Hunk_HighAllocName (X11_buffersize, "video");
|
|
|
|
if (d_pzbuffer == NULL)
|
|
|
|
Sys_Error ("Not enough memory for video mode\n");
|
|
|
|
|
|
|
|
vid_surfcache = (qbyte *) d_pzbuffer
|
|
|
|
+ vid.width * vid.height * sizeof (*d_pzbuffer);
|
|
|
|
|
|
|
|
D_InitCaches(vid_surfcache, vid_surfcachesize);
|
|
|
|
|
|
|
|
pwidth = x_visinfo->depth / 8;
|
|
|
|
if (pwidth == 3) pwidth = 4;
|
|
|
|
mem = ((vid.width*pwidth+7)&~7) * vid.height * r_pixbytes;
|
|
|
|
|
|
|
|
x_framebuffer[0] = XCreateImage( vid_dpy,
|
|
|
|
x_vis,
|
|
|
|
x_visinfo->depth,
|
|
|
|
ZPixmap,
|
|
|
|
0,
|
|
|
|
BZ_Malloc(mem),
|
|
|
|
vid.width, vid.height,
|
|
|
|
32,
|
|
|
|
0);
|
|
|
|
|
|
|
|
if (!x_framebuffer[0])
|
|
|
|
Sys_Error("VID: XCreateImage failed\n");
|
|
|
|
|
2006-10-31 04:12:20 +00:00
|
|
|
vid.buffer = (qbyte*) (x_framebuffer[0]->data);
|
2004-09-26 03:39:27 +00:00
|
|
|
vid.conbuffer = vid.buffer;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2007-07-23 11:48:53 +00:00
|
|
|
#ifndef NOSHM
|
2004-09-26 03:39:27 +00:00
|
|
|
void ResetSharedFrameBuffers(void)
|
|
|
|
{
|
|
|
|
|
|
|
|
int size;
|
|
|
|
int key;
|
|
|
|
int minsize = getpagesize();
|
|
|
|
int frm;
|
|
|
|
|
|
|
|
if (d_pzbuffer)
|
|
|
|
{
|
|
|
|
D_FlushCaches ();
|
|
|
|
Hunk_FreeToHighMark (X11_highhunkmark);
|
|
|
|
d_pzbuffer = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
X11_highhunkmark = Hunk_HighMark ();
|
|
|
|
|
|
|
|
// alloc an extra line in case we want to wrap, and allocate the z-buffer
|
|
|
|
X11_buffersize = vid.width * vid.height * sizeof (*d_pzbuffer);
|
|
|
|
|
|
|
|
vid_surfcachesize = D_SurfaceCacheForRes (vid.width, vid.height, 0);
|
|
|
|
|
|
|
|
X11_buffersize += vid_surfcachesize;
|
|
|
|
|
|
|
|
d_pzbuffer = Hunk_HighAllocName (X11_buffersize, "video");
|
|
|
|
if (d_pzbuffer == NULL)
|
|
|
|
Sys_Error ("Not enough memory for video mode\n");
|
|
|
|
|
|
|
|
vid_surfcache = (qbyte *) d_pzbuffer
|
|
|
|
+ vid.width * vid.height * sizeof (*d_pzbuffer);
|
|
|
|
|
|
|
|
D_InitCaches(vid_surfcache, vid_surfcachesize);
|
|
|
|
|
|
|
|
for (frm=0 ; frm<2 ; frm++)
|
|
|
|
{
|
|
|
|
|
|
|
|
// free up old frame buffer memory
|
|
|
|
|
|
|
|
if (x_framebuffer[frm])
|
|
|
|
{
|
|
|
|
XShmDetach(vid_dpy, &x_shminfo[frm]);
|
|
|
|
free(x_framebuffer[frm]);
|
|
|
|
shmdt(x_shminfo[frm].shmaddr);
|
|
|
|
}
|
|
|
|
|
|
|
|
// create the image
|
|
|
|
|
|
|
|
x_framebuffer[frm] = XShmCreateImage( vid_dpy,
|
|
|
|
x_vis,
|
|
|
|
x_visinfo->depth,
|
|
|
|
ZPixmap,
|
|
|
|
0,
|
|
|
|
&x_shminfo[frm],
|
|
|
|
vid.width,
|
|
|
|
vid.height );
|
|
|
|
|
|
|
|
// grab shared memory
|
|
|
|
|
|
|
|
size = x_framebuffer[frm]->bytes_per_line*r_pixbytes
|
|
|
|
* x_framebuffer[frm]->height;
|
|
|
|
if (size < minsize)
|
|
|
|
Sys_Error("VID: Window must use at least %d bytes\n", minsize);
|
|
|
|
|
|
|
|
key = random();
|
|
|
|
x_shminfo[frm].shmid = shmget((key_t)key, size, IPC_CREAT|0777);
|
|
|
|
if (x_shminfo[frm].shmid==-1)
|
|
|
|
Sys_Error("VID: Could not get any shared memory\n");
|
|
|
|
|
|
|
|
// attach to the shared memory segment
|
|
|
|
x_shminfo[frm].shmaddr =
|
|
|
|
(void *) shmat(x_shminfo[frm].shmid, 0, 0);
|
|
|
|
|
|
|
|
printf("VID: shared memory id=%d, addr=0x%lx\n", x_shminfo[frm].shmid,
|
|
|
|
(long) x_shminfo[frm].shmaddr);
|
|
|
|
|
|
|
|
x_framebuffer[frm]->data = x_shminfo[frm].shmaddr;
|
|
|
|
|
|
|
|
// get the X server to attach to it
|
|
|
|
|
|
|
|
if (!XShmAttach(vid_dpy, &x_shminfo[frm]))
|
|
|
|
Sys_Error("VID: XShmAttach() failed\n");
|
|
|
|
XSync(vid_dpy, 0);
|
|
|
|
shmctl(x_shminfo[frm].shmid, IPC_RMID, 0);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
2007-07-23 11:48:53 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
int X_TryChangeResolution(int trywidth, int tryheight, int onscreen)
|
|
|
|
{
|
|
|
|
#ifdef WITH_VMODE
|
|
|
|
int MajorVersion = 0, MinorVersion = 0;
|
|
|
|
int vidmode_ext;
|
|
|
|
int vidmode_usemode;
|
|
|
|
|
|
|
|
if (COM_CheckParm("-novmode") || !XF86VidModeQueryVersion(vid_dpy, &MajorVersion, &MinorVersion))
|
|
|
|
{
|
|
|
|
vidmode_ext = 0;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
Con_Printf("Using XF86-VidModeExtension Ver. %d.%d\n", MajorVersion, MinorVersion);
|
|
|
|
vidmode_ext = MajorVersion;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
vidmode_usemode = -1;
|
|
|
|
if (vidmode_ext)
|
|
|
|
{
|
|
|
|
int best_fit, best_dist, dist, x, y;
|
|
|
|
|
|
|
|
int i;
|
|
|
|
int num_vidmodes;
|
|
|
|
XF86VidModeModeInfo **vidmodes;
|
|
|
|
|
|
|
|
XF86VidModeGetAllModeLines(vid_dpy, onscreen, &num_vidmodes, &vidmodes);
|
|
|
|
// Are we going fullscreen? If so, let's change video mode
|
|
|
|
{
|
|
|
|
best_dist = 9999999;
|
|
|
|
best_fit = -1;
|
|
|
|
|
|
|
|
for (i = 0; i < num_vidmodes; i++)
|
|
|
|
{
|
|
|
|
if (trywidth > vidmodes[i]->hdisplay ||
|
|
|
|
tryheight > vidmodes[i]->vdisplay)
|
|
|
|
continue;
|
|
|
|
|
|
|
|
x = trywidth - vidmodes[i]->hdisplay;
|
|
|
|
y = tryheight - vidmodes[i]->vdisplay;
|
|
|
|
dist = (x * x) + (y * y);
|
|
|
|
if (dist < best_dist)
|
|
|
|
{
|
|
|
|
best_dist = dist;
|
|
|
|
best_fit = i;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (best_fit != -1)// && (!best_dist || COM_CheckParm("-fullscreen")))
|
|
|
|
{
|
|
|
|
vid.width = vidmodes[best_fit]->hdisplay;
|
|
|
|
vid.height = vidmodes[best_fit]->vdisplay;
|
|
|
|
|
|
|
|
// if (best_dist)
|
|
|
|
Con_Printf("Matched res to %ix%i\n", vid.width, vid.height);
|
|
|
|
|
|
|
|
// change to the mode
|
|
|
|
XF86VidModeSwitchToMode(vid_dpy, onscreen, vidmodes[vidmode_usemode=best_fit]);
|
|
|
|
// vidmode_active = true;
|
|
|
|
// Move the viewport to top left
|
|
|
|
XF86VidModeSetViewPort(vid_dpy, onscreen, 0, 0);
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
void X_StoreIconData(unsigned long *data, unsigned int elems)
|
|
|
|
{
|
|
|
|
Atom propname = XInternAtom(vid_dpy, "_NET_WM_ICON", false);
|
|
|
|
Atom proptype = XInternAtom(vid_dpy, "CARDINAL", false);
|
|
|
|
|
|
|
|
XChangeProperty(vid_dpy, x_win, propname, proptype, 32, PropModeReplace, (void*)data, elems);
|
|
|
|
}
|
|
|
|
|
|
|
|
void X_SetWMHints(void)
|
|
|
|
{ //this entire function is to appease wmaker
|
|
|
|
char *fakeappname[] = {"false", NULL};
|
|
|
|
XWMHints wmhints;
|
|
|
|
XClassHint clshint;
|
|
|
|
|
|
|
|
//the classname (the thing that never changes, as opposed to what the app says it is)
|
|
|
|
memset(&clshint, 0, sizeof(clshint));
|
|
|
|
clshint.res_name = "FTEQuakeWorld";
|
|
|
|
clshint.res_class = "FTEQW";
|
|
|
|
XSetClassHint(vid_dpy, x_win, &clshint);
|
|
|
|
|
|
|
|
//the command to restart the app (no idea why wmaker wants this
|
|
|
|
XSetCommand(vid_dpy, x_win, fakeappname, 1);
|
|
|
|
|
|
|
|
memset(&wmhints, 0, sizeof(wmhints));
|
|
|
|
wmhints.flags = InputHint|StateHint|WindowGroupHint;
|
|
|
|
wmhints.input = true; //give us input!!!
|
|
|
|
wmhints.initial_state = NormalState;
|
|
|
|
wmhints.window_group = x_win; //this is the only bit that is really required
|
|
|
|
XSetWMHints(vid_dpy, x_win, &wmhints);
|
|
|
|
}
|
|
|
|
|
|
|
|
#include "bymorphed.h"
|
|
|
|
void X_StoreIcon(void)
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
int elems;
|
|
|
|
unsigned long data[64*64+2]; //xlib requires long, even on 64bit
|
|
|
|
unsigned int *indata;
|
|
|
|
indata = (unsigned int*)icon.pixel_data;
|
|
|
|
|
|
|
|
X_SetWMHints();
|
|
|
|
|
|
|
|
memset(data, 0, sizeof(data));
|
|
|
|
|
|
|
|
data[0] = icon.width;
|
|
|
|
data[1] = icon.height;
|
|
|
|
elems = data[0]*data[1]+2;
|
|
|
|
|
|
|
|
for (i = 0; i < data[0]*data[1]; i++)
|
|
|
|
{
|
|
|
|
data[i+2] = indata[i];
|
|
|
|
}
|
|
|
|
X_StoreIconData(data, elems);
|
|
|
|
}
|
2004-09-26 03:39:27 +00:00
|
|
|
|
|
|
|
// 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 video driver will need it again
|
|
|
|
|
|
|
|
qboolean SWVID_Init (rendererstate_t *info, unsigned char *palette)
|
|
|
|
{
|
|
|
|
|
|
|
|
int pnum, i;
|
|
|
|
XVisualInfo template;
|
|
|
|
int num_visuals;
|
|
|
|
int template_mask;
|
|
|
|
|
|
|
|
S_Startup();
|
|
|
|
|
|
|
|
ignorenext=0;
|
|
|
|
vid.width = info->width;
|
|
|
|
vid.height = info->height;
|
|
|
|
vid.maxwarpwidth = WARP_WIDTH;
|
|
|
|
vid.maxwarpheight = WARP_HEIGHT;
|
|
|
|
vid.numpages = 2;
|
|
|
|
vid.colormap = host_colormap;
|
|
|
|
// vid.cbits = VID_CBITS;
|
|
|
|
// vid.grades = VID_GRADES;
|
|
|
|
|
|
|
|
r_pixbytes = info->bpp/8;
|
|
|
|
|
|
|
|
srandom(getpid());
|
|
|
|
|
|
|
|
// open the display
|
|
|
|
if (!vid_dpy)
|
|
|
|
vid_dpy = XOpenDisplay(0);
|
|
|
|
if (!vid_dpy)
|
|
|
|
{
|
|
|
|
if (getenv("DISPLAY"))
|
|
|
|
Con_Printf("VID: Could not open display [%s]\n",
|
|
|
|
getenv("DISPLAY"));
|
|
|
|
else
|
|
|
|
Con_Printf("VID: Could not open local display\n");
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
// 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(vid_dpy);
|
|
|
|
|
|
|
|
// for debugging only
|
|
|
|
XSynchronize(vid_dpy, True);
|
|
|
|
|
|
|
|
template_mask = 0;
|
|
|
|
|
|
|
|
// specify a visual id
|
|
|
|
if ((pnum=COM_CheckParm("-visualid")))
|
|
|
|
{
|
|
|
|
if (pnum >= com_argc-1)
|
|
|
|
Sys_Error("VID: -visualid <id#>\n");
|
|
|
|
template.visualid = Q_atoi(com_argv[pnum+1]);
|
|
|
|
template_mask = VisualIDMask;
|
|
|
|
}
|
|
|
|
|
|
|
|
// If not specified, use default visual
|
|
|
|
else
|
|
|
|
{
|
|
|
|
int screen;
|
|
|
|
screen = XDefaultScreen(vid_dpy);
|
|
|
|
template.visualid =
|
|
|
|
XVisualIDFromVisual(XDefaultVisual(vid_dpy, screen));
|
|
|
|
template_mask = VisualIDMask;
|
|
|
|
}
|
|
|
|
|
|
|
|
// pick a visual- warn if more than one was available
|
|
|
|
x_visinfo = XGetVisualInfo(vid_dpy, template_mask, &template, &num_visuals);
|
|
|
|
if (num_visuals > 1)
|
|
|
|
{
|
|
|
|
Con_Printf("Found more than one visual id at depth %d:\n", template.depth);
|
|
|
|
for (i=0 ; i<num_visuals ; i++)
|
2006-11-01 07:23:08 +00:00
|
|
|
Con_Printf(" -visualid %d\n", (int)(x_visinfo[i].visualid));
|
2004-09-26 03:39:27 +00:00
|
|
|
}
|
|
|
|
else if (num_visuals == 0)
|
|
|
|
{
|
|
|
|
if (template_mask == VisualIDMask)
|
|
|
|
{
|
|
|
|
Con_Printf("VID: Bad visual id %d\n", template.visualid);
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
Con_Printf("VID: No visuals at depth %d\n", template.depth);
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2007-07-23 11:48:53 +00:00
|
|
|
Con_DPrintf("Using visualid %d:\n", (int)(x_visinfo->visualid));
|
|
|
|
Con_DPrintf(" screen %d\n", x_visinfo->screen);
|
|
|
|
Con_DPrintf(" red_mask 0x%x\n", (int)(x_visinfo->red_mask));
|
|
|
|
Con_DPrintf(" green_mask 0x%x\n", (int)(x_visinfo->green_mask));
|
|
|
|
Con_DPrintf(" blue_mask 0x%x\n", (int)(x_visinfo->blue_mask));
|
|
|
|
Con_DPrintf(" colormap_size %d\n", x_visinfo->colormap_size);
|
|
|
|
Con_DPrintf(" bits_per_rgb %d\n", x_visinfo->bits_per_rgb);
|
2004-09-26 03:39:27 +00:00
|
|
|
|
|
|
|
//our rendering works in 8, 16, or 32 bpp.
|
|
|
|
//only 8bpp is scaled to the x server's depth.
|
|
|
|
//the others break if they arn't rendered at the same depth as they are displayed.
|
|
|
|
//this is where we scale things down.
|
|
|
|
if (info->bpp == 16 && x_visinfo->depth != 16 && x_visinfo->depth != 15)
|
|
|
|
{
|
|
|
|
Con_Printf("Forcing 8 bit rendering\n");
|
|
|
|
r_pixbytes = 1;
|
|
|
|
}
|
|
|
|
else if (info->bpp == 32 && x_visinfo->depth < 24)
|
|
|
|
{
|
|
|
|
Con_Printf("Forcing 8 bit rendering\n");
|
|
|
|
r_pixbytes = 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
x_vis = x_visinfo->visual;
|
|
|
|
|
|
|
|
// setup attributes for main window
|
|
|
|
{
|
|
|
|
int attribmask = CWEventMask | CWColormap | CWBorderPixel;
|
|
|
|
XSetWindowAttributes attribs;
|
|
|
|
Colormap tmpcmap;
|
|
|
|
|
|
|
|
tmpcmap = XCreateColormap(vid_dpy, XRootWindow(vid_dpy,
|
|
|
|
x_visinfo->screen), x_vis, AllocNone);
|
|
|
|
|
|
|
|
attribs.event_mask = StructureNotifyMask | KeyPressMask
|
|
|
|
| KeyReleaseMask | ExposureMask | PointerMotionMask |
|
2007-07-23 11:48:53 +00:00
|
|
|
ButtonPressMask | ButtonReleaseMask | FocusChangeMask;
|
2004-09-26 03:39:27 +00:00
|
|
|
attribs.border_pixel = 0;
|
|
|
|
attribs.colormap = tmpcmap;
|
|
|
|
|
|
|
|
// create the main window
|
|
|
|
x_win = XCreateWindow( vid_dpy,
|
|
|
|
XRootWindow(vid_dpy, x_visinfo->screen),
|
|
|
|
0, 0, // x, y
|
|
|
|
vid.width, vid.height,
|
|
|
|
0, // borderwidth
|
|
|
|
x_visinfo->depth,
|
|
|
|
InputOutput,
|
|
|
|
x_vis,
|
|
|
|
attribmask,
|
|
|
|
&attribs );
|
2007-07-23 11:48:53 +00:00
|
|
|
XStoreName( vid_dpy,x_win,"FTE QuakeWorld");
|
|
|
|
XSetIconName(vid_dpy, x_win, "FTEQW");
|
2004-09-26 03:39:27 +00:00
|
|
|
|
|
|
|
|
|
|
|
if (x_visinfo->class != TrueColor)
|
|
|
|
XFreeColormap(vid_dpy, tmpcmap);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2007-07-23 11:48:53 +00:00
|
|
|
if (info->fullscreen)
|
|
|
|
{
|
|
|
|
Atom val = XInternAtom(vid_dpy, "_NET_WM_STATE_FULLSCREEN", false);
|
|
|
|
if (X_TryChangeResolution(info->width, info->height, x_visinfo->screen))
|
|
|
|
{
|
|
|
|
//kill off borders and everything else
|
|
|
|
XChangeProperty(vid_dpy, x_win, XInternAtom(vid_dpy, "_NET_WM_STATE", false), XInternAtom(vid_dpy, "ATOM", false), 32, PropModeAppend, (void*)&val, 1);
|
|
|
|
//make sure that we do take the full screen, even if the res chosen was a best-fit
|
|
|
|
printf("%ix%i\n", vid.width, vid.height);
|
|
|
|
// XMoveResizeWindow(vid_dpy, x_win, 0, 0, vid.width, vid.height);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
X_StoreIcon();
|
|
|
|
|
2004-09-26 03:39:27 +00:00
|
|
|
if (x_visinfo->depth == 8)
|
|
|
|
{
|
|
|
|
|
|
|
|
// create and upload the palette
|
|
|
|
if (x_visinfo->class == PseudoColor)
|
|
|
|
{
|
|
|
|
x_cmap = XCreateColormap(vid_dpy, x_win, x_vis, AllocAll);
|
|
|
|
VID_SetPalette(palette);
|
|
|
|
XSetWindowColormap(vid_dpy, x_win, x_cmap);
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
// inviso cursor
|
|
|
|
XDefineCursor(vid_dpy, x_win, CreateNullCursor(vid_dpy, x_win));
|
|
|
|
|
|
|
|
// create the GC
|
|
|
|
{
|
|
|
|
XGCValues xgcvalues;
|
|
|
|
int valuemask = GCGraphicsExposures;
|
|
|
|
xgcvalues.graphics_exposures = False;
|
|
|
|
x_gc = XCreateGC(vid_dpy, x_win, valuemask, &xgcvalues );
|
|
|
|
}
|
|
|
|
shiftmask_init();
|
|
|
|
if (r_pixbytes == 2) //16 bit needs a 16 bit colormap.
|
|
|
|
{
|
|
|
|
extern qbyte gammatable[256];
|
|
|
|
int j, i;
|
|
|
|
float f;
|
2006-03-11 18:33:56 +00:00
|
|
|
int r, g, b;
|
2004-09-26 03:39:27 +00:00
|
|
|
unsigned short *data;
|
|
|
|
unsigned char *pal = host_basepal;
|
|
|
|
|
|
|
|
shiftmask_init();
|
|
|
|
// r_flushcache++;
|
|
|
|
if (!vid.colormap16)
|
|
|
|
vid.colormap16 = BZ_Malloc(sizeof(short)*256*VID_GRADES+sizeof(int));
|
|
|
|
data = vid.colormap16;
|
|
|
|
for (j = 0; j < VID_GRADES; j++)
|
|
|
|
{
|
|
|
|
f = (1 - ((float)j/VID_GRADES));
|
|
|
|
f = (float)gammatable[(int)(f*255)]/255;
|
2006-03-11 07:55:04 +00:00
|
|
|
f *= 2;
|
2004-09-26 03:39:27 +00:00
|
|
|
for (i = 0; i < 256; i++)
|
|
|
|
{
|
2006-03-11 07:55:04 +00:00
|
|
|
r = pal[i*3+0]*f;
|
|
|
|
g = pal[i*3+1]*f;
|
|
|
|
b = pal[i*3+2]*f;
|
|
|
|
if (r > 255)
|
|
|
|
r = 255;
|
|
|
|
if (g > 255)
|
|
|
|
g = 255;
|
|
|
|
if (b > 255)
|
|
|
|
b = 255;
|
|
|
|
r >>= 8 - redbits;
|
|
|
|
g >>= 8 - greenbits;
|
|
|
|
b >>= 8 - bluebits;
|
|
|
|
data[i] = (r<<redshift) + (g<<greenshift) + (b<<blueshift);
|
2004-09-26 03:39:27 +00:00
|
|
|
}
|
|
|
|
data+=256;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// map the window
|
|
|
|
XMapWindow(vid_dpy, x_win);
|
|
|
|
|
|
|
|
// wait for first exposure event
|
|
|
|
{
|
|
|
|
XEvent event;
|
|
|
|
do
|
|
|
|
{
|
|
|
|
XNextEvent(vid_dpy, &event);
|
|
|
|
Con_Printf("Event %i\n", event.type);
|
|
|
|
if (event.type == Expose && !event.xexpose.count)
|
|
|
|
oktodraw = true;
|
|
|
|
} while (!oktodraw);
|
|
|
|
}
|
|
|
|
// now safe to draw
|
|
|
|
|
2007-07-23 11:48:53 +00:00
|
|
|
#ifndef NOSHM
|
2004-09-26 03:39:27 +00:00
|
|
|
// even if MITSHM is available, make sure it's a local connection
|
|
|
|
if (XShmQueryExtension(vid_dpy))
|
|
|
|
{
|
|
|
|
char *displayname;
|
|
|
|
doShm = true;
|
|
|
|
displayname = (char *) getenv("DISPLAY");
|
|
|
|
if (displayname)
|
|
|
|
{
|
|
|
|
char *d = displayname;
|
|
|
|
while (*d && (*d != ':')) d++;
|
|
|
|
if (*d) *d = 0;
|
|
|
|
if (!(!strcasecmp(displayname, "unix") || !*displayname))
|
|
|
|
doShm = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (doShm)
|
|
|
|
{
|
|
|
|
x_shmeventtype = XShmGetEventBase(vid_dpy) + ShmCompletion;
|
|
|
|
ResetSharedFrameBuffers();
|
|
|
|
}
|
|
|
|
else
|
2007-07-23 11:48:53 +00:00
|
|
|
#endif
|
2004-09-26 03:39:27 +00:00
|
|
|
ResetFrameBuffer();
|
|
|
|
|
|
|
|
current_framebuffer = 0;
|
|
|
|
vid.rowbytes = x_framebuffer[0]->bytes_per_line/r_pixbytes;
|
|
|
|
vid.buffer = x_framebuffer[0]->data;
|
|
|
|
vid.direct = 0;
|
|
|
|
vid.conbuffer = x_framebuffer[0]->data;
|
|
|
|
vid.conrowbytes = vid.rowbytes;
|
|
|
|
vid.conwidth = vid.width;
|
|
|
|
vid.conheight = vid.height;
|
|
|
|
vid.aspect = ((float)vid.height / (float)vid.width) * (320.0 / 240.0);
|
|
|
|
|
|
|
|
// XSynchronize(vid_dpy, False);
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
void SWVID_ShiftPalette(unsigned char *p)
|
|
|
|
{
|
|
|
|
SWVID_SetPalette(p);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void SWVID_SetPalette(unsigned char *palette)
|
|
|
|
{
|
|
|
|
|
|
|
|
int i;
|
|
|
|
XColor colors[256];
|
|
|
|
|
|
|
|
for(i=0;i<256;i++)
|
|
|
|
{
|
|
|
|
st2d_8to16table[i]= xlib_rgb(palette[i*3],
|
|
|
|
palette[i*3+1],palette[i*3+2]);
|
|
|
|
st3d_8to32table[i]= xlib_rgb32(palette[i*3],
|
|
|
|
palette[i*3+1],palette[i*3+2]);
|
|
|
|
|
|
|
|
d_8to24bgrtable[i] = (palette[i*3+0]<<16) + (palette[i*3+1]<<8) + (palette[i*3+2]<<0);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (x_visinfo->class == PseudoColor && x_visinfo->depth == 8)
|
|
|
|
{
|
|
|
|
for (i=0 ; i<256 ; i++)
|
|
|
|
{
|
|
|
|
colors[i].pixel = i;
|
|
|
|
colors[i].flags = DoRed|DoGreen|DoBlue;
|
|
|
|
colors[i].red = palette[i*3] * 257;
|
|
|
|
colors[i].green = palette[i*3+1] * 257;
|
|
|
|
colors[i].blue = palette[i*3+2] * 257;
|
|
|
|
}
|
|
|
|
XStoreColors(vid_dpy, x_cmap, colors, 256);
|
|
|
|
}
|
|
|
|
|
2006-10-31 04:12:20 +00:00
|
|
|
if (palette != vid_curpal)
|
|
|
|
memcpy(vid_curpal, palette, 768);
|
2004-09-26 03:39:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// Called at shutdown
|
|
|
|
|
|
|
|
void SWVID_Shutdown (void)
|
|
|
|
{
|
|
|
|
Con_Printf("VID_Shutdown\n");
|
2009-04-02 22:25:54 +00:00
|
|
|
if (vid_dpy)
|
|
|
|
{
|
|
|
|
XUngrabPointer(vid_dpy,CurrentTime);
|
|
|
|
XAutoRepeatOn(vid_dpy);
|
|
|
|
if (x_win)
|
|
|
|
XDestroyWindow(vid_dpy, x_win);
|
|
|
|
}
|
2004-09-26 03:39:27 +00:00
|
|
|
// XCloseDisplay(vid_dpy);
|
|
|
|
// vid_dpy = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
int XLateKey(XKeyEvent *ev)
|
|
|
|
{
|
|
|
|
|
|
|
|
int key;
|
|
|
|
char buf[64];
|
|
|
|
KeySym keysym;
|
|
|
|
|
|
|
|
key = 0;
|
|
|
|
|
|
|
|
XLookupString(ev, buf, sizeof buf, &keysym, 0);
|
|
|
|
|
|
|
|
switch(keysym)
|
|
|
|
{
|
|
|
|
case XK_KP_Page_Up:
|
|
|
|
case XK_Page_Up: key = K_PGUP; break;
|
|
|
|
|
|
|
|
case XK_KP_Page_Down:
|
|
|
|
case XK_Page_Down: key = K_PGDN; break;
|
|
|
|
|
|
|
|
case XK_KP_Home:
|
|
|
|
case XK_Home: key = K_HOME; break;
|
|
|
|
|
|
|
|
case XK_KP_End:
|
|
|
|
case XK_End: key = K_END; break;
|
|
|
|
|
|
|
|
case XK_KP_Left:
|
|
|
|
case XK_Left: key = K_LEFTARROW; break;
|
|
|
|
|
|
|
|
case XK_KP_Right:
|
|
|
|
case XK_Right: key = K_RIGHTARROW; break;
|
|
|
|
|
|
|
|
case XK_KP_Down:
|
|
|
|
case XK_Down: key = K_DOWNARROW; break;
|
|
|
|
|
|
|
|
case XK_KP_Up:
|
|
|
|
case XK_Up: key = K_UPARROW; break;
|
|
|
|
|
|
|
|
case XK_Escape: key = K_ESCAPE; break;
|
|
|
|
|
|
|
|
case XK_KP_Enter:
|
|
|
|
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:
|
|
|
|
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_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:
|
|
|
|
case XK_KP_Insert: key = K_INS; break;
|
|
|
|
|
|
|
|
case XK_KP_Multiply: key = '*'; break;
|
|
|
|
case XK_KP_Add: key = '+'; break;
|
|
|
|
case XK_KP_Subtract: key = '-'; break;
|
|
|
|
case XK_KP_Divide: key = '/'; 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';
|
|
|
|
// fprintf(stdout, "case 0x0%x: key = ___;break;/* [%c] */\n", keysym);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
return key;
|
|
|
|
}
|
|
|
|
|
|
|
|
struct
|
|
|
|
{
|
|
|
|
int key;
|
|
|
|
int down;
|
|
|
|
} keyq[64];
|
|
|
|
int keyq_head=0;
|
|
|
|
int keyq_tail=0;
|
|
|
|
|
|
|
|
int config_notify=0;
|
|
|
|
int config_notify_width;
|
|
|
|
int config_notify_height;
|
|
|
|
|
|
|
|
void GetEvent(void)
|
|
|
|
{
|
2007-07-23 11:48:53 +00:00
|
|
|
qboolean grabmouse;
|
2004-09-26 03:39:27 +00:00
|
|
|
XEvent x_event;
|
|
|
|
int b;
|
|
|
|
|
|
|
|
XNextEvent(vid_dpy, &x_event);
|
|
|
|
switch(x_event.type) {
|
|
|
|
case KeyPress:
|
|
|
|
keyq[keyq_head].key = XLateKey(&x_event.xkey);
|
|
|
|
keyq[keyq_head].down = true;
|
|
|
|
keyq_head = (keyq_head + 1) & 63;
|
|
|
|
break;
|
|
|
|
case KeyRelease:
|
|
|
|
keyq[keyq_head].key = XLateKey(&x_event.xkey);
|
|
|
|
keyq[keyq_head].down = false;
|
|
|
|
keyq_head = (keyq_head + 1) & 63;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case MotionNotify:
|
2007-07-23 11:48:53 +00:00
|
|
|
if (old_windowed_mouse)
|
|
|
|
{
|
2004-09-26 03:39:27 +00:00
|
|
|
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",
|
|
|
|
// x_event.xmotion.x, x_event.xmotion.y, mouse_x, mouse_y);
|
|
|
|
|
|
|
|
/* move the mouse to the window center again */
|
|
|
|
XSelectInput(vid_dpy,x_win,StructureNotifyMask|KeyPressMask
|
|
|
|
|KeyReleaseMask|ExposureMask
|
|
|
|
|ButtonPressMask
|
|
|
|
|ButtonReleaseMask);
|
|
|
|
XWarpPointer(vid_dpy,None,x_win,0,0,0,0,
|
|
|
|
(vid.width/2),(vid.height/2));
|
|
|
|
XSelectInput(vid_dpy,x_win,StructureNotifyMask|KeyPressMask
|
|
|
|
|KeyReleaseMask|ExposureMask
|
|
|
|
|PointerMotionMask|ButtonPressMask
|
|
|
|
|ButtonReleaseMask);
|
2007-07-23 11:48:53 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2004-09-26 03:39:27 +00:00
|
|
|
mouse_x = (float) (x_event.xmotion.x-p_mouse_x);
|
|
|
|
mouse_y = (float) (x_event.xmotion.y-p_mouse_y);
|
|
|
|
p_mouse_x=x_event.xmotion.x;
|
|
|
|
p_mouse_y=x_event.xmotion.y;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ButtonPress:
|
|
|
|
b=-1;
|
|
|
|
if (x_event.xbutton.button == 1)
|
|
|
|
b = 0;
|
|
|
|
else if (x_event.xbutton.button == 2)
|
|
|
|
b = 2;
|
|
|
|
else if (x_event.xbutton.button == 3)
|
|
|
|
b = 1;
|
|
|
|
else if (x_event.xbutton.button == 4)
|
|
|
|
b = 4;
|
|
|
|
else if (x_event.xbutton.button == 5)
|
|
|
|
b = 5;
|
|
|
|
if (b>=0)
|
|
|
|
mouse_buttonstate |= 1<<b;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ButtonRelease:
|
|
|
|
b=-1;
|
|
|
|
if (x_event.xbutton.button == 1)
|
|
|
|
b = 0;
|
|
|
|
else if (x_event.xbutton.button == 2)
|
|
|
|
b = 2;
|
|
|
|
else if (x_event.xbutton.button == 3)
|
|
|
|
b = 1;
|
|
|
|
else if (x_event.xbutton.button == 4)
|
|
|
|
b = 4;
|
|
|
|
else if (x_event.xbutton.button == 5)
|
|
|
|
b = 5;
|
|
|
|
if (b>=0)
|
|
|
|
mouse_buttonstate &= ~(1<<b);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ConfigureNotify:
|
|
|
|
//printf("config notify\n");
|
|
|
|
config_notify_width = x_event.xconfigure.width;
|
|
|
|
config_notify_height = x_event.xconfigure.height;
|
|
|
|
config_notify = 1;
|
|
|
|
break;
|
|
|
|
|
2007-07-23 11:48:53 +00:00
|
|
|
case FocusIn:
|
|
|
|
for (b = 0; b < 256; b++)
|
|
|
|
Key_Event(b, false);
|
|
|
|
focusedapp = true;
|
|
|
|
break;
|
|
|
|
case FocusOut:
|
|
|
|
focusedapp = false;
|
|
|
|
break;
|
|
|
|
|
2004-09-26 03:39:27 +00:00
|
|
|
default:
|
2007-07-23 11:48:53 +00:00
|
|
|
#ifndef NOSHM
|
2004-09-26 03:39:27 +00:00
|
|
|
if (doShm && x_event.type == x_shmeventtype)
|
|
|
|
oktodraw = true;
|
2007-07-23 11:48:53 +00:00
|
|
|
#endif
|
|
|
|
break;
|
2004-09-26 03:39:27 +00:00
|
|
|
}
|
2007-07-23 11:48:53 +00:00
|
|
|
|
|
|
|
grabmouse = _windowed_mouse.value && focusedapp;
|
|
|
|
if (key_dest == key_console)
|
|
|
|
grabmouse = false;
|
|
|
|
|
|
|
|
if (!mouseactive)
|
|
|
|
grabmouse = false; //nomouse is a misnomer
|
2004-09-26 03:39:27 +00:00
|
|
|
|
2007-07-23 11:48:53 +00:00
|
|
|
if (old_windowed_mouse != grabmouse)
|
|
|
|
{
|
|
|
|
old_windowed_mouse = grabmouse;
|
2004-09-26 03:39:27 +00:00
|
|
|
|
2007-07-23 11:48:53 +00:00
|
|
|
if (!grabmouse)
|
|
|
|
{
|
2004-09-26 03:39:27 +00:00
|
|
|
/* ungrab the pointer */
|
|
|
|
XUngrabPointer(vid_dpy,CurrentTime);
|
2007-07-23 11:48:53 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2004-09-26 03:39:27 +00:00
|
|
|
/* grab the pointer */
|
|
|
|
XGrabPointer(vid_dpy,x_win,True,0,GrabModeAsync,
|
|
|
|
GrabModeAsync,x_win,None,CurrentTime);
|
2007-07-23 11:48:53 +00:00
|
|
|
/* make the keyboard follow the mouse too (wmaker doesn't activate us) */
|
|
|
|
XSetInputFocus(vid_dpy, x_win, RevertToPointerRoot, CurrentTime);
|
2004-09-26 03:39:27 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// flushes the given rectangles from the view buffer to the screen
|
|
|
|
|
|
|
|
void SWVID_Update (vrect_t *rects)
|
|
|
|
{
|
|
|
|
|
|
|
|
// if the window changes dimension, skip this frame
|
|
|
|
|
|
|
|
if (config_notify)
|
|
|
|
{
|
|
|
|
int ow, oh;
|
|
|
|
ow = vid.width;
|
|
|
|
oh = vid.height;
|
|
|
|
config_notify = 0;
|
|
|
|
vid.width = config_notify_width & ~7;
|
|
|
|
vid.height = config_notify_height;
|
|
|
|
if (ow != vid.width || oh != vid.height) //did the size actually change?
|
|
|
|
{ //yes
|
2007-07-23 11:48:53 +00:00
|
|
|
#ifndef NOSHM
|
2004-09-26 03:39:27 +00:00
|
|
|
if (doShm)
|
|
|
|
ResetSharedFrameBuffers();
|
|
|
|
else
|
2007-07-23 11:48:53 +00:00
|
|
|
#endif
|
2004-09-26 03:39:27 +00:00
|
|
|
ResetFrameBuffer();
|
|
|
|
vid.rowbytes = x_framebuffer[0]->bytes_per_line/r_pixbytes;
|
|
|
|
vid.buffer = x_framebuffer[current_framebuffer]->data;
|
|
|
|
vid.conbuffer = vid.buffer;
|
|
|
|
vid.conwidth = vid.width;
|
|
|
|
vid.conheight = vid.height;
|
|
|
|
vid.conrowbytes = vid.rowbytes;
|
|
|
|
vid.recalc_refdef = 1; // force a surface cache flush
|
|
|
|
Con_CheckResize();
|
|
|
|
Con_Clear_f();
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
2007-07-23 11:48:53 +00:00
|
|
|
#ifndef NOSHM
|
2004-09-26 03:39:27 +00:00
|
|
|
if (doShm)
|
|
|
|
{
|
|
|
|
|
|
|
|
while (rects)
|
|
|
|
{
|
|
|
|
if (x_visinfo->depth == 16)
|
|
|
|
st2_fixup( x_framebuffer[current_framebuffer],
|
|
|
|
rects->x, rects->y, rects->width,
|
|
|
|
rects->height);
|
|
|
|
if (x_visinfo->depth == 24)
|
|
|
|
st3_fixup( x_framebuffer[current_framebuffer],
|
|
|
|
rects->x, rects->y, rects->width,
|
|
|
|
rects->height);
|
|
|
|
if (!XShmPutImage(vid_dpy, x_win, x_gc,
|
|
|
|
x_framebuffer[current_framebuffer], rects->x, rects->y,
|
|
|
|
rects->x, rects->y, rects->width, rects->height, True))
|
|
|
|
Sys_Error("VID_Update: XShmPutImage failed\n");
|
|
|
|
oktodraw = false;
|
|
|
|
while (!oktodraw) GetEvent();
|
|
|
|
rects = rects->pnext;
|
|
|
|
}
|
|
|
|
current_framebuffer = !current_framebuffer;
|
|
|
|
vid.buffer = x_framebuffer[current_framebuffer]->data;
|
|
|
|
vid.conbuffer = vid.buffer;
|
|
|
|
XSync(vid_dpy, False);
|
|
|
|
}
|
|
|
|
else
|
2007-07-23 11:48:53 +00:00
|
|
|
#endif
|
2004-09-26 03:39:27 +00:00
|
|
|
{
|
|
|
|
while (rects)
|
|
|
|
{
|
|
|
|
if (x_visinfo->depth == 16)
|
|
|
|
st2_fixup( x_framebuffer[current_framebuffer],
|
|
|
|
rects->x, rects->y, rects->width,
|
|
|
|
rects->height);
|
|
|
|
else if (x_visinfo->depth == 24)
|
|
|
|
st3_fixup( x_framebuffer[current_framebuffer],
|
|
|
|
rects->x, rects->y, rects->width,
|
|
|
|
rects->height);
|
|
|
|
XPutImage(vid_dpy, x_win, x_gc, x_framebuffer[0], rects->x,
|
|
|
|
rects->y, rects->x, rects->y, rects->width, rects->height);
|
|
|
|
rects = rects->pnext;
|
|
|
|
}
|
|
|
|
XSync(vid_dpy, False);
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#ifdef RGLQUAKE
|
|
|
|
void GLSys_SendKeyEvents(void); //merged.
|
|
|
|
#endif
|
|
|
|
|
|
|
|
void Sys_SendKeyEvents(void)
|
|
|
|
{
|
|
|
|
#ifdef RGLQUAKE
|
|
|
|
if (qrenderer != QR_SOFTWARE)
|
|
|
|
{
|
|
|
|
GLSys_SendKeyEvents();
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
// get events from x server
|
|
|
|
if (vid_dpy)
|
|
|
|
{
|
|
|
|
while (XPending(vid_dpy)) GetEvent();
|
|
|
|
while (keyq_head != keyq_tail)
|
|
|
|
{
|
|
|
|
Key_Event(keyq[keyq_tail].key, keyq[keyq_tail].down);
|
|
|
|
keyq_tail = (keyq_tail + 1) & 63;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#if 0
|
|
|
|
char *Sys_ConsoleInput (void)
|
|
|
|
{
|
|
|
|
|
|
|
|
static char text[256];
|
|
|
|
int len;
|
|
|
|
fd_set readfds;
|
|
|
|
int ready;
|
|
|
|
struct timeval timeout;
|
|
|
|
|
|
|
|
timeout.tv_sec = 0;
|
|
|
|
timeout.tv_usec = 0;
|
|
|
|
FD_ZERO(&readfds);
|
|
|
|
FD_SET(0, &readfds);
|
|
|
|
ready = select(1, &readfds, 0, 0, &timeout);
|
|
|
|
|
|
|
|
if (ready>0)
|
|
|
|
{
|
|
|
|
len = read (0, text, sizeof(text));
|
|
|
|
if (len >= 1)
|
|
|
|
{
|
|
|
|
text[len-1] = 0; // rip off the /n and terminate
|
|
|
|
return text;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
void SWD_BeginDirectRect (int x, int y, qbyte *pbitmap, int width, int height)
|
|
|
|
{
|
|
|
|
// direct drawing of the "accessing disk" icon isn't supported under Linux
|
|
|
|
}
|
|
|
|
|
|
|
|
void SWD_EndDirectRect (int x, int y, int width, int height)
|
|
|
|
{
|
|
|
|
// direct drawing of the "accessing disk" icon isn't supported under Linux
|
|
|
|
}
|
|
|
|
|
2006-05-10 22:12:20 +00:00
|
|
|
void IN_ReInit(void)
|
|
|
|
{
|
|
|
|
if ( COM_CheckParm ("-nomouse") )
|
|
|
|
return;
|
|
|
|
mouse_x = mouse_y = 0.0;
|
|
|
|
mouseactive = mouse_avail = 1;
|
|
|
|
}
|
|
|
|
|
2004-09-26 03:39:27 +00:00
|
|
|
void IN_Init (void)
|
|
|
|
{
|
2005-10-30 23:52:33 +00:00
|
|
|
Cvar_Register (&_windowed_mouse, "Input Controls");
|
|
|
|
Cvar_Register (&m_filter, "Input Controls");
|
|
|
|
Cvar_Register (&m_accel, "Input Controls");
|
2004-09-26 03:39:27 +00:00
|
|
|
#ifdef IN_XFLIP
|
2005-10-30 23:52:33 +00:00
|
|
|
Cvar_Register (&in_xflip, "Input Controls");
|
2004-09-26 03:39:27 +00:00
|
|
|
#endif
|
2006-05-10 22:12:20 +00:00
|
|
|
|
|
|
|
IN_ReInit();
|
2004-09-26 03:39:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void IN_Shutdown (void)
|
|
|
|
{
|
2007-07-23 11:48:53 +00:00
|
|
|
mouseactive = mouse_avail = 0;
|
|
|
|
focusedapp = false;
|
2004-09-26 03:39:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void IN_Commands (void)
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
|
|
|
|
if (!mouse_avail) return;
|
|
|
|
|
2007-07-23 11:48:53 +00:00
|
|
|
for (i=0 ; i<mouse_buttons ; i++)
|
|
|
|
{
|
2004-09-26 03:39:27 +00:00
|
|
|
if ( (mouse_buttonstate & (1<<i)) && !(mouse_oldbuttonstate & (1<<i)) )
|
|
|
|
Key_Event (K_MOUSE1 + i, true);
|
|
|
|
|
|
|
|
if ( !(mouse_buttonstate & (1<<i)) && (mouse_oldbuttonstate & (1<<i)) )
|
|
|
|
Key_Event (K_MOUSE1 + i, false);
|
|
|
|
}
|
|
|
|
mouse_oldbuttonstate = mouse_buttonstate;
|
|
|
|
}
|
|
|
|
|
|
|
|
extern int mousecursor_x, mousecursor_y;
|
2009-05-24 10:11:17 +00:00
|
|
|
void IN_Move (float *movements, int pnum)
|
2004-09-26 03:39:27 +00:00
|
|
|
{
|
2005-08-06 22:39:28 +00:00
|
|
|
float mx, my;
|
2005-08-12 23:26:12 +00:00
|
|
|
float mouse_deltadist;
|
2005-08-06 22:39:28 +00:00
|
|
|
|
2004-09-26 03:39:27 +00:00
|
|
|
if (!mouse_avail)
|
|
|
|
{
|
|
|
|
mousecursor_x = p_mouse_x; //absolute offsets.
|
|
|
|
mousecursor_y = p_mouse_y;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (pnum != 0)
|
|
|
|
return; //we're lazy today.
|
|
|
|
|
|
|
|
mousecursor_x += mouse_x;
|
|
|
|
mousecursor_y += mouse_y;
|
|
|
|
|
|
|
|
if (mousecursor_x < 0)
|
|
|
|
mousecursor_x = 0;
|
|
|
|
if (mousecursor_y < 0)
|
|
|
|
mousecursor_y = 0;
|
|
|
|
if (mousecursor_x > vid.width)
|
|
|
|
mousecursor_x = vid.width;
|
|
|
|
if (mousecursor_y > vid.height)
|
|
|
|
mousecursor_y = vid.height;
|
|
|
|
|
2005-08-06 22:39:28 +00:00
|
|
|
if (m_filter.value)
|
|
|
|
{
|
|
|
|
float fraction = bound(0, m_filter.value, 2) * 0.5;
|
|
|
|
mouse_x = (mouse_x*(1-fraction) + old_mouse_x*fraction);
|
|
|
|
mouse_y = (mouse_y*(1-fraction) + old_mouse_y*fraction);
|
2004-09-26 03:39:27 +00:00
|
|
|
}
|
|
|
|
|
2005-08-06 22:39:28 +00:00
|
|
|
old_mouse_x = mx;
|
|
|
|
old_mouse_y = my;
|
2004-09-26 03:39:27 +00:00
|
|
|
|
2007-07-23 11:48:53 +00:00
|
|
|
if (m_accel.value)
|
|
|
|
{
|
2005-08-06 22:39:28 +00:00
|
|
|
mouse_deltadist = sqrt(mx*mx + my*my);
|
|
|
|
mouse_x *= (mouse_deltadist*m_accel.value + sensitivity.value*in_sensitivityscale);
|
|
|
|
mouse_y *= (mouse_deltadist*m_accel.value + sensitivity.value*in_sensitivityscale);
|
2007-07-23 11:48:53 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2005-08-06 22:39:28 +00:00
|
|
|
mouse_x *= sensitivity.value*in_sensitivityscale;
|
|
|
|
mouse_y *= sensitivity.value*in_sensitivityscale;
|
|
|
|
}
|
2004-09-26 03:39:27 +00:00
|
|
|
|
|
|
|
#ifdef IN_XFLIP
|
|
|
|
if(in_xflip.value) mouse_x *= -1;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
if ( (in_strafe.state[pnum] & 1) || (lookstrafe.value && (in_mlook.state[pnum] & 1) ))
|
2009-05-24 10:11:17 +00:00
|
|
|
movements[1] += m_side.value * mouse_x;
|
2004-09-26 03:39:27 +00:00
|
|
|
else
|
|
|
|
cl.viewangles[pnum][YAW] -= m_yaw.value * mouse_x;
|
|
|
|
if (in_mlook.state[pnum] & 1)
|
|
|
|
V_StopPitchDrift (pnum);
|
|
|
|
|
2007-07-23 11:48:53 +00:00
|
|
|
if ( (in_mlook.state[pnum] & 1) && !(in_strafe.state[pnum] & 1))
|
|
|
|
{
|
2004-09-26 03:39:27 +00:00
|
|
|
cl.viewangles[pnum][PITCH] += m_pitch.value * mouse_y;
|
|
|
|
CL_ClampPitch(pnum);
|
2007-07-23 11:48:53 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2005-08-12 23:26:12 +00:00
|
|
|
if (cmd)
|
|
|
|
{
|
|
|
|
if ((in_strafe.state[pnum] & 1) && noclip_anglehack)
|
2009-05-24 10:11:17 +00:00
|
|
|
movements[2] -= m_forward.value * mouse_y;
|
2005-08-12 23:26:12 +00:00
|
|
|
else
|
2009-05-24 10:11:17 +00:00
|
|
|
movements[0] -= m_forward.value * mouse_y;
|
2005-08-12 23:26:12 +00:00
|
|
|
}
|
2004-09-26 03:39:27 +00:00
|
|
|
}
|
|
|
|
mouse_x = mouse_y = 0.0;
|
|
|
|
}
|
|
|
|
|
|
|
|
void SWVID_LockBuffer (void)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
void SWVID_UnlockBuffer (void)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int SWVID_ForceUnlockedAndReturnState (void)
|
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
void SWVID_ForceLockState (int lk)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2007-03-28 12:57:05 +00:00
|
|
|
void SWVID_SetCaption(char *text)
|
|
|
|
{
|
|
|
|
XStoreName(vid_dpy, x_win, text);
|
|
|
|
}
|
|
|
|
|