event: destroy: unmark client when a client window is destroyed

We do nothing when a non-wm-frame window is destroyed. This will cause
trouble if a wm-frame window is reused (i.e. its child is destroyed then
a new child is reparented to it), because we didn't clear client_win.

So this commit adds a call to win_unmark_client for that case.

Related: #299

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
This commit is contained in:
Yuxuan Shui 2020-04-05 21:30:33 +01:00
parent 68fa49cf59
commit b652e8b58d
No known key found for this signature in database
GPG Key ID: 37C999F617EA1A47
1 changed files with 14 additions and 1 deletions

View File

@ -263,8 +263,21 @@ static inline void ev_configure_notify(session_t *ps, xcb_configure_notify_event
static inline void ev_destroy_notify(session_t *ps, xcb_destroy_notify_event_t *ev) {
auto w = find_win(ps, ev->window);
if (w) {
auto mw = find_toplevel(ps, ev->window);
if (mw && mw->client_win == mw->base.id) {
// We only want _real_ frame window
assert(&mw->base == w);
mw = NULL;
}
assert(w == NULL || mw == NULL);
if (w != NULL) {
auto _ attr_unused = destroy_win_start(ps, w);
} else if (mw != NULL) {
win_unmark_client(ps, mw);
} else {
log_debug("Received a destroy notify from an unknown window, %#010x",
ev->window);
}
}