2000-05-23 06:36:33 +00:00
|
|
|
/*
|
|
|
|
context_x11.c
|
|
|
|
|
|
|
|
general x11 context layer
|
|
|
|
|
|
|
|
Copyright (C) 1996-1997 Id Software, Inc.
|
|
|
|
Copyright (C) 2000 Zephaniah E. Hull <warp@whitestar.soark.net>
|
|
|
|
Copyright (C) 1999,2000 contributors of the QuakeForge project
|
|
|
|
Please see the file "AUTHORS" for a list of contributors
|
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or
|
|
|
|
modify it under the terms of the GNU General Public License
|
|
|
|
as published by the Free Software Foundation; either version 2
|
|
|
|
of the License, or (at your option) any later version.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
|
|
|
|
|
|
See the GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with this program; if not, write to:
|
|
|
|
|
|
|
|
Free Software Foundation, Inc.
|
|
|
|
59 Temple Place - Suite 330
|
|
|
|
Boston, MA 02111-1307, USA
|
|
|
|
|
|
|
|
$Id$
|
|
|
|
*/
|
|
|
|
|
2001-02-07 05:45:59 +00:00
|
|
|
#ifdef HAVE_CONFIG_H
|
2000-12-08 06:51:37 +00:00
|
|
|
# include "config.h"
|
2001-02-07 05:45:59 +00:00
|
|
|
#endif
|
2000-05-23 06:36:33 +00:00
|
|
|
|
|
|
|
#include <ctype.h>
|
|
|
|
#include <sys/time.h>
|
|
|
|
#include <sys/types.h>
|
2001-02-07 05:45:59 +00:00
|
|
|
|
2000-05-23 06:36:33 +00:00
|
|
|
#ifdef HAVE_UNISTD_H
|
2001-02-07 05:45:59 +00:00
|
|
|
# include <unistd.h>
|
2000-05-23 06:36:33 +00:00
|
|
|
#endif
|
2001-02-07 05:45:59 +00:00
|
|
|
|
2000-05-23 06:36:33 +00:00
|
|
|
#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>
|
2000-10-10 22:00:35 +00:00
|
|
|
#include <limits.h>
|
2000-10-22 07:14:47 +00:00
|
|
|
#include <sys/poll.h>
|
2000-05-23 06:36:33 +00:00
|
|
|
|
2000-09-24 03:43:06 +00:00
|
|
|
#ifdef HAVE_VIDMODE
|
|
|
|
# include <X11/extensions/xf86vmode.h>
|
|
|
|
#endif
|
|
|
|
|
2000-10-03 07:10:48 +00:00
|
|
|
#include "commdef.h"
|
2000-12-30 02:16:36 +00:00
|
|
|
#include "console.h"
|
2000-09-24 03:43:06 +00:00
|
|
|
#include "context_x11.h"
|
2000-12-30 02:16:36 +00:00
|
|
|
#include "cvar.h"
|
2000-09-24 03:43:06 +00:00
|
|
|
#include "dga_check.h"
|
2000-12-30 02:16:36 +00:00
|
|
|
#include "input.h"
|
2000-10-11 09:54:27 +00:00
|
|
|
#include "qargs.h"
|
2000-09-24 03:43:06 +00:00
|
|
|
#include "qtypes.h"
|
|
|
|
#include "sys.h"
|
2000-12-30 02:16:36 +00:00
|
|
|
#include "va.h"
|
|
|
|
#include "vid.h"
|
2000-05-23 06:36:33 +00:00
|
|
|
|
2000-12-08 06:51:37 +00:00
|
|
|
static void (*event_handlers[LASTEvent]) (XEvent *);
|
|
|
|
qboolean oktodraw = false;
|
|
|
|
int x_shmeventtype;
|
2000-05-23 06:36:33 +00:00
|
|
|
|
2000-12-08 06:51:37 +00:00
|
|
|
static int x_disp_ref_count = 0;
|
2000-05-23 06:36:33 +00:00
|
|
|
|
2000-12-08 06:51:37 +00:00
|
|
|
Display *x_disp = NULL;
|
|
|
|
int x_screen;
|
|
|
|
Window x_root = None;
|
|
|
|
XVisualInfo *x_visinfo;
|
|
|
|
Visual *x_vis;
|
|
|
|
Window x_win;
|
|
|
|
Cursor nullcursor = None;
|
2000-09-24 03:43:06 +00:00
|
|
|
static Atom aWMDelete = 0;
|
|
|
|
|
|
|
|
#define X_MASK (VisibilityChangeMask | StructureNotifyMask | ExposureMask)
|
|
|
|
|
|
|
|
#ifdef HAVE_VIDMODE
|
|
|
|
static XF86VidModeModeInfo **vidmodes;
|
2000-10-24 18:10:01 +00:00
|
|
|
static int nummodes;
|
2000-09-24 03:43:06 +00:00
|
|
|
#endif
|
2000-12-08 06:51:37 +00:00
|
|
|
static int hasvidmode = 0;
|
2000-09-24 03:43:06 +00:00
|
|
|
|
2000-12-08 06:51:37 +00:00
|
|
|
cvar_t *vid_fullscreen;
|
|
|
|
qboolean vid_fullscreen_active;
|
2000-09-24 03:43:06 +00:00
|
|
|
|
2000-12-08 06:51:37 +00:00
|
|
|
static int xss_timeout;
|
|
|
|
static int xss_interval;
|
|
|
|
static int xss_blanking;
|
|
|
|
static int xss_exposures;
|
2000-05-23 06:36:33 +00:00
|
|
|
|
|
|
|
qboolean
|
2000-10-11 09:54:27 +00:00
|
|
|
x11_add_event (int event, void (*event_handler) (XEvent *))
|
2000-05-23 06:36:33 +00:00
|
|
|
{
|
|
|
|
if (event >= LASTEvent) {
|
2000-12-08 06:51:37 +00:00
|
|
|
printf ("event: %d, LASTEvent: %d\n", event, LASTEvent);
|
2000-05-23 06:36:33 +00:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
if (event_handlers[event] != NULL)
|
|
|
|
return false;
|
|
|
|
|
|
|
|
event_handlers[event] = event_handler;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
qboolean
|
2000-10-11 09:54:27 +00:00
|
|
|
x11_del_event (int event, void (*event_handler) (XEvent *))
|
2000-05-23 06:36:33 +00:00
|
|
|
{
|
|
|
|
if (event >= LASTEvent)
|
|
|
|
return false;
|
|
|
|
if (event_handlers[event] != event_handler)
|
|
|
|
return false;
|
|
|
|
|
|
|
|
event_handlers[event] = NULL;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2000-10-11 09:54:27 +00:00
|
|
|
x11_process_event (void)
|
2000-05-23 06:36:33 +00:00
|
|
|
{
|
2000-12-08 06:51:37 +00:00
|
|
|
XEvent x_event;
|
2000-05-23 06:36:33 +00:00
|
|
|
|
2000-12-08 06:51:37 +00:00
|
|
|
XNextEvent (x_disp, &x_event);
|
|
|
|
if (x_event.type >= LASTEvent) {
|
2000-05-23 06:36:33 +00:00
|
|
|
// FIXME: KLUGE!!!!!!
|
|
|
|
if (x_event.type == x_shmeventtype)
|
|
|
|
oktodraw = 1;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
if (event_handlers[x_event.type])
|
2000-10-11 09:54:27 +00:00
|
|
|
event_handlers[x_event.type] (&x_event);
|
2000-05-23 06:36:33 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2000-10-11 09:54:27 +00:00
|
|
|
x11_process_events (void)
|
2000-05-23 06:36:33 +00:00
|
|
|
{
|
|
|
|
/* Get events from X server. */
|
2000-10-11 09:54:27 +00:00
|
|
|
while (XPending (x_disp)) {
|
|
|
|
x11_process_event ();
|
2000-05-23 06:36:33 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// ========================================================================
|
|
|
|
// Tragic death handler
|
|
|
|
// ========================================================================
|
|
|
|
|
|
|
|
static void
|
2000-10-11 09:54:27 +00:00
|
|
|
TragicDeath (int sig)
|
2000-05-23 06:36:33 +00:00
|
|
|
{
|
2000-10-11 09:54:27 +00:00
|
|
|
printf ("Received signal %d, exiting...\n", sig);
|
|
|
|
Sys_Quit ();
|
|
|
|
exit (sig);
|
2000-12-08 06:51:37 +00:00
|
|
|
// XCloseDisplay(x_disp);
|
|
|
|
// VID_Shutdown();
|
|
|
|
// Sys_Error("This death brought to you by the number %d\n", signal_num);
|
2000-05-23 06:36:33 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2000-10-11 09:54:27 +00:00
|
|
|
x11_open_display (void)
|
2000-05-23 06:36:33 +00:00
|
|
|
{
|
2000-12-08 06:51:37 +00:00
|
|
|
if (!x_disp) {
|
2000-11-21 09:17:29 +00:00
|
|
|
x_disp = XOpenDisplay (NULL);
|
2000-12-08 06:51:37 +00:00
|
|
|
if (!x_disp) {
|
|
|
|
Sys_Error ("x11_open_display: Could not open display [%s]\n",
|
|
|
|
XDisplayName (NULL));
|
2000-05-23 06:36:33 +00:00
|
|
|
}
|
|
|
|
|
2000-09-24 03:43:06 +00:00
|
|
|
x_screen = DefaultScreen (x_disp);
|
|
|
|
x_root = RootWindow (x_disp, x_screen);
|
|
|
|
|
2000-05-23 06:36:33 +00:00
|
|
|
// catch signals
|
2000-12-08 06:51:37 +00:00
|
|
|
signal (SIGHUP, TragicDeath);
|
|
|
|
signal (SIGINT, TragicDeath);
|
|
|
|
signal (SIGQUIT, TragicDeath);
|
|
|
|
signal (SIGILL, TragicDeath);
|
|
|
|
signal (SIGTRAP, TragicDeath);
|
|
|
|
signal (SIGIOT, TragicDeath);
|
|
|
|
signal (SIGBUS, TragicDeath);
|
|
|
|
/* signal(SIGFPE, TragicDeath); */
|
|
|
|
signal (SIGSEGV, TragicDeath);
|
|
|
|
signal (SIGTERM, TragicDeath);
|
2000-05-23 06:36:33 +00:00
|
|
|
|
|
|
|
// for debugging only
|
2000-12-08 06:51:37 +00:00
|
|
|
XSynchronize (x_disp, True);
|
2000-05-23 06:36:33 +00:00
|
|
|
|
2000-12-08 06:51:37 +00:00
|
|
|
x_disp_ref_count = 1;
|
2000-05-23 06:36:33 +00:00
|
|
|
} else {
|
|
|
|
x_disp_ref_count++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2000-10-11 09:54:27 +00:00
|
|
|
x11_close_display (void)
|
2000-05-23 06:36:33 +00:00
|
|
|
{
|
2000-09-24 03:43:06 +00:00
|
|
|
if (nullcursor != None) {
|
2000-11-21 09:17:29 +00:00
|
|
|
XFreeCursor (x_disp, nullcursor);
|
2000-09-24 03:43:06 +00:00
|
|
|
nullcursor = None;
|
|
|
|
}
|
2000-11-21 09:17:29 +00:00
|
|
|
|
2000-05-23 06:36:33 +00:00
|
|
|
if (!--x_disp_ref_count) {
|
2000-11-21 09:17:29 +00:00
|
|
|
XCloseDisplay (x_disp);
|
2000-10-29 07:58:43 +00:00
|
|
|
x_disp = 0;
|
2000-05-23 06:36:33 +00:00
|
|
|
}
|
|
|
|
}
|
2000-09-24 03:43:06 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
x11_create_null_cursor
|
|
|
|
|
|
|
|
Create an empty cursor
|
|
|
|
*/
|
|
|
|
void
|
2000-10-11 09:54:27 +00:00
|
|
|
x11_create_null_cursor (void)
|
2000-09-24 03:43:06 +00:00
|
|
|
{
|
2000-12-08 06:51:37 +00:00
|
|
|
Pixmap cursormask;
|
|
|
|
XGCValues xgc;
|
|
|
|
GC gc;
|
|
|
|
XColor dummycolour;
|
2000-09-24 03:43:06 +00:00
|
|
|
|
2000-11-21 09:17:29 +00:00
|
|
|
if (nullcursor != None)
|
|
|
|
return;
|
2000-09-24 03:43:06 +00:00
|
|
|
|
2000-11-21 09:17:29 +00:00
|
|
|
cursormask = XCreatePixmap (x_disp, x_root, 1, 1, 1);
|
2000-09-24 03:43:06 +00:00
|
|
|
xgc.function = GXclear;
|
2000-12-08 06:51:37 +00:00
|
|
|
|
|
|
|
gc = XCreateGC (x_disp, cursormask, GCFunction, &xgc);
|
|
|
|
|
2000-11-21 09:17:29 +00:00
|
|
|
XFillRectangle (x_disp, cursormask, gc, 0, 0, 1, 1);
|
2000-12-08 06:51:37 +00:00
|
|
|
|
2000-09-24 03:43:06 +00:00
|
|
|
dummycolour.pixel = 0;
|
|
|
|
dummycolour.red = 0;
|
|
|
|
dummycolour.flags = 04;
|
2000-11-21 09:17:29 +00:00
|
|
|
nullcursor = XCreatePixmapCursor (x_disp, cursormask, cursormask,
|
2000-12-08 06:51:37 +00:00
|
|
|
&dummycolour, &dummycolour, 0, 0);
|
|
|
|
XFreePixmap (x_disp, cursormask);
|
|
|
|
XFreeGC (x_disp, gc);
|
2000-11-21 09:17:29 +00:00
|
|
|
XDefineCursor (x_disp, x_win, nullcursor);
|
2000-09-24 03:43:06 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2000-11-21 09:17:29 +00:00
|
|
|
x11_set_vidmode (int width, int height)
|
2000-09-24 03:43:06 +00:00
|
|
|
{
|
2000-12-08 06:51:37 +00:00
|
|
|
const char *str = getenv ("MESA_GLX_FX");
|
|
|
|
|
2000-11-21 09:17:29 +00:00
|
|
|
if (str && *str != 'd') {
|
2000-12-08 06:51:37 +00:00
|
|
|
if (tolower (*str) == 'w') {
|
2000-09-24 03:43:06 +00:00
|
|
|
Cvar_Set (vid_fullscreen, "0");
|
|
|
|
} else {
|
|
|
|
Cvar_Set (vid_fullscreen, "1");
|
|
|
|
}
|
|
|
|
}
|
2000-11-17 21:23:26 +00:00
|
|
|
|
|
|
|
XGetScreenSaver (x_disp, &xss_timeout, &xss_interval, &xss_blanking,
|
2000-12-08 06:51:37 +00:00
|
|
|
&xss_exposures);
|
|
|
|
XSetScreenSaver (x_disp, 0, xss_interval, xss_blanking, xss_exposures);
|
2000-09-24 03:43:06 +00:00
|
|
|
|
|
|
|
#ifdef HAVE_VIDMODE
|
2000-12-08 06:51:37 +00:00
|
|
|
if (!(hasvidmode = VID_CheckVMode (x_disp, NULL, NULL))) {
|
2000-10-24 18:10:01 +00:00
|
|
|
Cvar_Set (vid_fullscreen, "0");
|
|
|
|
return;
|
2000-09-24 03:43:06 +00:00
|
|
|
}
|
|
|
|
|
2000-12-08 06:51:37 +00:00
|
|
|
XF86VidModeGetAllModeLines (x_disp, x_screen, &nummodes, &vidmodes);
|
2000-10-24 18:10:01 +00:00
|
|
|
|
|
|
|
if (vid_fullscreen->int_val) {
|
2000-12-08 06:51:37 +00:00
|
|
|
int i;
|
|
|
|
int best_mode = 0, best_x = INT_MAX, best_y = INT_MAX;
|
2000-11-17 21:23:26 +00:00
|
|
|
|
2000-10-24 18:10:01 +00:00
|
|
|
for (i = 0; i < nummodes; i++) {
|
2000-12-08 06:51:37 +00:00
|
|
|
if ((best_x > vidmodes[i]->hdisplay) ||
|
|
|
|
(best_y > vidmodes[i]->vdisplay)) {
|
|
|
|
if ((vidmodes[i]->hdisplay >= width) &&
|
|
|
|
(vidmodes[i]->vdisplay >= height)) {
|
2000-10-24 18:10:01 +00:00
|
|
|
best_mode = i;
|
|
|
|
best_x = vidmodes[i]->hdisplay;
|
|
|
|
best_y = vidmodes[i]->vdisplay;
|
|
|
|
}
|
2000-09-24 03:43:06 +00:00
|
|
|
}
|
2000-12-08 06:51:37 +00:00
|
|
|
printf ("%dx%d\n", vidmodes[i]->hdisplay, vidmodes[i]->vdisplay);
|
2000-09-24 03:43:06 +00:00
|
|
|
}
|
2000-10-24 18:10:01 +00:00
|
|
|
XF86VidModeSwitchToMode (x_disp, x_screen, vidmodes[best_mode]);
|
2000-10-28 05:08:11 +00:00
|
|
|
x11_force_view_port ();
|
2000-10-24 18:10:01 +00:00
|
|
|
}
|
2000-09-24 03:43:06 +00:00
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2000-10-29 15:35:24 +00:00
|
|
|
void
|
2000-12-28 09:32:02 +00:00
|
|
|
x11_Init_Cvars (void)
|
2000-10-29 15:35:24 +00:00
|
|
|
{
|
2000-10-31 04:16:20 +00:00
|
|
|
vid_fullscreen = Cvar_Get ("vid_fullscreen", "0", CVAR_ROM,
|
|
|
|
"Toggles fullscreen game mode");
|
2000-10-29 15:35:24 +00:00
|
|
|
}
|
|
|
|
|
2000-09-24 03:43:06 +00:00
|
|
|
void
|
2000-10-11 09:54:27 +00:00
|
|
|
x11_create_window (int width, int height)
|
2000-09-24 03:43:06 +00:00
|
|
|
{
|
|
|
|
XSetWindowAttributes attr;
|
2000-12-08 06:51:37 +00:00
|
|
|
XClassHint *ClassHint;
|
|
|
|
XSizeHints *SizeHints;
|
|
|
|
char *resname;
|
|
|
|
unsigned long mask;
|
2000-09-24 03:43:06 +00:00
|
|
|
|
|
|
|
/* window attributes */
|
|
|
|
attr.background_pixel = 0;
|
|
|
|
attr.border_pixel = 0;
|
2000-12-08 06:51:37 +00:00
|
|
|
attr.colormap = XCreateColormap (x_disp, x_root, x_vis, AllocNone);
|
2000-09-24 03:43:06 +00:00
|
|
|
attr.event_mask = X_MASK;
|
|
|
|
mask = CWBackPixel | CWBorderPixel | CWColormap | CWEventMask;
|
|
|
|
|
2000-10-17 03:17:42 +00:00
|
|
|
if (hasvidmode && vid_fullscreen->int_val) {
|
2000-12-08 06:51:37 +00:00
|
|
|
attr.override_redirect = 1;
|
|
|
|
mask |= CWOverrideRedirect;
|
2000-09-24 03:43:06 +00:00
|
|
|
}
|
|
|
|
|
2000-10-11 09:54:27 +00:00
|
|
|
x_win = XCreateWindow (x_disp, x_root, 0, 0, width, height,
|
2000-12-08 06:51:37 +00:00
|
|
|
0, x_visinfo->depth, InputOutput,
|
|
|
|
x_vis, mask, &attr);
|
2000-10-11 09:54:27 +00:00
|
|
|
|
|
|
|
// Set window size hints
|
|
|
|
SizeHints = XAllocSizeHints ();
|
|
|
|
if (SizeHints) {
|
|
|
|
SizeHints->flags = (PMinSize | PMaxSize);
|
|
|
|
SizeHints->min_width = width;
|
|
|
|
SizeHints->min_height = height;
|
|
|
|
SizeHints->max_width = width;
|
|
|
|
SizeHints->max_height = height;
|
|
|
|
XSetWMNormalHints (x_disp, x_win, SizeHints);
|
|
|
|
|
|
|
|
XFree (SizeHints);
|
|
|
|
}
|
2000-10-03 07:10:48 +00:00
|
|
|
// Set window title
|
2000-10-04 05:45:48 +00:00
|
|
|
x11_set_caption (va ("%s %s", PROGRAM, VERSION));
|
2000-10-11 09:54:27 +00:00
|
|
|
|
2000-10-03 07:10:48 +00:00
|
|
|
// Set icon name
|
|
|
|
XSetIconName (x_disp, x_win, PROGRAM);
|
2000-09-24 03:43:06 +00:00
|
|
|
|
2000-10-11 09:54:27 +00:00
|
|
|
// Set window class
|
|
|
|
ClassHint = XAllocClassHint ();
|
|
|
|
if (ClassHint) {
|
|
|
|
resname = strrchr (com_argv[0], '/');
|
|
|
|
|
2000-11-09 00:56:43 +00:00
|
|
|
ClassHint->res_name = (resname ? resname + 1 : com_argv[0]);
|
|
|
|
ClassHint->res_class = PACKAGE;
|
2000-10-11 09:54:27 +00:00
|
|
|
XSetClassHint (x_disp, x_win, ClassHint);
|
|
|
|
XFree (ClassHint);
|
|
|
|
}
|
|
|
|
// Make window respond to Delete events
|
|
|
|
aWMDelete = XInternAtom (x_disp, "WM_DELETE_WINDOW", False);
|
|
|
|
XSetWMProtocols (x_disp, x_win, &aWMDelete, 1);
|
2000-12-08 06:51:37 +00:00
|
|
|
|
2000-10-22 07:14:47 +00:00
|
|
|
if (vid_fullscreen->int_val) {
|
2000-10-24 18:10:01 +00:00
|
|
|
XMoveWindow (x_disp, x_win, 0, 0);
|
2000-11-21 09:17:29 +00:00
|
|
|
XWarpPointer (x_disp, None, x_win, 0, 0, 0, 0,
|
2000-12-08 06:51:37 +00:00
|
|
|
vid.width + 2, vid.height + 2);
|
2000-10-28 05:08:11 +00:00
|
|
|
x11_force_view_port ();
|
2000-10-22 07:14:47 +00:00
|
|
|
}
|
2000-10-24 18:10:01 +00:00
|
|
|
|
|
|
|
XMapWindow (x_disp, x_win);
|
2001-02-02 05:42:35 +00:00
|
|
|
if (vid_fullscreen->int_val) {
|
|
|
|
XGrabPointer (x_disp, x_win, True, 0, GrabModeAsync, GrabModeAsync, x_win, None, CurrentTime);
|
|
|
|
}
|
2000-10-24 18:10:01 +00:00
|
|
|
XRaiseWindow (x_disp, x_win);
|
2000-09-24 03:43:06 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2000-10-11 09:54:27 +00:00
|
|
|
x11_restore_vidmode (void)
|
2000-09-24 03:43:06 +00:00
|
|
|
{
|
|
|
|
XSetScreenSaver (x_disp, xss_timeout, xss_interval, xss_blanking,
|
2000-12-08 06:51:37 +00:00
|
|
|
xss_exposures);
|
2000-09-24 03:43:06 +00:00
|
|
|
|
|
|
|
#ifdef HAVE_VIDMODE
|
|
|
|
if (hasvidmode) {
|
2000-11-21 09:17:29 +00:00
|
|
|
XF86VidModeSwitchToMode (x_disp, x_screen, vidmodes[0]);
|
|
|
|
XFree (vidmodes);
|
2000-09-24 03:43:06 +00:00
|
|
|
}
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2000-10-11 09:54:27 +00:00
|
|
|
x11_grab_keyboard (void)
|
2000-09-24 03:43:06 +00:00
|
|
|
{
|
|
|
|
#ifdef HAVE_VIDMODE
|
2000-10-17 03:17:42 +00:00
|
|
|
if (hasvidmode && vid_fullscreen->int_val) {
|
2000-11-21 09:17:29 +00:00
|
|
|
XGrabKeyboard (x_disp, x_win, 1, GrabModeAsync, GrabModeAsync,
|
2000-12-08 06:51:37 +00:00
|
|
|
CurrentTime);
|
2000-09-24 03:43:06 +00:00
|
|
|
}
|
|
|
|
#endif
|
|
|
|
}
|
2000-10-03 07:10:48 +00:00
|
|
|
|
|
|
|
void
|
|
|
|
x11_set_caption (char *text)
|
|
|
|
{
|
|
|
|
if (x_disp && x_win && text)
|
|
|
|
XStoreName (x_disp, x_win, text);
|
|
|
|
}
|
2000-10-28 05:08:11 +00:00
|
|
|
|
|
|
|
void
|
|
|
|
x11_force_view_port (void)
|
|
|
|
{
|
|
|
|
#ifdef HAVE_VIDMODE
|
2000-12-08 06:51:37 +00:00
|
|
|
int x, y;
|
2000-10-28 05:08:11 +00:00
|
|
|
|
|
|
|
if (vid_fullscreen->int_val) {
|
|
|
|
do {
|
|
|
|
XF86VidModeSetViewPort (x_disp, x_screen, 0, 0);
|
|
|
|
poll (0, 0, 50);
|
|
|
|
XF86VidModeGetViewPort (x_disp, x_screen, &x, &y);
|
|
|
|
} while (x || y);
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
}
|