Fix gamma again. Also some minor whitespace and slight code cleanup.

This commit is contained in:
Jeff Teunissen 2002-04-26 20:25:01 +00:00
parent ac73653741
commit 411ade4ce2

View file

@ -274,6 +274,8 @@ X11_OpenDisplay (void)
void
X11_CloseDisplay (void)
{
X11_RestoreGamma ();
if (nullcursor != None) {
XFreeCursor (x_disp, nullcursor);
nullcursor = None;
@ -465,22 +467,25 @@ void X11_UpdateFullscreen (cvar_t *fullscreen)
if (in_grab) {
IN_UpdateGrab (in_grab);
}
if (X11_GetWindowCoords (&window_x, &window_y))
window_saved = 1;
X11_SetVidMode (scr_width, scr_height);
if (!vidmode_active) {
if (in_grab) {
if (in_grab) { // FIXME: why are there two of these?
IN_UpdateGrab (in_grab);
}
if (!vidmode_active) {
window_saved = 0;
return;
}
if (in_grab) {
IN_UpdateGrab (in_grab);
}
X11_ForceMove (0, 0);
XWarpPointer(x_disp,None,x_win,0,0,0,0,vid.width/2,vid.height/2);
XWarpPointer (x_disp, None, x_win,
0, 0, 0, 0,
vid.width / 2, vid.height / 2);
X11_ForceViewPort ();
/* Done in X11_SetVidMode but moved the window since then */
}
@ -542,6 +547,7 @@ X11_CreateWindow (int width, int height)
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);
@ -550,6 +556,7 @@ X11_CreateWindow (int width, int height)
while (1) {
XEvent ev;
XMaskEvent (x_disp, StructureNotifyMask, &ev);
if (ev.type == MapNotify) {
X11_ProcessEventProxy (&ev);
@ -557,6 +564,7 @@ X11_CreateWindow (int width, int height)
}
X11_ProcessEventProxy (&ev);
}
vid_context_created = true;
if (vid_fullscreen->int_val) {
X11_UpdateFullscreen (vid_fullscreen);
@ -570,7 +578,6 @@ X11_RestoreVidMode (void)
#ifdef HAVE_VIDMODE
if (vidmode_active) {
X11_RestoreScreenSaver ();
X11_RestoreGamma ();
XF86VidModeSwitchToMode (x_disp, x_screen, vidmodes[original_mode]);
XFree (vidmodes);
vidmode_active = false;
@ -620,11 +627,14 @@ X11_GrabMouseBool(qboolean yes)
is_grabbed = true;
}
}
} else {
return;
}
XUngrabPointer (x_disp, CurrentTime);
is_grabbed = false;
XWarpPointer(x_disp,x_win,x_win,0,0,0,0,vid.width/2,vid.height/2);
}
XWarpPointer (x_disp, x_win, x_win,
0, 0, 0, 0,
vid.width / 2, vid.height / 2);
}
void
@ -638,7 +648,9 @@ void
X11_UngrabMouse(void)
{
XUngrabPointer (x_disp, CurrentTime);
XWarpPointer(x_disp,x_win,x_win,0,0,0,0,vid.width/2,vid.height/2);
XWarpPointer (x_disp, x_win, x_win,
0, 0, 0, 0,
vid.width / 2, vid.height / 2);
}
void
@ -691,6 +703,7 @@ X11_GetWindowCoords (int *ax, int *ay)
Window theroot, scrap;
int x, y;
unsigned int width, height, bdwidth, depth;
XSync (x_disp, false);
if ((XGetGeometry (x_disp, x_win, &theroot, &x, &y, &width, &height,
&bdwidth, &depth) == False)) {