Support Pixmaps with GetGeometry

This commit is contained in:
Oskari Alaranta 2026-02-09 03:44:45 +02:00
parent 16d5871775
commit 09e442ff43
1 changed files with 28 additions and 8 deletions

View File

@ -1807,31 +1807,51 @@ BAN::ErrorOr<void> handle_packet(Client& client_info, BAN::ConstByteSpan packet)
dprintln("GetGeometry"); dprintln("GetGeometry");
dprintln(" drawable: {}", drawable); dprintln(" drawable: {}", drawable);
const auto& object = *client_info.objects[drawable]; auto& object = *client_info.objects[drawable];
ASSERT(object.type == Object::Type::Window);
INT16 x, y;
CARD16 width, height; CARD16 width, height;
CARD8 depth;
if (drawable == root.windowId) if (drawable == root.windowId)
{ {
width = root.pixWidth; width = root.pixWidth;
height = root.pixHeight; height = root.pixHeight;
depth = root.rootDepth;
x = 0;
y = 0;
}
else if (object.type == Object::Type::Window)
{
const auto& window = object.object.get<Object::Window>();
width = window.texture().width();
height = window.texture().height();
depth = 32;
x = window.x;
y = window.y;
}
else if (object.type == Object::Type::Pixmap)
{
const auto& pixmap = object.object.get<Object::Pixmap>();
width = pixmap.width;
height = pixmap.height;
depth = pixmap.depth;
x = 0;
y = 0;
} }
else else
{ {
const auto& texture = object.object.get<Object::Window>().texture(); ASSERT_NOT_REACHED();
width = texture.width();
height = texture.height();
} }
xGetGeometryReply reply { xGetGeometryReply reply {
.type = X_Reply, .type = X_Reply,
.depth = 32, .depth = depth,
.sequenceNumber = client_info.sequence, .sequenceNumber = client_info.sequence,
.length = 0, .length = 0,
.root = root.windowId, .root = root.windowId,
.x = 0, .x = x,
.y = 0, .y = y,
.width = width, .width = width,
.height = height, .height = height,
.borderWidth = 0, .borderWidth = 0,