diff --git a/README.md b/README.md index a96c7dc9da..394933d108 100644 --- a/README.md +++ b/README.md @@ -65,7 +65,7 @@ On Fedora, the needed packages are dbus-devel gcc git libconfig-devel libdrm-devel libev-devel libX11-devel libX11-xcb libxcb-devel libGL-devel libEGL-devel libepoxy-devel meson pcre2-devel pixman-devel uthash-devel xcb-util-image-devel xcb-util-renderutil-devel xorg-x11-proto-devel xcb-util-devel ``` -To build the documents, you need `asciidoc` +To build the documents, you need `asciidoctor` ### To build diff --git a/src/picom.c b/src/picom.c index afeeb7718b..8e52a4d9d4 100644 --- a/src/picom.c +++ b/src/picom.c @@ -1453,6 +1453,8 @@ static void unredirect(session_t *ps) { /// keeps an internal queue of events, so we have to be 100% sure no events are /// left in that queue before we go to sleep. static void handle_x_events(struct session *ps) { + bool wm_was_consistent = wm_is_consistent(ps->wm); + if (ps->vblank_scheduler) { vblank_handle_x_events(ps->vblank_scheduler); } @@ -1483,6 +1485,12 @@ static void handle_x_events(struct session *ps) { log_fatal("X11 server connection broke (error %d)", err); exit(1); } + + if (wm_is_consistent(ps->wm) != wm_was_consistent && !wm_was_consistent) { + log_debug("Window tree has just become consistent, queueing redraw."); + ps->pending_updates = true; + queue_redraw(ps); + } } static void handle_x_events_ev(EV_P attr_unused, ev_prepare *w, int revents attr_unused) { diff --git a/src/wm/wm.c b/src/wm/wm.c index 29b66a994e..f0b3536044 100644 --- a/src/wm/wm.c +++ b/src/wm/wm.c @@ -225,6 +225,13 @@ static struct wm_tree_node *wm_find_leader(struct wm *wm, struct wm_tree_node *n return node->leader_final; } leader_node = wm_tree_find_toplevel_for(&wm->tree, leader_node); + if (leader_node == NULL) { + log_debug("Cannot find toplevel for leader %#010x of window " + "%#010x. tree consistency: %d", + node->leader, node->id.x, wm_is_consistent(wm)); + wm->needs_leader_refresh = true; + return node->leader_final; + } node->visited = true; node->leader_final = wm_find_leader(wm, leader_node); node->visited = false; @@ -236,6 +243,7 @@ void wm_refresh_leaders(struct wm *wm) { if (!wm->needs_leader_refresh) { return; } + log_debug("Refreshing window leaders, tree consistency: %d", wm_is_consistent(wm)); wm->needs_leader_refresh = false; list_foreach(struct wm_tree_node, i, &wm->tree.root->children, siblings) { if (i->is_zombie) { @@ -249,6 +257,12 @@ void wm_refresh_leaders(struct wm *wm) { continue; } wm_find_leader(wm, i); + BUG_ON_NULL(i->leader_final); + log_verbose("Window %#010x has leader %#010x", i->id.x, + i->leader_final->id.x); + } + if (wm->needs_leader_refresh) { + log_debug("Leaders not fully resolved, will try again later."); } }