Bug fix #153: Possible fix for a rare timing issue
Possible fix for a very rare timing issue in focus detection. Compton may fail to detect the currently focused window, when a window newly mapped gets focused, we failed to listen to events and get FocusIn from it in time, and a series of focus change events before it happens stay in the event queue and puzzled compton. My choice is to force focus recheck on all focus-related events. More roundtrips to X, but not necessarily worse performance, due to the high cost of focus flipping especially when there's a lot of conditions. Thanks to SlackBox for reporting. (#153)
This commit is contained in:
parent
796e2c6fec
commit
d8977408fd
2
Makefile
2
Makefile
|
@ -49,7 +49,7 @@ ifeq "$(NO_VSYNC_DRM)" ""
|
||||||
CFG += -DCONFIG_VSYNC_DRM
|
CFG += -DCONFIG_VSYNC_DRM
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# ==== OpenGL VSync ====
|
# ==== OpenGL ====
|
||||||
ifeq "$(NO_VSYNC_OPENGL)" ""
|
ifeq "$(NO_VSYNC_OPENGL)" ""
|
||||||
CFG += -DCONFIG_VSYNC_OPENGL
|
CFG += -DCONFIG_VSYNC_OPENGL
|
||||||
# -lGL must precede some other libraries, or it segfaults on FreeBSD (#74)
|
# -lGL must precede some other libraries, or it segfaults on FreeBSD (#74)
|
||||||
|
|
|
@ -30,6 +30,7 @@
|
||||||
// #define DEBUG_GLX_GLSL 1
|
// #define DEBUG_GLX_GLSL 1
|
||||||
// #define DEBUG_GLX_ERR 1
|
// #define DEBUG_GLX_ERR 1
|
||||||
// #define DEBUG_GLX_MARK 1
|
// #define DEBUG_GLX_MARK 1
|
||||||
|
// #define DEBUG_GLX_PAINTREG 1
|
||||||
// #define MONITOR_REPAINT 1
|
// #define MONITOR_REPAINT 1
|
||||||
|
|
||||||
// Whether to enable PCRE regular expression support in blacklists, enabled
|
// Whether to enable PCRE regular expression support in blacklists, enabled
|
||||||
|
|
|
@ -781,6 +781,12 @@ recheck_focus(session_t *ps) {
|
||||||
|
|
||||||
win *w = find_win_all(ps, wid);
|
win *w = find_win_all(ps, wid);
|
||||||
|
|
||||||
|
#ifdef DEBUG_EVENTS
|
||||||
|
print_timestamp(ps);
|
||||||
|
printf_dbgf("(): %#010lx (%#010lx \"%s\") focused.\n", wid,
|
||||||
|
(w ? w->id: None), (w ? w->name: NULL));
|
||||||
|
#endif
|
||||||
|
|
||||||
// And we set the focus state here
|
// And we set the focus state here
|
||||||
if (w) {
|
if (w) {
|
||||||
win_set_focused(ps, w, true);
|
win_set_focused(ps, w, true);
|
||||||
|
@ -3815,12 +3821,7 @@ ev_focus_in(session_t *ps, XFocusChangeEvent *ev) {
|
||||||
ev_focus_report(ev);
|
ev_focus_report(ev);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (!ev_focus_accept(ev))
|
recheck_focus(ps);
|
||||||
return;
|
|
||||||
|
|
||||||
win *w = find_win_all(ps, ev->window);
|
|
||||||
if (w)
|
|
||||||
win_set_focused(ps, w, true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
inline static void
|
inline static void
|
||||||
|
@ -3829,12 +3830,7 @@ ev_focus_out(session_t *ps, XFocusChangeEvent *ev) {
|
||||||
ev_focus_report(ev);
|
ev_focus_report(ev);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (!ev_focus_accept(ev))
|
recheck_focus(ps);
|
||||||
return;
|
|
||||||
|
|
||||||
win *w = find_win_all(ps, ev->window);
|
|
||||||
if (w)
|
|
||||||
win_set_focused(ps, w, false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
inline static void
|
inline static void
|
||||||
|
|
Loading…
Reference in New Issue