From 88480bdc8fba9c2322e3af4aab45241ea161f89d Mon Sep 17 00:00:00 2001 From: Yuxuan Shui Date: Thu, 17 Oct 2024 18:50:54 +0100 Subject: [PATCH] wm/win: fix window pixmap stale check It was accidentally removed in 8065c1fabed26c3ef1783d4beda75912a605909c, causing window pixmaps to be rebound every render, slowing things down. Fixes: #1368 Signed-off-by: Yuxuan Shui --- src/wm/win.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/wm/win.c b/src/wm/win.c index 8cd825a631..180512032f 100644 --- a/src/wm/win.c +++ b/src/wm/win.c @@ -472,8 +472,15 @@ void win_process_image_flags(session_t *ps, struct win *w) { // Assert that the MAPPED flag is already handled. assert(!win_check_flags_all(w, WIN_FLAGS_MAPPED)); - if (w->state != WSTATE_MAPPED) { - // Flags of invisible windows are processed when they are mapped + if (w->state != WSTATE_MAPPED || !win_check_flags_any(w, WIN_FLAGS_PIXMAP_STALE)) { + // 1. Flags of invisible windows are processed when they are mapped + // 2. We don't need to update window image if pixmap is not stale + return; + } + + if (win_check_flags_all(w, WIN_FLAGS_PIXMAP_ERROR)) { + // We have previously failed to bind the pixmap, don't try again. + win_clear_flags(w, WIN_FLAGS_PIXMAP_STALE); return; }