LibInput: Add support for right super and application keys

This commit is contained in:
2026-07-04 19:11:30 +03:00
parent 652e170da9
commit 5256fd2e0a
8 changed files with 66 additions and 46 deletions

View File

@@ -18,7 +18,7 @@ namespace LibInput
"!", "\"", "#", "¤", "%", "&", "/", "§", "½",
"(", ")", "[", "]", "{", "}",
"=", "?", "+", "\\", "´", "`", "¨", "¸", nullptr, "@", "£", "$", "",
nullptr, "\t", nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr,
nullptr, "\t", nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr,
"'", "*", "^", "~", nullptr, nullptr, nullptr, nullptr,
",", ";", ".", ":", "-", "_", nullptr, nullptr, "<", ">", "|", "¬", "¦",
"0", "1", "2", "3", "4", "5", "6", "7", "8", "9",
@@ -37,7 +37,7 @@ namespace LibInput
"!", "\"", "#", "¤", "%", "&", "/", "§", "½",
"(", ")", "[", "]", "{", "}",
"=", "?", "+", "\\", "´", "`", "¨", "¸", nullptr, "@", "£", "$", "",
nullptr, "\t", nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr,
nullptr, "\t", nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr,
"'", "*", "^", "~", nullptr, nullptr, nullptr, nullptr,
",", ";", ".", ":", "-", "_", nullptr, nullptr, "<", ">", "|", "¬", "¦",
"0", "1", "2", "3", "4", "5", "6", "7", "8", "9",
@@ -62,7 +62,7 @@ namespace LibInput
"!", "\"", "#", "¤", "%", "&", "/", "§", "½",
"(", ")", "[", "]", "{", "}",
"=", "?", "+", "\\", "´", "`", "¨", "¸", "\b", "@", "£", "$", "",
"\e", "\t", nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr,
"\e", "\t", nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr,
"'", "*", "^", "~", "\e[A", "\e[B", "\e[D", "\e[C",
",", ";", ".", ":", "-", "_", nullptr, nullptr, "<", ">", "|", "¬", "¦",
"0", "1", "2", "3", "4", "5", "6", "7", "8", "9",
@@ -81,7 +81,7 @@ namespace LibInput
"!", "\"", "#", "¤", "%", "&", "/", "§", "½",
"(", ")", "[", "]", "{", "}",
"=", "?", "+", "\\", "´", "`", "¨", "¸", "\b", "@", "£", "$", "",
"\e", "\t", nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr,
"\e", "\t", nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr,
"'", "*", "^", "~", "\e[A", "\e[B", "\e[D", "\e[C",
",", ";", ".", ":", "-", "_", nullptr, nullptr, "<", ">", "|", "¬", "¦",
"0", "1", "2", "3", "4", "5", "6", "7", "8", "9",
@@ -100,7 +100,7 @@ namespace LibInput
"!", "\"", "#", "¤", "%", "&", "/", "§", "½",
"(", ")", "[", "]", "{", "}",
"=", "?", "+", "\\", "´", "`", "¨", "¸", "\b", "@", "£", "$", "",
"\e", "\t", nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr,
"\e", "\t", nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr,
"'", "*", "^", "~", "\e[A", "\e[B", "\e[D", "\e[C",
",", ";", ".", ":", "-", "_", nullptr, nullptr, "<", ">", "|", "¬", "¦",
"0", "1", "2", "3", "4", "5", "6", "7", "8", "9",

View File

@@ -394,11 +394,13 @@ namespace LibInput
TRY(s_name_to_key.insert("LeftShift"_sv, Key::LeftShift));
TRY(s_name_to_key.insert("LessThan"_sv, Key::LessThan));
TRY(s_name_to_key.insert("LShift"_sv, Key::LeftShift));
TRY(s_name_to_key.insert("LSuper"_sv, Key::LeftSuper));
TRY(s_name_to_key.insert("M"_sv, Key::M));
TRY(s_name_to_key.insert("MediaNext"_sv, Key::MediaNext));
TRY(s_name_to_key.insert("MediaPlayPause"_sv, Key::MediaPlayPause));
TRY(s_name_to_key.insert("MediaPrevious"_sv, Key::MediaPrevious));
TRY(s_name_to_key.insert("MediaStop"_sv, Key::MediaStop));
TRY(s_name_to_key.insert("Application"_sv, Key::Application));
TRY(s_name_to_key.insert("N"_sv, Key::N));
TRY(s_name_to_key.insert("Negation"_sv, Key::Negation));
TRY(s_name_to_key.insert("None"_sv, Key::None));
@@ -443,6 +445,7 @@ namespace LibInput
TRY(s_name_to_key.insert("RightControl"_sv, Key::RightCtrl));
TRY(s_name_to_key.insert("RightShift"_sv, Key::RightShift));
TRY(s_name_to_key.insert("RShift"_sv, Key::RightShift));
TRY(s_name_to_key.insert("RSuper"_sv, Key::RightSuper));
TRY(s_name_to_key.insert("S"_sv, Key::S));
TRY(s_name_to_key.insert("ScrollLock"_sv, Key::ScrollLock));
TRY(s_name_to_key.insert("Section"_sv, Key::Section));
@@ -450,7 +453,6 @@ namespace LibInput
TRY(s_name_to_key.insert("SingleQuote"_sv, Key::SingleQuote));
TRY(s_name_to_key.insert("Slash"_sv, Key::Slash));
TRY(s_name_to_key.insert("Space"_sv, Key::Space));
TRY(s_name_to_key.insert("Super"_sv, Key::Super));
TRY(s_name_to_key.insert("T"_sv, Key::T));
TRY(s_name_to_key.insert("Tab"_sv, Key::Tab));
TRY(s_name_to_key.insert("Tilde"_sv, Key::Tilde));

