summaryrefslogtreecommitdiffstats
path: root/compton.c
diff options
context:
space:
mode:
authorRichard Grenville <pyxlcy@gmail.com>2012-11-27 00:02:18 +0800
committerRichard Grenville <pyxlcy@gmail.com>2012-11-27 08:41:55 +0800
commit722252851570be312d369767cce119eac63db63c (patch)
treea1bc1cbb07e758e73c999f1f360e49c7674bbe0a /compton.c
parentf126bf72f869a647db9e7e434b72b269eeffa48e (diff)
downloadtdebase-722252851570be312d369767cce119eac63db63c.tar.gz
tdebase-722252851570be312d369767cce119eac63db63c.zip
Bug fix: --use-ewmh-active-win causes wrong focus state in Awesome
- Fix a bug that causes wrong focus detection result in Awesome and maybe other window managers, when --use-ewmh-active-win is enabled and _NET_ACTIVE_WINDOW changes before the newly-focused window is mapped. - Fix a typo that causes more than one window to stay focused after a window destruction with --use-ewmh-active-win. - Fix a bug that find_clientwin() incorrectly returns a window when window ID 0 is passed to it. - Check for window ID 0 in update_ewmh_active_win().
Diffstat (limited to 'compton.c')
-rw-r--r--compton.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/compton.c b/compton.c
index 6e2784f9e..045c536c7 100644
--- a/compton.c
+++ b/compton.c
@@ -849,6 +849,9 @@ determine_evmask(session_t *ps, Window wid, win_evmode_t mode) {
*/
static win *
find_win(session_t *ps, Window id) {
+ if (!id)
+ return NULL;
+
win *w;
for (w = ps->list; w; w = w->next) {
@@ -867,6 +870,9 @@ find_win(session_t *ps, Window id) {
*/
static win *
find_toplevel(session_t *ps, Window id) {
+ if (!id)
+ return NULL;
+
win *w;
for (w = ps->list; w; w = w->next) {
@@ -1775,6 +1781,9 @@ map_win(session_t *ps, Window id) {
if (!w || InputOnly == w->a.class) return;
w->focused = false;
+ if (ps->o.use_ewmh_active_win && w == ps->active_win)
+ w->focused = true;
+
w->a.map_state = IsViewable;
// Call XSelectInput() before reading properties so that no property
@@ -2484,7 +2493,7 @@ finish_destroy_win(session_t *ps, Window id) {
*prev = w->next;
// Clear active_win if it's pointing to the destroyed window
- if (ps->active_win)
+ if (w == ps->active_win)
ps->active_win = NULL;
free_win_res(ps, w);
@@ -3024,7 +3033,7 @@ update_ewmh_active_win(session_t *ps) {
win *w = NULL;
free_winprop(&prop);
- if (!(w = find_toplevel(ps, wid)))
+ if (wid && !(w = find_toplevel(ps, wid)))
if (!(w = find_win(ps, wid)))
w = find_toplevel2(ps, wid);