From 0fbfd46be0540558fde00baa7085bfe3ff616d53 Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Thu, 5 Jul 2001 19:22:28 +0000 Subject: [PATCH] I decided to apply Bruce's sound/focus patch as is after all. --- source/in_x11.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/source/in_x11.c b/source/in_x11.c index a35e051..30b6b1c 100644 --- a/source/in_x11.c +++ b/source/in_x11.c @@ -67,6 +67,7 @@ #include "joystick.h" #include "keys.h" #include "qargs.h" +#include "sound.h" #include "sys.h" #include "view.h" @@ -86,6 +87,8 @@ static float mouse_x, mouse_y; static float old_mouse_x, old_mouse_y; static int p_mouse_x, p_mouse_y; +static float save_volume = -1, save_bgmvolume = -1; + #define KEY_MASK (KeyPressMask | KeyReleaseMask) #define MOUSE_MASK (ButtonPressMask | ButtonReleaseMask | PointerMotionMask) #define FOCUS_MASK (FocusChangeMask) @@ -348,12 +351,20 @@ static void event_focusout (XEvent * event) { XAutoRepeatOn (x_disp); + save_volume = volume->value; + save_bgmvolume = bgmvolume->value; + volume->value = 0; + bgmvolume->value = 0; } static void event_focusin (XEvent * event) { XAutoRepeatOff (x_disp); + if (save_volume != -1) + volume->value = save_volume; + if (save_bgmvolume != -1) + bgmvolume->value = save_bgmvolume; } static void