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.
This commit is contained in:
2026-05-30 19:11:49 +03:00
parent 97e82afd4d
commit 92e02dcadf

View File

@@ -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<void> map_window(Client& client_info, WINDOW wid)
auto& window = object.object.get<Object::Window>();
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<void> 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);