I decided to apply Bruce's sound/focus patch as is after all.

This commit is contained in:
Bill Currie 2001-07-05 19:22:28 +00:00
parent 6c04ad09f8
commit 0fbfd46be0

View file

@ -67,6 +67,7 @@
#include "joystick.h" #include "joystick.h"
#include "keys.h" #include "keys.h"
#include "qargs.h" #include "qargs.h"
#include "sound.h"
#include "sys.h" #include "sys.h"
#include "view.h" #include "view.h"
@ -86,6 +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;
#define KEY_MASK (KeyPressMask | KeyReleaseMask) #define KEY_MASK (KeyPressMask | KeyReleaseMask)
#define MOUSE_MASK (ButtonPressMask | ButtonReleaseMask | PointerMotionMask) #define MOUSE_MASK (ButtonPressMask | ButtonReleaseMask | PointerMotionMask)
#define FOCUS_MASK (FocusChangeMask) #define FOCUS_MASK (FocusChangeMask)
@ -348,12 +351,20 @@ static void
event_focusout (XEvent * event) event_focusout (XEvent * event)
{ {
XAutoRepeatOn (x_disp); XAutoRepeatOn (x_disp);
save_volume = volume->value;
save_bgmvolume = bgmvolume->value;
volume->value = 0;
bgmvolume->value = 0;
} }
static void static void
event_focusin (XEvent * event) event_focusin (XEvent * event)
{ {
XAutoRepeatOff (x_disp); XAutoRepeatOff (x_disp);
if (save_volume != -1)
volume->value = save_volume;
if (save_bgmvolume != -1)
bgmvolume->value = save_bgmvolume;
} }
static void static void