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;
|
||||
|
||||
static keydest_t old_key_dest = key_none;
|
||||
static int have_focus;
|
||||
|
||||
|
||||
static void
|
||||
event_focusout (void)
|
||||
{
|
||||
if (in_snd_block->int_val) {
|
||||
S_BlockSound ();
|
||||
CDAudio_Pause ();
|
||||
if (have_focus) {
|
||||
have_focus = 0;
|
||||
if (in_snd_block->int_val) {
|
||||
S_BlockSound ();
|
||||
CDAudio_Pause ();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
event_focusin (void)
|
||||
{
|
||||
have_focus = 1;
|
||||
if (in_snd_block->int_val) {
|
||||
S_UnblockSound ();
|
||||
CDAudio_Resume ();
|
||||
|
|
|
@ -497,18 +497,22 @@ event_button (XEvent *event)
|
|||
static void
|
||||
event_focusout (XEvent *event)
|
||||
{
|
||||
x_have_focus = false;
|
||||
XAutoRepeatOn (x_disp);
|
||||
if (in_snd_block->int_val) {
|
||||
S_BlockSound ();
|
||||
CDAudio_Pause ();
|
||||
if (x_have_focus) {
|
||||
Con_Printf ("focusout\n");
|
||||
x_have_focus = false;
|
||||
XAutoRepeatOn (x_disp);
|
||||
if (in_snd_block->int_val) {
|
||||
S_BlockSound ();
|
||||
CDAudio_Pause ();
|
||||
}
|
||||
X11_RestoreGamma ();
|
||||
}
|
||||
X11_RestoreGamma ();
|
||||
}
|
||||
|
||||
static void
|
||||
event_focusin (XEvent *event)
|
||||
{
|
||||
Con_Printf ("focusin\n");
|
||||
x_have_focus = true;
|
||||
if (key_dest == key_game)
|
||||
XAutoRepeatOff (x_disp);
|
||||
|
|
Loading…
Reference in a new issue