Improvement: Focus detection & --mark-ovredir-focused changes

- Change focus detection to filter FocusIn/Out events in an alternative
  way. Could break things, and may be revoked in the future.

- Change --mark-ovredir-focused's semantics. Now it determines whether a
  window is to be unconditionally focused by checking if its client
  window is the window itself. This resolves a problem in window
  managers that set frame windows to be override-redirected (Fluxbox and
  i3?). Yes, I know it's bad to change semantics in this way.
pull/2/head
Richard Grenville 12 years ago
parent 1dd73826f9
commit 53aeb801d4

@ -1992,7 +1992,7 @@ map_win(Display *dpy, Window id,
// focused if mark_wmwin_focused is on, or it's over-redirected and
// mark_ovredir_focused is on
if ((opts.mark_wmwin_focused && !w->client_win)
|| (opts.mark_ovredir_focused && w->a.override_redirect))
|| (opts.mark_ovredir_focused && w->id == w->client_win))
w->focused = True;
}
@ -2968,12 +2968,14 @@ ev_focus_report(XFocusChangeEvent* ev) {
* Events
*/
/**
* Determine whether we should respond to a <code>FocusIn/Out</code>
* event.
*/
inline static bool
ev_focus_accept(XFocusChangeEvent *ev) {
return ev->mode == NotifyGrab
|| (ev->mode == NotifyNormal
&& (ev->detail == NotifyNonlinear
|| ev->detail == NotifyNonlinearVirtual));
return ev->detail == NotifyNonlinear
|| ev->detail == NotifyNonlinearVirtual;
}
inline static void
@ -2982,6 +2984,9 @@ ev_focus_in(XFocusChangeEvent *ev) {
ev_focus_report(ev);
#endif
if (!ev_focus_accept(ev))
return;
win *w = find_win(dpy, ev->window);
// To deal with events sent from windows just destroyed
@ -3357,7 +3362,7 @@ usage(void) {
"--shadow-exclude condition\n"
" Exclude conditions for shadows.\n"
"--mark-ovredir-focused\n"
" Mark over-redirect windows as active.\n"
" Mark windows that have no WM frame as active.\n"
"--no-fading-openclose\n"
" Do not fade on window open/close.\n"
"--shadow-ignore-shaped\n"

Loading…
Cancel
Save