Revert previous fix for #299

Commits reverted:
b652e8b58d
bdf809d039
e9ab970989
481ac54f67

While those commits themselves could be useful even if they don't
completely fix #299, they come with the risks of introduce more
unforeseen bugs, which outweigh their benefit, so revert them.

A brief explanation of their problem:

The fix hinges on the destroy event of the client window to work.
However, the client window could be destroyed so fast, before we even
handle the map, or even the create, event of the frame. And we won't be
listening for substructure events on the frame at the point the client
window is destroyed. Thus completely miss the client window destroy
event.

Because of the inherent racy nature of Xorg, this approach is really
difficult to make work.

Fixes #371

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
This commit is contained in:
Yuxuan Shui
2020-04-06 20:22:54 +01:00
parent bdf809d039
commit 04fe4a76b2
4 changed files with 15 additions and 34 deletions

View File

@ -1037,8 +1037,6 @@ void win_mark_client(session_t *ps, struct managed_win *w, xcb_window_t client)
*/
void win_unmark_client(session_t *ps, struct managed_win *w) {
xcb_window_t client = w->client_win;
log_debug("Detaching client window %#010x from frame %#010x (%s)", client,
w->base.id, w->name);
w->client_win = XCB_NONE;
@ -1054,7 +1052,7 @@ void win_unmark_client(session_t *ps, struct managed_win *w) {
* @param ps current session
* @param w struct _win of the parent window
*/
void win_recheck_client(session_t *ps, struct managed_win *w) {
static void win_recheck_client(session_t *ps, struct managed_win *w) {
// Initialize wmwin to false
w->wmwin = false;
@ -1064,14 +1062,14 @@ void win_recheck_client(session_t *ps, struct managed_win *w) {
// sets override-redirect flags on all frame windows.
xcb_window_t cw = find_client_win(ps, w->base.id);
if (cw) {
log_debug("(%#010x): client %#010x", w->base.id, cw);
log_trace("(%#010x): client %#010x", w->base.id, cw);
}
// Set a window's client window to itself if we couldn't find a
// client window
if (!cw) {
cw = w->base.id;
w->wmwin = !w->a.override_redirect;
log_debug("(%#010x): client self (%s)", w->base.id,
log_trace("(%#010x): client self (%s)", w->base.id,
(w->wmwin ? "wmwin" : "override-redirected"));
}