From: <sv...@op...> - 2025-01-09 20:12:21
|
Author: sagamusix Date: Thu Jan 9 21:12:05 2025 New Revision: 22854 URL: https://source.openmpt.org/browse/openmpt/?op=revision&rev=22854 Log: Merged revision(s) 22852-22853 from trunk/OpenMPT: [Doc] Update HTMLHelp path documentation. ........ [Fix] If multiple keyboard layouts were installed, scancode conversion could be based on the wrong layout, causing e.g. B-4 and Note-Off keys to be swapped on a setup with active US keyboard layout but also a German layout being present. ........ Modified: branches/OpenMPT-1.31/ (props changed) branches/OpenMPT-1.31/mptrack/CommandSet.cpp branches/OpenMPT-1.31/mptrack/manual_generator/readme.txt Modified: branches/OpenMPT-1.31/mptrack/CommandSet.cpp ============================================================================== --- branches/OpenMPT-1.31/mptrack/CommandSet.cpp Thu Jan 9 21:11:38 2025 (r22853) +++ branches/OpenMPT-1.31/mptrack/CommandSet.cpp Thu Jan 9 21:12:05 2025 (r22854) @@ -511,6 +511,15 @@ }; // clang-format on +std::vector<HKL> GetKeyboardLayouts() +{ + std::vector<HKL> layouts(GetKeyboardLayoutList(0, nullptr)); + GetKeyboardLayoutList(static_cast<int>(layouts.size()), layouts.data()); + // GetKeyboardLayoutList appears to return the layouts in no particular order. Always force the active layout to be evaluated first. + layouts.insert(layouts.begin(), GetKeyboardLayout(0)); + return layouts; +} + }; // namespace #ifdef MPT_ALL_LOGGING @@ -2127,8 +2136,7 @@ "//----------------------------------------------------------------------\n" "version:" << mpt::ToCharset(mpt::Charset::ASCII, Version::Current().ToUString()) << "\n"; - std::vector<HKL> layouts(GetKeyboardLayoutList(0, nullptr)); - GetKeyboardLayoutList(static_cast<int>(layouts.size()), layouts.data()); + const std::vector<HKL> layouts = GetKeyboardLayouts(); for(int ctx = 0; ctx < kCtxMaxInputContexts; ctx++) { @@ -2185,8 +2193,7 @@ CString errText; int errorCount = 0; - std::vector<HKL> layouts(GetKeyboardLayoutList(0, nullptr)); - GetKeyboardLayoutList(static_cast<int>(layouts.size()), layouts.data()); + const std::vector<HKL> layouts = GetKeyboardLayouts(); const std::string whitespace(" \n\r\t"); while(iStrm.getline(s, std::size(s))) @@ -2330,8 +2337,7 @@ QuickChange_SetEffects(*specs); } - std::vector<HKL> layouts(GetKeyboardLayoutList(0, nullptr)); - GetKeyboardLayoutList(static_cast<int>(layouts.size()), layouts.data()); + const std::vector<HKL> layouts = GetKeyboardLayouts(); const auto previousVersion = TrackerSettings::Instance().PreviousSettingsVersion; @@ -2558,8 +2564,7 @@ { // Hack for situations where a non-latin keyboard layout without A...Z key code mapping may the current layout (e.g. Russian), // but a latin layout (e.g. EN-US) is installed as well. - std::vector<HKL> layouts(GetKeyboardLayoutList(0, nullptr)); - GetKeyboardLayoutList(static_cast<int>(layouts.size()), layouts.data()); + const std::vector<HKL> layouts = GetKeyboardLayouts(); SHORT codeNmod = -1; for(auto i = layouts.begin(); i != layouts.end() && codeNmod == -1; i++) { Modified: branches/OpenMPT-1.31/mptrack/manual_generator/readme.txt ============================================================================== --- branches/OpenMPT-1.31/mptrack/manual_generator/readme.txt Thu Jan 9 21:11:38 2025 (r22853) +++ branches/OpenMPT-1.31/mptrack/manual_generator/readme.txt Thu Jan 9 21:12:05 2025 (r22854) @@ -1,5 +1,5 @@ Prerequisites: -- HTML Help Workshop must be placed in the directory "include\htmlhelp" +- HTML Help Workshop must be placed in the directory "..\..\build\tools\htmlhelp" (build\download_externals.cmd will take care of that) - Python 3 |