mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-01-18 06:51:47 +00:00
"debounce" (Despair's term:) focus handling in X. Seems multiple focusout
events can arrive when switching workplaces, but only one focusin when returning. Not good...
This commit is contained in:
parent
1c21708e8c
commit
1a1d461f0c
2 changed files with 18 additions and 9 deletions
|
@ -50,20 +50,25 @@ static __attribute__ ((unused)) const char rcsid[] =
|
||||||
cvar_t *in_snd_block;
|
cvar_t *in_snd_block;
|
||||||
|
|
||||||
static keydest_t old_key_dest = key_none;
|
static keydest_t old_key_dest = key_none;
|
||||||
|
static int have_focus;
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
event_focusout (void)
|
event_focusout (void)
|
||||||
{
|
{
|
||||||
if (in_snd_block->int_val) {
|
if (have_focus) {
|
||||||
S_BlockSound ();
|
have_focus = 0;
|
||||||
CDAudio_Pause ();
|
if (in_snd_block->int_val) {
|
||||||
|
S_BlockSound ();
|
||||||
|
CDAudio_Pause ();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
event_focusin (void)
|
event_focusin (void)
|
||||||
{
|
{
|
||||||
|
have_focus = 1;
|
||||||
if (in_snd_block->int_val) {
|
if (in_snd_block->int_val) {
|
||||||
S_UnblockSound ();
|
S_UnblockSound ();
|
||||||
CDAudio_Resume ();
|
CDAudio_Resume ();
|
||||||
|
|
|
@ -497,18 +497,22 @@ event_button (XEvent *event)
|
||||||
static void
|
static void
|
||||||
event_focusout (XEvent *event)
|
event_focusout (XEvent *event)
|
||||||
{
|
{
|
||||||
x_have_focus = false;
|
if (x_have_focus) {
|
||||||
XAutoRepeatOn (x_disp);
|
Con_Printf ("focusout\n");
|
||||||
if (in_snd_block->int_val) {
|
x_have_focus = false;
|
||||||
S_BlockSound ();
|
XAutoRepeatOn (x_disp);
|
||||||
CDAudio_Pause ();
|
if (in_snd_block->int_val) {
|
||||||
|
S_BlockSound ();
|
||||||
|
CDAudio_Pause ();
|
||||||
|
}
|
||||||
|
X11_RestoreGamma ();
|
||||||
}
|
}
|
||||||
X11_RestoreGamma ();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
event_focusin (XEvent *event)
|
event_focusin (XEvent *event)
|
||||||
{
|
{
|
||||||
|
Con_Printf ("focusin\n");
|
||||||
x_have_focus = true;
|
x_have_focus = true;
|
||||||
if (key_dest == key_game)
|
if (key_dest == key_game)
|
||||||
XAutoRepeatOff (x_disp);
|
XAutoRepeatOff (x_disp);
|
||||||
|
|
Loading…
Reference in a new issue