From b90b0322386c7c51bcc8e775c221dabfd0dae8fb Mon Sep 17 00:00:00 2001 From: Spoike Date: Tue, 9 Apr 2013 00:18:38 +0000 Subject: [PATCH] global focus dsound in win32. give it the desktop window so we don't have to care about window handles. git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4306 fc73d0e0-1445-4013-8a0c-d673dee63da5 --- engine/client/snd_directx.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/engine/client/snd_directx.c b/engine/client/snd_directx.c index 572332efb..f4a0785fb 100644 --- a/engine/client/snd_directx.c +++ b/engine/client/snd_directx.c @@ -689,7 +689,9 @@ static int DSOUND_InitCard_Internal (soundcardinfo_t *sc, int cardnum) return SND_ERROR; } - SendMessage(mainwindow, WM_USER, 0, 0); +#ifdef _SDL +#define mainwindow GetDesktopWindow() +#endif if (DS_OK != dh->pDS->lpVtbl->SetCooperativeLevel (dh->pDS, mainwindow, DSSCL_EXCLUSIVE)) { Con_SafePrintf ("Set coop level failed\n"); @@ -707,8 +709,10 @@ static int DSOUND_InitCard_Internal (soundcardinfo_t *sc, int cardnum) dsbuf.lpwfxFormat = NULL; #ifdef DSBCAPS_GLOBALFOCUS +#ifndef _SDL if (snd_inactive.ival || sys_parentwindow ) /*always inactive if we have a parent window, because we can't tell properly otherwise*/ +#endif { dsbuf.dwFlags |= DSBCAPS_GLOBALFOCUS; sc->inactive_sound = true;