Some header cleanup, some whitespace.

This commit is contained in:
Ragnvald Maartmann-Moe IV 2002-08-21 00:04:35 +00:00
parent 5009213564
commit 168915faed
2 changed files with 43 additions and 43 deletions

View file

@ -32,6 +32,12 @@ static const char rcsid[] =
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#ifdef HAVE_STRING_H
# include <string.h>
#endif
#ifdef HAVE_STRINGS_H
# include <strings.h>
#endif
#include <ctype.h>
#include <sys/time.h>
@ -40,13 +46,11 @@ static const char rcsid[] =
#ifdef HAVE_UNISTD_H
# include <unistd.h>
#endif
#ifdef HAVE_EXECINFO_H
# include <execinfo.h>
#endif
#include <stdlib.h>
#include <string.h>
#include <sys/ipc.h>
#include <sys/shm.h>
#include <X11/Xlib.h>
@ -109,6 +113,7 @@ static int xss_interval;
static int xss_blanking;
static int xss_exposures;
qboolean
X11_AddEvent (int event, void (*event_handler) (XEvent *))
{
@ -161,7 +166,7 @@ X11_ProcessEvent (void)
void
X11_ProcessEvents (void)
{
/* Get events from X server. */
// Get events from X server.
while (XPending (x_disp)) {
X11_ProcessEvent ();
}
@ -238,7 +243,6 @@ X11_CreateNullCursor (void)
XDefineCursor (x_disp, x_win, nullcursor);
}
void
X11_ForceMove (int x, int y)
{
@ -260,7 +264,7 @@ X11_ForceMove (int x, int y)
}
X11_ProcessEventProxy (&ev);
}
//X11_GetWindowCoords (&nx, &ny);
// X11_GetWindowCoords (&nx, &ny);
nx -= x;
ny -= y;
if (nx == 0 || ny == 0) {
@ -278,7 +282,7 @@ X11_ForceMove (int x, int y)
XMoveWindow (x_disp, x_win, x, y);
XSync (x_disp, false);
/* this is the best we can do. */
// this is the best we can do.
while (1) {
XEvent ev;
XMaskEvent (x_disp, StructureNotifyMask, &ev);
@ -333,7 +337,8 @@ X11_SetVidMode (int width, int height)
qboolean found_mode = false;
XF86VidModeModeLine orig_data;
XF86VidModeGetAllModeLines (x_disp, x_screen, &nummodes, &vidmodes);
XF86VidModeGetAllModeLines (x_disp, x_screen, &nummodes,
&vidmodes);
XF86VidModeGetModeLine (x_disp, x_screen, &dotclock, &orig_data);
for (i = 0; i < nummodes; i++) {
@ -357,13 +362,14 @@ X11_SetVidMode (int width, int height)
Con_DPrintf ("VID: Chose video mode: %dx%d\n", vid.width,
vid.height);
XF86VidModeSwitchToMode (x_disp, x_screen, vidmodes[best_mode]);
XF86VidModeSwitchToMode (x_disp, x_screen,
vidmodes[best_mode]);
X11_ForceViewPort ();
vidmode_active = true;
X11_SetScreenSaver ();
} else {
Con_Printf ("VID: Mode %dx%d can't go fullscreen.\n", vid.width,
vid.height);
Con_Printf ("VID: Mode %dx%d can't go fullscreen.\n",
vid.width, vid.height);
vidmode_avail = vidmode_active = false;
}
}
@ -371,7 +377,8 @@ X11_SetVidMode (int width, int height)
#endif
}
void X11_UpdateFullscreen (cvar_t *fullscreen)
void
X11_UpdateFullscreen (cvar_t *fullscreen)
{
if (!vid_context_created)
return;
@ -410,7 +417,7 @@ void X11_UpdateFullscreen (cvar_t *fullscreen)
0, 0, 0, 0,
vid.width / 2, vid.height / 2);
X11_ForceViewPort ();
/* Done in X11_SetVidMode but moved the window since then */
// Done in X11_SetVidMode but moved the window since then
}
}
@ -433,7 +440,7 @@ X11_CreateWindow (int width, int height)
char *resname;
unsigned long mask;
/* window attributes */
// window attributes
attr.background_pixel = 0;
attr.colormap = XCreateColormap (x_disp, x_root, x_vis, AllocNone);
attr.event_mask = X_MASK;
@ -515,12 +522,11 @@ X11_GrabKeyboardBool(qboolean yes)
if (yes) {
if (!is_grabbed) {
if (XGrabKeyboard (x_disp, x_win, 1,
GrabModeAsync,
GrabModeAsync,
if (XGrabKeyboard (x_disp, x_win, 1, GrabModeAsync, GrabModeAsync,
CurrentTime) == GrabSuccess) {
is_grabbed = true;
XSetInputFocus (x_disp, x_win, RevertToPointerRoot, CurrentTime);
XSetInputFocus (x_disp, x_win, RevertToPointerRoot,
CurrentTime);
}
}
} else {
@ -544,9 +550,9 @@ X11_GrabMouseBool (qboolean yes)
if (yes) {
if (!is_grabbed) {
if (XGrabPointer (x_disp, x_win, True, MOUSE_MASK,
GrabModeAsync, GrabModeAsync,
x_win, None, CurrentTime) == GrabSuccess) {
if (XGrabPointer (x_disp, x_win, True, MOUSE_MASK, GrabModeAsync,
GrabModeAsync, x_win, None,
CurrentTime) == GrabSuccess) {
is_grabbed = true;
}
}
@ -571,9 +577,8 @@ 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
@ -585,8 +590,6 @@ X11_UngrabKeyboard (void)
void
X11_Grabber(qboolean grab)
{
// static qboolean is_grabbed=false;
if (!vid_context_created) {
Con_Printf ("No video context to grab to!\n");
return;
@ -653,7 +656,7 @@ X11_ForceViewPort (void)
return;
if (!X11_GetWindowCoords (&ax, &ay)) {
/* "icky kludge code" */
// "icky kludge code"
Con_Printf ("VID: Falling back on warp kludge to set viewport.\n");
XWarpPointer (x_disp, None, x_win, 0, 0, 0, 0, scr_width, scr_height);
XWarpPointer (x_disp, None, x_win, 0, 0, 0, 0, 0, 0);

View file

@ -75,14 +75,12 @@ static const char rcsid[] =
#include "context_x11.h"
#include "dga_check.h"
cvar_t *in_snd_block;
cvar_t *in_dga;
cvar_t *in_snd_block;
cvar_t *in_dga;
static qboolean dga_avail;
static qboolean dga_active;
static keydest_t old_key_dest = key_none;
static int p_mouse_x, p_mouse_y;
#define KEY_MASK (KeyPressMask | KeyReleaseMask)
@ -90,6 +88,7 @@ static int p_mouse_x, p_mouse_y;
#define FOCUS_MASK (FocusChangeMask)
#define INPUT_MASK (KEY_MASK | MOUSE_MASK | FOCUS_MASK)
static void
dga_on (void)
{
@ -156,8 +155,8 @@ selection_notify (XEvent *event)
if (num_bytes <= 0)
return;
if (XGetWindowProperty (x_disp, x_win, property, 0, num_bytes, True,
AnyPropertyType, &type, &format, &len,
&tmp, &data) != Success) {
AnyPropertyType, &type, &format, &len, &tmp, &data)
!= Success) {
XFree (data); //FIXME is this correct for this instance?
return;
}
@ -173,12 +172,11 @@ selection_notify (XEvent *event)
static void
XLateKey (XKeyEvent * ev, int *k, int *u)
{
unsigned char buffer[4];
int bytes, unicode;
int key = 0;
KeySym keysym, shifted_keysym;
XComposeStatus compose;
unsigned char buffer[4];
int bytes;
int unicode;
keysym = XLookupKeysym (ev, 0);
bytes = XLookupString (ev, buffer, sizeof(buffer), &shifted_keysym,
@ -386,7 +384,7 @@ XLateKey (XKeyEvent * ev, int *k, int *u)
key = QFK_KP_DIVIDE;
break;
/* For Sun keyboards */
// For Sun keyboards
case XK_F27:
key = QFK_HOME;
break;
@ -400,7 +398,7 @@ XLateKey (XKeyEvent * ev, int *k, int *u)
key = QFK_PAGEDOWN;
break;
/* Some high ASCII symbols, for azerty keymaps */
// Some high ASCII symbols, for azerty keymaps
case XK_twosuperior:
key = QFK_WORLD_18;
break;
@ -421,8 +419,7 @@ XLateKey (XKeyEvent * ev, int *k, int *u)
break;
default:
if (keysym < 128) {
/* ASCII keys */
if (keysym < 128) { // ASCII keys
key = keysym;
if ((key >= 'A') && (key <= 'Z')) {
key = key + ('a' - 'A');
@ -563,7 +560,7 @@ IN_LL_Ungrab_Input (void)
void
IN_LL_SendKeyEvents (void)
{
/* Get events from X server. */
// Get events from X server.
X11_ProcessEvents ();
}
@ -627,10 +624,10 @@ IN_LL_Init (void)
void
IN_LL_Init_Cvars (void)
{
in_snd_block= Cvar_Get ("in_snd_block", "0", CVAR_ARCHIVE, NULL,
"block sound output on window focus loss");
in_snd_block = Cvar_Get ("in_snd_block", "0", CVAR_ARCHIVE, NULL,
"block sound output on window focus loss");
in_dga = Cvar_Get ("in_dga", "1", CVAR_ARCHIVE, in_dga_f,
"DGA Input support");
"DGA Input support");
}