summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard Grenville <[email protected]>2012-12-08 11:10:08 +0800
committerRichard Grenville <[email protected]>2012-12-08 11:10:08 +0800
commit94f292b9ff1cffd7fade3ba9de9f4ed8d83416db (patch)
tree596d8fa935598e3b56bc7439bb05f65bed3d242a
parentbfbf991af95a40ee5b6421da25b1e2e35e6002cc (diff)
downloadtdebase-94f292b9ff1cffd7fade3ba9de9f4ed8d83416db.tar.gz
tdebase-94f292b9ff1cffd7fade3ba9de9f4ed8d83416db.zip
Bug fix #68: Second attempt to fix client window detection
- Attempt to fix client window detection when WM_STATE property is not yet set when the window is mapped. Thanks to kinclma1 for reporting. - Apply stricter checks for whether window is mapped in determine_evmask() and win_mark_client().
-rw-r--r--compton.c20
1 files changed, 16 insertions, 4 deletions
diff --git a/compton.c b/compton.c
index d06c0d79b..b535383b0 100644
--- a/compton.c
+++ b/compton.c
@@ -825,14 +825,19 @@ condlst_add(wincond_t **pcondlst, const char *pattern) {
static long
determine_evmask(session_t *ps, Window wid, win_evmode_t mode) {
long evmask = NoEventMask;
+ win *w = NULL;
- if (WIN_EVMODE_FRAME == mode || find_win(ps, wid)) {
+ // Check if it's a mapped frame window
+ if (WIN_EVMODE_FRAME == mode
+ || ((w = find_win(ps, wid)) && IsViewable == w->a.map_state)) {
evmask |= PropertyChangeMask;
if (ps->o.track_focus && !ps->o.use_ewmh_active_win)
evmask |= FocusChangeMask;
}
- if (WIN_EVMODE_CLIENT == mode || find_toplevel(ps, wid)) {
+ // Check if it's a mapped client window
+ if (WIN_EVMODE_CLIENT == mode
+ || ((w = find_toplevel(ps, wid)) && IsViewable == w->a.map_state)) {
if (ps->o.frame_opacity || ps->o.track_wdata
|| ps->o.detect_client_opacity)
evmask |= PropertyChangeMask;
@@ -2203,6 +2208,11 @@ static void
win_mark_client(session_t *ps, win *w, Window client) {
w->client_win = client;
+ // If the window isn't mapped yet, stop here, as the function will be
+ // called in map_win()
+ if (IsViewable != w->a.map_state)
+ return;
+
XSelectInput(ps->dpy, client, determine_evmask(ps, client, WIN_EVMODE_CLIENT));
// Make sure the XSelectInput() requests are sent
@@ -3090,8 +3100,10 @@ ev_reparent_notify(session_t *ps, XReparentEvent *ev) {
if (!find_toplevel(ps, ev->window)) {
// If not, look for its frame window
win *w_top = find_toplevel2(ps, ev->parent);
- // If found, and its frame may not have a correct client, continue
- if (w_top && w_top->client_win == w_top->id) {
+ // If found, and the client window has not been determined, or its
+ // frame may not have a correct client, continue
+ if (w_top && (!w_top->client_win
+ || w_top->client_win == w_top->id)) {
// If it has WM_STATE, mark it the client window
if (wid_has_prop(ps, ev->window, ps->atom_client)) {
w_top->wmwin = false;