Add proper support for ListExtensions
This commit is contained in:
parent
09e442ff43
commit
7376cd17ac
|
|
@ -2850,14 +2850,35 @@ BAN::ErrorOr<void> handle_packet(Client& client_info, BAN::ConstByteSpan packet)
|
||||||
{
|
{
|
||||||
dprintln("ListExtensions");
|
dprintln("ListExtensions");
|
||||||
|
|
||||||
|
CARD8 extension_count = 0;
|
||||||
|
CARD32 extension_length = 0;
|
||||||
|
for (const auto& extension : g_extensions)
|
||||||
|
{
|
||||||
|
if (extension.handler == nullptr)
|
||||||
|
continue;
|
||||||
|
extension_count++;
|
||||||
|
extension_length += extension.name.size() + 1;
|
||||||
|
}
|
||||||
|
|
||||||
xListExtensionsReply reply {
|
xListExtensionsReply reply {
|
||||||
.type = X_Reply,
|
.type = X_Reply,
|
||||||
.nExtensions = 0,
|
.nExtensions = extension_count,
|
||||||
.sequenceNumber = client_info.sequence,
|
.sequenceNumber = client_info.sequence,
|
||||||
.length = 0,
|
.length = (extension_length + 3) / 4,
|
||||||
};
|
};
|
||||||
TRY(encode(client_info.output_buffer, reply));
|
TRY(encode(client_info.output_buffer, reply));
|
||||||
|
|
||||||
|
for (const auto& extension : g_extensions)
|
||||||
|
{
|
||||||
|
if (extension.handler == nullptr)
|
||||||
|
continue;
|
||||||
|
TRY(encode(client_info.output_buffer, extension.name));
|
||||||
|
TRY(encode(client_info.output_buffer, '\0'));
|
||||||
|
}
|
||||||
|
|
||||||
|
for (size_t i = 0; (extension_length + i) % 4; i++)
|
||||||
|
TRY(encode(client_info.output_buffer, '\0'));
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case X_GetKeyboardMapping:
|
case X_GetKeyboardMapping:
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue