mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-26 22:31:05 +00:00
[x11] Send app focus loss/gain events
Other subsystems, especially low-level input drivers, need to know when the app has input focus. eg, as the evdev driver uses the raw stream from the kernel, which has no idea about X application focus (in fact, it seems the events are shared across multiple apps without any issue), the evdev driver sees all the events thus needs to know when to drop them.
This commit is contained in:
parent
67483eea37
commit
ce8eac5ca0
1 changed files with 12 additions and 0 deletions
|
@ -639,11 +639,22 @@ XLateKey (XKeyEvent *ev, int *k, int *u)
|
|||
*u = unicode;
|
||||
}
|
||||
|
||||
static void
|
||||
in_x11_send_focus_event (int gain)
|
||||
{
|
||||
IE_event_t event = {
|
||||
.type = gain ? ie_app_gain_focus : ie_app_lose_focus,
|
||||
.when = Sys_LongTime (),
|
||||
};
|
||||
IE_Send_Event (&event);
|
||||
}
|
||||
|
||||
static void
|
||||
event_focusout (XEvent *event)
|
||||
{
|
||||
if (x_have_focus) {
|
||||
x_have_focus = false;
|
||||
in_x11_send_focus_event (0);
|
||||
if (in_snd_block->int_val) {
|
||||
S_BlockSound ();
|
||||
CDAudio_Pause ();
|
||||
|
@ -655,6 +666,7 @@ event_focusout (XEvent *event)
|
|||
static void
|
||||
event_focusin (XEvent *event)
|
||||
{
|
||||
in_x11_send_focus_event (1);
|
||||
x_have_focus = true;
|
||||
if (in_snd_block->int_val) {
|
||||
S_UnblockSound ();
|
||||
|
|
Loading…
Reference in a new issue