View File

@@ -44,7 +44,7 @@ namespace LibInput
ExclamationMark, DoubleQuote, Hashtag, Currency, Percent, Ampersand, Slash, Section, Half,
OpenParenthesis, CloseParenthesis, OpenSquareBracket, CloseSquareBracket, OpenCurlyBracket, CloseCurlyBracket,
Equals, QuestionMark, Plus, BackSlash, Acute, BackTick, TwoDots, Cedilla, Backspace, AtSign, Pound, Dollar, Euro,
Escape, Tab, CapsLock, LeftShift, LeftCtrl, Super, LeftAlt, RightAlt, AltGr = RightAlt, RightCtrl, RightShift,
Escape, Tab, CapsLock, LeftShift, LeftCtrl, LeftSuper, LeftAlt, RightAlt, AltGr = RightAlt, RightSuper, Application, RightCtrl, RightShift,
SingleQuote, Asterix, Caret, Tilde, ArrowUp, ArrowDown, ArrowLeft, ArrowRight,
Comma, Semicolon, Period, Colon, Hyphen, Underscore, NumLock, ScrollLock, LessThan, GreaterThan, Pipe, Negation, BrokenBar,
Numpad0, Numpad1, Numpad2, Numpad3, Numpad4, Numpad5, Numpad6, Numpad7, Numpad8, Numpad9,
@@ -65,36 +65,42 @@ namespace LibInput
{
enum Modifier : uint16_t
{
LShift = (1 << 0),
RShift = (1 << 1),
LCtrl = (1 << 2),
RCtrl = (1 << 3),
LAlt = (1 << 4),
RAlt = (1 << 5),
CapsLock = (1 << 6),
NumLock = (1 << 7),
ScrollLock = (1 << 8),
Pressed = (1 << 9),
LShift = (1 << 0),
RShift = (1 << 1),
LCtrl = (1 << 2),
RCtrl = (1 << 3),
LAlt = (1 << 4),
RAlt = (1 << 5),
LSuper = (1 << 6),
RSuper = (1 << 7),
CapsLock = (1 << 8),
NumLock = (1 << 9),
ScrollLock = (1 << 10),
Pressed = (1 << 11),
};
bool lshift() const { return modifier & Modifier::LShift; }
bool rshift() const { return modifier & Modifier::RShift; }
bool shift() const { return lshift() || rshift(); }
bool lshift() const { return modifier & Modifier::LShift; }
bool rshift() const { return modifier & Modifier::RShift; }
bool shift() const { return lshift() || rshift(); }
bool lctrl() const { return modifier & Modifier::LCtrl; }
bool rctrl() const { return modifier & Modifier::RCtrl; }
bool ctrl() const { return lctrl() || rctrl(); }
bool lctrl() const { return modifier & Modifier::LCtrl; }
bool rctrl() const { return modifier & Modifier::RCtrl; }
bool ctrl() const { return lctrl() || rctrl(); }
bool lalt() const { return modifier & Modifier::LAlt; }
bool ralt() const { return modifier & Modifier::RAlt; }
bool alt() const { return lalt() || ralt(); }
bool lalt() const { return modifier & Modifier::LAlt; }
bool ralt() const { return modifier & Modifier::RAlt; }
bool alt() const { return lalt() || ralt(); }
bool caps_lock() const { return modifier & Modifier::CapsLock; }
bool num_lock() const { return modifier & Modifier::NumLock; }
bool scroll_lock() const { return modifier & Modifier::ScrollLock; }
bool lsuper() const { return modifier & Modifier::LSuper; }
bool rsuper() const { return modifier & Modifier::RSuper; }
bool super() const { return lsuper() || rsuper(); }
bool pressed() const { return modifier & Modifier::Pressed; }
bool released() const { return !pressed(); }
bool caps_lock() const { return modifier & Modifier::CapsLock; }
bool num_lock() const { return modifier & Modifier::NumLock; }
bool scroll_lock() const { return modifier & Modifier::ScrollLock; }
bool pressed() const { return modifier & Modifier::Pressed; }
bool released() const { return !pressed(); }
uint16_t modifier;
uint8_t scancode;

View File

@@ -481,7 +481,7 @@ static void update_volume(const char* new_volume)
void WindowServer::on_key_event(LibInput::KeyEvent event)
{
if (event.key == LibInput::Key::Super)
if (event.key == LibInput::Key::LeftSuper)
m_is_mod_key_held = event.pressed();
if (event.pressed() && event.key == LibInput::Key::VolumeDown)