summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard Grenville <[email protected]>2012-11-03 22:02:07 +0800
committerRichard Grenville <[email protected]>2012-11-03 22:15:51 +0800
commit53aeb801d4a22fc3e80cc1953a52dd492e77165f (patch)
tree53a7bc0e69a0acb93c7a00f5c4de49a54a951c26
parent1dd73826f941d2034d763e47280e527e5c731309 (diff)
downloadtdebase-53aeb801d4a22fc3e80cc1953a52dd492e77165f.tar.gz
tdebase-53aeb801d4a22fc3e80cc1953a52dd492e77165f.zip
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.
-rw-r--r--compton.c17
1 files changed, 11 insertions, 6 deletions
diff --git a/compton.c b/compton.c
index 235ef6ed5..8e7500cb2 100644
--- a/compton.c
+++ b/compton.c
@@ -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"