Store per window depths

This commit is contained in:
Oskari Alaranta 2026-02-12 02:37:12 +02:00
parent b9c69d8456
commit 6124525439
2 changed files with 5 additions and 2 deletions

View File

@ -1193,12 +1193,13 @@ BAN::ErrorOr<void> handle_packet(Client& client_info, BAN::ConstByteSpan packet)
{ {
case Object::Type::Window: case Object::Type::Window:
{ {
auto& texture = object.object.get<Object::Window>().texture(); auto& window = object.object.get<Object::Window>();
auto& texture = window.texture();
info.data = { reinterpret_cast<uint8_t*>(texture.pixels().data()), texture.pixels().size() * 4 }; info.data = { reinterpret_cast<uint8_t*>(texture.pixels().data()), texture.pixels().size() * 4 };
info.w = texture.width(); info.w = texture.width();
info.h = texture.height(); info.h = texture.height();
info.depth = 32; info.depth = window.depth;
break; break;
} }
@ -1329,6 +1330,7 @@ BAN::ErrorOr<void> handle_packet(Client& client_info, BAN::ConstByteSpan packet)
TRY(BAN::UniqPtr<Object>::create(Object { TRY(BAN::UniqPtr<Object>::create(Object {
.type = Object::Type::Window, .type = Object::Type::Window,
.object = Object::Window { .object = Object::Window {
.depth = request.depth,
.x = request.x, .x = request.x,
.y = request.y, .y = request.y,
.event_mask = event_mask, .event_mask = event_mask,

View File

@ -58,6 +58,7 @@ struct Object
{ {
bool mapped { false }; bool mapped { false };
bool focused { false }; bool focused { false };
uint8_t depth { 0 };
int32_t x { 0 }; int32_t x { 0 };
int32_t y { 0 }; int32_t y { 0 };
int32_t cursor_x { -1 }; int32_t cursor_x { -1 };