Skip to content

Commit afb3d14

Browse files
GrzegorzKozubclaude
andcommitted
fix: prevent Chromium corner glitch on restore after app-initiated minimize
Chromium-based browsers use xdg_toplevel.set_minimized for their own title bar minimize, which causes Wayland surface staleness. On restore, the stale surface makes the GLSL rounded corner shader render with wrong bounds, producing a visible glitch until focus fires and self-corrects. Fix by scheduling a refreshRoundedCorners call 250ms after unminimize for Chromium windows, giving the Wayland surface time to deliver a fresh frame before the shader bounds are recomputed. Compositor-initiated minimizes (Super+H/D) do not cause surface staleness and are unaffected. The overview thumbnail continues to show the stale Chromium surface while minimized — this is a known Chromium/Wayland limitation outside the extension's control. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 5a9563d commit afb3d14

1 file changed

Lines changed: 18 additions & 0 deletions

File tree

src/manager/event_handlers.ts

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ import {
2424
computeWindowContentsOffset,
2525
getRoundedCornersCfg,
2626
getRoundedCornersEffect,
27+
isChromiumWindow,
2728
shouldEnableEffect,
2829
unwrapActor,
2930
updateShadowActorStyle,
@@ -171,6 +172,23 @@ export function onUnminimize(actor: RoundedWindowActor) {
171172
source.disconnect(id);
172173
}
173174
});
175+
} else if (roundedCornersEffect) {
176+
const win = actor.metaWindow;
177+
if (win && isChromiumWindow(win)) {
178+
// Chromium's Wayland surface takes ~250ms to deliver a fresh frame
179+
// after restore. Refreshing immediately uses a stale surface and
180+
// produces glitched corners; the delayed call picks up the settled
181+
// surface without blocking any intermediate refreshes.
182+
const id = GLib.timeout_add(GLib.PRIORITY_DEFAULT, 250, () => {
183+
if (actor.rwcCustomData)
184+
actor.rwcCustomData.unminimizedTimeoutId = 0;
185+
if (actor.metaWindow && getRoundedCornersEffect(actor))
186+
void refreshRoundedCorners(actor);
187+
return GLib.SOURCE_REMOVE;
188+
});
189+
if (actor.rwcCustomData)
190+
actor.rwcCustomData.unminimizedTimeoutId = id;
191+
}
174192
}
175193
}
176194

0 commit comments

Comments
 (0)