From 01f9f24b9bbfceafdaae7534c4ef058f9099c284 Mon Sep 17 00:00:00 2001 From: Oskari Alaranta Date: Mon, 9 Feb 2026 03:45:33 +0200 Subject: [PATCH] Add more mapping opcodes --- xbanan/main.cpp | 55 ++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 52 insertions(+), 3 deletions(-) diff --git a/xbanan/main.cpp b/xbanan/main.cpp index 265aad8..6f2b5da 100644 --- a/xbanan/main.cpp +++ b/xbanan/main.cpp @@ -2904,18 +2904,67 @@ BAN::ErrorOr handle_packet(Client& client_info, BAN::ConstByteSpan packet) break; } + case X_GetKeyboardControl: + { + dprintln("GetKeyboardControl"); + + // FIXME: + xGetKeyboardControlReply reply { + .type = X_Reply, + .sequenceNumber = client_info.sequence, + .length = 5, + }; + TRY(encode(client_info.output_buffer, reply)); + + break; + } + case X_GetPointerMapping: + { + dprintln("GetPointerMapping"); + + // FIXME: + xGetPointerMappingReply reply { + .type = X_Reply, + .sequenceNumber = client_info.sequence, + .length = 2, + }; + TRY(encode(client_info.output_buffer, reply)); + + for (size_t i = 0; i < 8; i++) + TRY(encode(client_info.output_buffer, i)); + + break; + } case X_GetModifierMapping: { dprintln("GetModifierMapping"); xGetModifierMappingReply reply { .type = X_Reply, - .numKeyPerModifier = 1, + .numKeyPerModifier = 2, .sequenceNumber = client_info.sequence, - .length = 2, + .length = 4, }; TRY(encode(client_info.output_buffer, reply)); - TRY(encode(client_info.output_buffer, 0)); + + // shift + TRY(encode(client_info.output_buffer, static_cast(LibInput::Key::LeftShift))); + TRY(encode(client_info.output_buffer, static_cast(LibInput::Key::RightShift))); + + // lock + TRY(encode(client_info.output_buffer, static_cast(LibInput::Key::CapsLock))); + TRY(encode(client_info.output_buffer, static_cast(0))); + + // control + TRY(encode(client_info.output_buffer, static_cast(LibInput::Key::LeftCtrl))); + TRY(encode(client_info.output_buffer, static_cast(LibInput::Key::RightCtrl))); + + // Mod1 -> Mod5 + for (size_t i = 1; i <= 5; i++) + { + TRY(encode(client_info.output_buffer, static_cast(0))); + TRY(encode(client_info.output_buffer, static_cast(0))); + } break; }