summaryrefslogtreecommitdiff
path: root/src/vwm.c
diff options
context:
space:
mode:
authorVito Caputo <vcaputo@pengaru.com>2017-10-05 16:54:38 -0700
committerVito Caputo <vcaputo@pengaru.com>2017-10-05 16:54:38 -0700
commit55e7b6fa5bbb84dc8f2689ff674b27706ffe5ef3 (patch)
tree1d152a7fa0c7f09fd0652f8f9720393d9ebbee3f /src/vwm.c
parent7096b3b6c1325630d18e5d61aac58f9c3772b8e1 (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/vwm.c')
-rw-r--r--src/vwm.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/vwm.c b/src/vwm.c
index 179b1dc..c2c3027 100644
--- a/src/vwm.c
+++ b/src/vwm.c
@@ -126,7 +126,7 @@ static vwm_t * vwm_startup(void)
#undef color
XSelectInput(VWM_XDISPLAY(vwm), VWM_XROOT(vwm),
- PropertyChangeMask | SubstructureNotifyMask | SubstructureRedirectMask | PointerMotionMask | ButtonPressMask | ButtonReleaseMask);
+ FocusChangeMask | PropertyChangeMask | SubstructureNotifyMask | SubstructureRedirectMask | PointerMotionMask | ButtonPressMask | ButtonReleaseMask);
XGrabKey(VWM_XDISPLAY(vwm), AnyKey, WM_GRAB_MODIFIER, VWM_XROOT(vwm), False, GrabModeAsync, GrabModeAsync);
XFlush(VWM_XDISPLAY(vwm));
@@ -259,6 +259,15 @@ void vwm_process_event(vwm_t *vwm)
vwm_xevent_handle_property_notify(vwm, &event.xproperty);
break;
+ case FocusIn:
+ VWM_TRACE("focusin");
+ vwm_xevent_handle_focusin(vwm, &event.xfocus);
+ break;
+
+ case FocusOut:
+ VWM_TRACE("focusout");
+ break;
+
case MappingNotify:
VWM_TRACE("mapping notify");
vwm_xevent_handle_mapping_notify(vwm, &event.xmapping);
© All Rights Reserved