mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-26 22:31:05 +00:00
don't adjust the system gamma unless the window has focus. also quench an
internal warning (the event system can't handle shm events (doesn't seem to need to anyway)).
This commit is contained in:
parent
1f04776ad1
commit
53d3252792
5 changed files with 13 additions and 5 deletions
|
@ -87,6 +87,7 @@ extern unsigned int d_8to24table[256];
|
|||
|
||||
extern int scr_width, scr_height;
|
||||
extern byte gammatable[256];
|
||||
extern struct cvar_s *vid_gamma;
|
||||
extern qboolean vid_gamma_avail;
|
||||
|
||||
// called at startup and after any gamma correction
|
||||
|
|
|
@ -47,6 +47,7 @@ extern int x_shmeventtype;
|
|||
extern Time x_time;
|
||||
extern qboolean doShm;
|
||||
extern qboolean oktodraw;
|
||||
extern qboolean x_have_focus;
|
||||
|
||||
void GetEvent (void);
|
||||
|
||||
|
|
|
@ -91,7 +91,9 @@ Window x_win;
|
|||
Cursor nullcursor = None;
|
||||
Time x_time;
|
||||
|
||||
#define X_MASK (VisibilityChangeMask | StructureNotifyMask | ExposureMask)
|
||||
qboolean x_have_focus = false;
|
||||
|
||||
#define X_MASK (VisibilityChangeMask | StructureNotifyMask | ExposureMask | FocusChangeMask)
|
||||
#define MOUSE_MASK (ButtonPressMask | ButtonReleaseMask | PointerMotionMask)
|
||||
|
||||
#ifdef HAVE_VIDMODE
|
||||
|
@ -667,7 +669,7 @@ X11_SetGamma (double gamma)
|
|||
# ifdef X_XF86VidModeSetGamma
|
||||
XF86VidModeGamma xgamma;
|
||||
|
||||
if (vid_gamma_avail && vid_system_gamma->int_val) {
|
||||
if (vid_gamma_avail && vid_system_gamma->int_val && x_have_focus) {
|
||||
xgamma.red = xgamma.green = xgamma.blue = (float) gamma;
|
||||
if (XF86VidModeSetGamma (x_disp, x_screen, &xgamma))
|
||||
return true;
|
||||
|
|
|
@ -480,22 +480,26 @@ event_button (XEvent *event)
|
|||
static void
|
||||
event_focusout (XEvent *event)
|
||||
{
|
||||
x_have_focus = false;
|
||||
XAutoRepeatOn (x_disp);
|
||||
if (in_snd_block->int_val) {
|
||||
S_BlockSound ();
|
||||
CDAudio_Pause ();
|
||||
}
|
||||
X11_RestoreGamma ();
|
||||
}
|
||||
|
||||
static void
|
||||
event_focusin (XEvent *event)
|
||||
{
|
||||
x_have_focus = true;
|
||||
if (key_dest == key_game)
|
||||
XAutoRepeatOff (x_disp);
|
||||
if (in_snd_block->int_val) {
|
||||
S_UnblockSound ();
|
||||
CDAudio_Resume ();
|
||||
}
|
||||
VID_UpdateGamma (vid_gamma);
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
@ -387,14 +387,14 @@ x11_init_buffers (void)
|
|||
|
||||
vid.aspect = ((float) vid.height / (float) vid.width) * (320.0 / 240.0);
|
||||
}
|
||||
|
||||
#if 0
|
||||
static void
|
||||
event_shm (XEvent * event)
|
||||
{
|
||||
if (doShm)
|
||||
oktodraw = true;
|
||||
}
|
||||
|
||||
#endif
|
||||
static void
|
||||
VID_Center_f (void) {
|
||||
X11_ForceViewPort ();
|
||||
|
@ -548,7 +548,7 @@ VID_Init (unsigned char *palette)
|
|||
VID_InitBuffers ();
|
||||
|
||||
// XSynchronize (x_disp, False);
|
||||
X11_AddEvent (x_shmeventtype, event_shm);
|
||||
// X11_AddEvent (x_shmeventtype, event_shm);
|
||||
|
||||
vid.initialized = true;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue