mirror of
https://git.code.sf.net/p/quake/newtree
synced 2024-11-21 19:51:18 +00:00
apply Bruce Momjian's update to his sound/focus patch. Thankyou.
This commit is contained in:
parent
c4fe80e9c3
commit
6714119351
1 changed files with 19 additions and 9 deletions
|
@ -87,7 +87,8 @@ static float mouse_x, mouse_y;
|
||||||
static float old_mouse_x, old_mouse_y;
|
static float old_mouse_x, old_mouse_y;
|
||||||
static int p_mouse_x, p_mouse_y;
|
static int p_mouse_x, p_mouse_y;
|
||||||
|
|
||||||
static float save_volume = -1, save_bgmvolume = -1;
|
static float save_volume, save_bgmvolume;
|
||||||
|
int saved_volume = 0;
|
||||||
|
|
||||||
#define KEY_MASK (KeyPressMask | KeyReleaseMask)
|
#define KEY_MASK (KeyPressMask | KeyReleaseMask)
|
||||||
#define MOUSE_MASK (ButtonPressMask | ButtonReleaseMask | PointerMotionMask)
|
#define MOUSE_MASK (ButtonPressMask | ButtonReleaseMask | PointerMotionMask)
|
||||||
|
@ -350,21 +351,30 @@ event_button (XEvent * event)
|
||||||
static void
|
static void
|
||||||
event_focusout (XEvent * event)
|
event_focusout (XEvent * event)
|
||||||
{
|
{
|
||||||
XAutoRepeatOn (x_disp);
|
/* it is possible to receive multiple out of focus events, so only
|
||||||
save_volume = volume->value;
|
* handle the first one.
|
||||||
save_bgmvolume = bgmvolume->value;
|
*/
|
||||||
volume->value = 0;
|
if (saved_volume == 0)
|
||||||
bgmvolume->value = 0;
|
{
|
||||||
|
XAutoRepeatOn (x_disp);
|
||||||
|
save_volume = volume->value;
|
||||||
|
save_bgmvolume = bgmvolume->value;
|
||||||
|
volume->value = 0;
|
||||||
|
bgmvolume->value = 0;
|
||||||
|
saved_volume = 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
event_focusin (XEvent * event)
|
event_focusin (XEvent * event)
|
||||||
{
|
{
|
||||||
XAutoRepeatOff (x_disp);
|
if (saved_volume == 1)
|
||||||
if (save_volume != -1)
|
{
|
||||||
|
XAutoRepeatOff (x_disp);
|
||||||
volume->value = save_volume;
|
volume->value = save_volume;
|
||||||
if (save_bgmvolume != -1)
|
|
||||||
bgmvolume->value = save_bgmvolume;
|
bgmvolume->value = save_bgmvolume;
|
||||||
|
saved_volume = 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
Loading…
Reference in a new issue