mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-02-18 18:01:13 +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 int scr_width, scr_height;
|
||||||
extern byte gammatable[256];
|
extern byte gammatable[256];
|
||||||
|
extern struct cvar_s *vid_gamma;
|
||||||
extern qboolean vid_gamma_avail;
|
extern qboolean vid_gamma_avail;
|
||||||
|
|
||||||
// called at startup and after any gamma correction
|
// called at startup and after any gamma correction
|
||||||
|
|
|
@ -47,6 +47,7 @@ extern int x_shmeventtype;
|
||||||
extern Time x_time;
|
extern Time x_time;
|
||||||
extern qboolean doShm;
|
extern qboolean doShm;
|
||||||
extern qboolean oktodraw;
|
extern qboolean oktodraw;
|
||||||
|
extern qboolean x_have_focus;
|
||||||
|
|
||||||
void GetEvent (void);
|
void GetEvent (void);
|
||||||
|
|
||||||
|
|
|
@ -91,7 +91,9 @@ Window x_win;
|
||||||
Cursor nullcursor = None;
|
Cursor nullcursor = None;
|
||||||
Time x_time;
|
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)
|
#define MOUSE_MASK (ButtonPressMask | ButtonReleaseMask | PointerMotionMask)
|
||||||
|
|
||||||
#ifdef HAVE_VIDMODE
|
#ifdef HAVE_VIDMODE
|
||||||
|
@ -667,7 +669,7 @@ X11_SetGamma (double gamma)
|
||||||
# ifdef X_XF86VidModeSetGamma
|
# ifdef X_XF86VidModeSetGamma
|
||||||
XF86VidModeGamma xgamma;
|
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;
|
xgamma.red = xgamma.green = xgamma.blue = (float) gamma;
|
||||||
if (XF86VidModeSetGamma (x_disp, x_screen, &xgamma))
|
if (XF86VidModeSetGamma (x_disp, x_screen, &xgamma))
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -480,22 +480,26 @@ event_button (XEvent *event)
|
||||||
static void
|
static void
|
||||||
event_focusout (XEvent *event)
|
event_focusout (XEvent *event)
|
||||||
{
|
{
|
||||||
|
x_have_focus = false;
|
||||||
XAutoRepeatOn (x_disp);
|
XAutoRepeatOn (x_disp);
|
||||||
if (in_snd_block->int_val) {
|
if (in_snd_block->int_val) {
|
||||||
S_BlockSound ();
|
S_BlockSound ();
|
||||||
CDAudio_Pause ();
|
CDAudio_Pause ();
|
||||||
}
|
}
|
||||||
|
X11_RestoreGamma ();
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
event_focusin (XEvent *event)
|
event_focusin (XEvent *event)
|
||||||
{
|
{
|
||||||
|
x_have_focus = true;
|
||||||
if (key_dest == key_game)
|
if (key_dest == key_game)
|
||||||
XAutoRepeatOff (x_disp);
|
XAutoRepeatOff (x_disp);
|
||||||
if (in_snd_block->int_val) {
|
if (in_snd_block->int_val) {
|
||||||
S_UnblockSound ();
|
S_UnblockSound ();
|
||||||
CDAudio_Resume ();
|
CDAudio_Resume ();
|
||||||
}
|
}
|
||||||
|
VID_UpdateGamma (vid_gamma);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
|
@ -387,14 +387,14 @@ x11_init_buffers (void)
|
||||||
|
|
||||||
vid.aspect = ((float) vid.height / (float) vid.width) * (320.0 / 240.0);
|
vid.aspect = ((float) vid.height / (float) vid.width) * (320.0 / 240.0);
|
||||||
}
|
}
|
||||||
|
#if 0
|
||||||
static void
|
static void
|
||||||
event_shm (XEvent * event)
|
event_shm (XEvent * event)
|
||||||
{
|
{
|
||||||
if (doShm)
|
if (doShm)
|
||||||
oktodraw = true;
|
oktodraw = true;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
static void
|
static void
|
||||||
VID_Center_f (void) {
|
VID_Center_f (void) {
|
||||||
X11_ForceViewPort ();
|
X11_ForceViewPort ();
|
||||||
|
@ -548,7 +548,7 @@ VID_Init (unsigned char *palette)
|
||||||
VID_InitBuffers ();
|
VID_InitBuffers ();
|
||||||
|
|
||||||
// XSynchronize (x_disp, False);
|
// XSynchronize (x_disp, False);
|
||||||
X11_AddEvent (x_shmeventtype, event_shm);
|
// X11_AddEvent (x_shmeventtype, event_shm);
|
||||||
|
|
||||||
vid.initialized = true;
|
vid.initialized = true;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue