From 92e02dcadf4dda55df1f853f6d766ca3419abd9f Mon Sep 17 00:00:00 2001 From: Oskari Alaranta Date: Sat, 30 May 2026 19:11:49 +0300 Subject: [PATCH] Don't create platform window for small windows These are usually internal event windows which should not be visible. I'm not sure what the correct check for this would be... gtk and other toolkits create a lot of dummy windows that should not be visible. --- xbanan/Base.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/xbanan/Base.cpp b/xbanan/Base.cpp index fbd19d0..adfadbb 100644 --- a/xbanan/Base.cpp +++ b/xbanan/Base.cpp @@ -374,6 +374,9 @@ void invalidate_window(WINDOW wid, int32_t x, int32_t y, int32_t w, int32_t h) for (;;) { + if (wid == g_root.windowId) + return; + auto& object = *g_objects[wid]; ASSERT(object.type == Object::Type::Window); @@ -512,11 +515,18 @@ static BAN::ErrorOr map_window(Client& client_info, WINDOW wid) auto& window = object.object.get(); if (window.mapped) return {}; + window.mapped = true; if (window.parent == g_root.windowId) { ASSERT(!window.platform_window); + // NOTE: This is not perfect but seems to work. + // This is used to not display "dummy" event windows + // that should not be visible. + if (window.width <= 10 || window.height <= 10) + return {}; + auto info = get_plaform_window_info(window); window.platform_window = TRY(g_platform_ops.create_window( info.transient_for, @@ -529,8 +539,6 @@ static BAN::ErrorOr map_window(Client& client_info, WINDOW wid) )); } - window.mapped = true; - for (auto& pixel : window.pixels) pixel = window.background; invalidate_window(wid, 0, 0, window.width, window.height);