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