From 12f29203d38d133723dc3132df2ef86ed4fa3323 Mon Sep 17 00:00:00 2001 From: AliceJump <149395013+AliceJump@users.noreply.github.com> Date: Fri, 11 Sep 2026 22:25:18 +0800 Subject: [PATCH] fix(input): add missing default value for key_rightalt_to_key_win The input_t aggregate initializer in config.cpp omits the key_rightalt_to_key_win member, so every subsequent field is shifted and native_pen_touch (the final member) is value-initialized to false instead of its intended default of true. As a result, when native_pen_touch is absent from the config file, pen/touch input is disabled even though the surrounding comment suggests it defaults to enabled. Add the missing initializer (key_rightalt_to_key_win defaults to false, matching its configured default) and extend the unit tests to cover both defaults. --- src/config.cpp | 1 + tests/unit/test_config.cpp | 23 +++++++++++++++++++++++ 2 files changed, 24 insertions(+) diff --git a/src/config.cpp b/src/config.cpp index 2911deae016..02b79eb005c 100644 --- a/src/config.cpp +++ b/src/config.cpp @@ -861,6 +861,7 @@ namespace config { true, // virtualhid_randomize_mac true, // keyboard enabled + false, // key_rightalt_to_key_win true, // mouse enabled true, // controller enabled true, // always send scancodes diff --git a/tests/unit/test_config.cpp b/tests/unit/test_config.cpp index a608aefd367..459e45aed0c 100644 --- a/tests/unit/test_config.cpp +++ b/tests/unit/test_config.cpp @@ -124,3 +124,26 @@ TEST_F(ConfigPersistenceTest, SelectsAllDriversOnlyForLicensedUsersWithoutAPrefe EXPECT_FALSE(config::select_all_gamepad_drivers_if_licensed(true)); EXPECT_EQ(file_handler::read_file(config_file().string().c_str()), "gamepad_driver = all\n"); } + +/** + * @brief Verify that native_pen_touch defaults to enabled. + * + * The input_t aggregate initializer previously omitted the key_rightalt_to_key_win + * member, which shifted every subsequent field and left native_pen_touch (the + * final member) value-initialized to false despite the surrounding comment + * suggesting true. This test guards the corrected default. + */ +TEST(ConfigInputTest, NativePenTouchDefaultsToEnabled) { + EXPECT_TRUE(config::input.native_pen_touch); +} + +/** + * @brief Verify that key_rightalt_to_key_win defaults to disabled. + * + * This member is documented and configured as disabled by default; the + * aggregate initializer now explicitly sets it to false. It was previously + * omitted, causing the field to shift and native_pen_touch to default to false. + */ +TEST(ConfigInputTest, KeyRightAltToKeyWinDefaultsToDisabled) { + EXPECT_FALSE(config::input.key_rightalt_to_key_win); +}