Don't create platform window for windows without WM_CLASS
gtk and other toolkits create a lot of dummy windows that should not be visible.
This commit is contained in:
@@ -374,6 +374,9 @@ void invalidate_window(WINDOW wid, int32_t x, int32_t y, int32_t w, int32_t h)
|
|||||||
|
|
||||||
for (;;)
|
for (;;)
|
||||||
{
|
{
|
||||||
|
if (wid == g_root.windowId)
|
||||||
|
return;
|
||||||
|
|
||||||
auto& object = *g_objects[wid];
|
auto& object = *g_objects[wid];
|
||||||
ASSERT(object.type == Object::Type::Window);
|
ASSERT(object.type == Object::Type::Window);
|
||||||
|
|
||||||
@@ -506,17 +509,26 @@ transitient_for_done:
|
|||||||
|
|
||||||
static BAN::ErrorOr<void> map_window(Client& client_info, WINDOW wid)
|
static BAN::ErrorOr<void> map_window(Client& client_info, WINDOW wid)
|
||||||
{
|
{
|
||||||
|
static const CARD32 WM_CLASS = g_atoms_name_to_id["WM_CLASS"_sv];
|
||||||
|
|
||||||
auto& object = *g_objects[wid];
|
auto& object = *g_objects[wid];
|
||||||
ASSERT(object.type == Object::Type::Window);
|
ASSERT(object.type == Object::Type::Window);
|
||||||
|
|
||||||
auto& window = object.object.get<Object::Window>();
|
auto& window = object.object.get<Object::Window>();
|
||||||
if (window.mapped)
|
if (window.mapped)
|
||||||
return {};
|
return {};
|
||||||
|
window.mapped = true;
|
||||||
|
|
||||||
if (window.parent == g_root.windowId)
|
if (window.parent == g_root.windowId)
|
||||||
{
|
{
|
||||||
ASSERT(!window.platform_window);
|
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.properties.contains(WM_CLASS))
|
||||||
|
return {};
|
||||||
|
|
||||||
auto info = get_plaform_window_info(window);
|
auto info = get_plaform_window_info(window);
|
||||||
window.platform_window = TRY(g_platform_ops.create_window(
|
window.platform_window = TRY(g_platform_ops.create_window(
|
||||||
info.transient_for,
|
info.transient_for,
|
||||||
@@ -529,8 +541,6 @@ static BAN::ErrorOr<void> map_window(Client& client_info, WINDOW wid)
|
|||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
window.mapped = true;
|
|
||||||
|
|
||||||
for (auto& pixel : window.pixels)
|
for (auto& pixel : window.pixels)
|
||||||
pixel = window.background;
|
pixel = window.background;
|
||||||
invalidate_window(wid, 0, 0, window.width, window.height);
|
invalidate_window(wid, 0, 0, window.width, window.height);
|
||||||
|
|||||||
Reference in New Issue
Block a user