diff options
author | Vito Caputo <vcaputo@pengaru.com> | 2017-10-05 16:54:38 -0700 |
---|---|---|
committer | Vito Caputo <vcaputo@pengaru.com> | 2017-10-05 16:54:38 -0700 |
commit | 55e7b6fa5bbb84dc8f2689ff674b27706ffe5ef3 (patch) | |
tree | 1d152a7fa0c7f09fd0652f8f9720393d9ebbee3f /src/xevent.c | |
parent | 7096b3b6c1325630d18e5d61aac58f9c3772b8e1 (diff) |
*: handle FocusIn events
Some programs call XSetInputFocus(), so we should select
FocusChangeEvent and handle FocusIn events, calling vwm_win_set_focus()
when appropriate.
It's rare, but SDL2 programs in particular seem to do this and vwm gets
in a pretty annoying state when it does occur. This change should
improve the situation.
Diffstat (limited to 'src/xevent.c')
-rw-r--r-- | src/xevent.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/xevent.c b/src/xevent.c index e1b38e3..a14f37e 100644 --- a/src/xevent.c +++ b/src/xevent.c @@ -227,6 +227,19 @@ void vwm_xevent_handle_property_notify(vwm_t *vwm, XPropertyEvent *ev) } +void vwm_xevent_handle_focusin(vwm_t *vwm, XFocusInEvent *ev) +{ + vwm_window_t *vwin; + + if (ev->mode != NotifyNormal) + return; + + if ((vwin = vwm_win_lookup(vwm, ev->window)) && + (vwin != vwm_win_get_focused(vwm))) + vwm_win_set_focused(vwm, vwin); +} + + void vwm_xevent_handle_mapping_notify(vwm_t *vwm, XMappingEvent *ev) { XRefreshKeyboardMapping(ev); |