mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-05 02:36:19 +02:00
[Analyzers][CPP]Changes to fix warning 26493 on src/modules/ (H to K) (#23484)
* Changes to fix warning 26493 on src/modules/ starting with letter H to Letter K * change from PR comments
This commit is contained in:
@@ -29,9 +29,9 @@ namespace BufferValidationHelpers
|
||||
if (selectedKeyCode != -1)
|
||||
{
|
||||
// Check if the value being set is the same as the other column
|
||||
if (remapBuffer[rowIndex].first[std::abs(int(colIndex) - 1)].index() == 0)
|
||||
if (remapBuffer[rowIndex].first[std::abs(colIndex - 1)].index() == 0)
|
||||
{
|
||||
DWORD otherColumnKeyCode = std::get<DWORD>(remapBuffer[rowIndex].first[std::abs(int(colIndex) - 1)]);
|
||||
DWORD otherColumnKeyCode = std::get<DWORD>(remapBuffer[rowIndex].first[std::abs(colIndex - 1)]);
|
||||
if (otherColumnKeyCode == selectedKeyCode || IsKeyRemappingToItsCombinedKey(selectedKeyCode, otherColumnKeyCode))
|
||||
{
|
||||
errorType = ShortcutErrorType::MapToSameKey;
|
||||
@@ -189,7 +189,7 @@ namespace BufferValidationHelpers
|
||||
// If the user tries to set an action key check if all drop down menus after this are empty if it is not the first key.
|
||||
// If it is a hybrid control, this can be done even on the first key
|
||||
bool isClear = true;
|
||||
for (int i = dropDownIndex + 1; i < (int)dropDownCount; i++)
|
||||
for (int i = dropDownIndex + 1; i < static_cast<int>(dropDownCount); i++)
|
||||
{
|
||||
if (selectedCodes[i] != -1)
|
||||
{
|
||||
@@ -244,9 +244,9 @@ namespace BufferValidationHelpers
|
||||
if (tempShortcut.index() == 1)
|
||||
{
|
||||
// If shortcut to shortcut
|
||||
if (remapBuffer[rowIndex].first[std::abs(int(colIndex) - 1)].index() == 1)
|
||||
if (remapBuffer[rowIndex].first[std::abs(colIndex - 1)].index() == 1)
|
||||
{
|
||||
auto& shortcut = std::get<Shortcut>(remapBuffer[rowIndex].first[std::abs(int(colIndex) - 1)]);
|
||||
auto& shortcut = std::get<Shortcut>(remapBuffer[rowIndex].first[std::abs(colIndex - 1)]);
|
||||
if (shortcut == std::get<Shortcut>(tempShortcut) && EditorHelpers::IsValidShortcut(shortcut) && EditorHelpers::IsValidShortcut(std::get<Shortcut>(tempShortcut)))
|
||||
{
|
||||
errorType = ShortcutErrorType::MapToSameShortcut;
|
||||
@@ -258,9 +258,9 @@ namespace BufferValidationHelpers
|
||||
else
|
||||
{
|
||||
// If key to key
|
||||
if (remapBuffer[rowIndex].first[std::abs(int(colIndex) - 1)].index() == 0)
|
||||
if (remapBuffer[rowIndex].first[std::abs(colIndex - 1)].index() == 0)
|
||||
{
|
||||
DWORD otherColumnKeyCode = std::get<DWORD>(remapBuffer[rowIndex].first[std::abs(int(colIndex) - 1)]);
|
||||
DWORD otherColumnKeyCode = std::get<DWORD>(remapBuffer[rowIndex].first[std::abs(colIndex - 1)]);
|
||||
DWORD shortcutKeyCode = std::get<DWORD>(tempShortcut);
|
||||
if ((otherColumnKeyCode == shortcutKeyCode || IsKeyRemappingToItsCombinedKey(otherColumnKeyCode, shortcutKeyCode)) && otherColumnKeyCode != NULL && shortcutKeyCode != NULL)
|
||||
{
|
||||
|
||||
@@ -137,14 +137,14 @@ inline void CreateEditKeyboardWindowImpl(HINSTANCE hInst, KBMEditor::KeyboardMan
|
||||
windowClass.lpfnWndProc = EditKeyboardWindowProc;
|
||||
windowClass.hInstance = hInst;
|
||||
windowClass.lpszClassName = szWindowClass;
|
||||
windowClass.hbrBackground = (HBRUSH)(COLOR_WINDOW);
|
||||
windowClass.hIcon = (HICON)LoadImageW(
|
||||
windowClass.hbrBackground = reinterpret_cast<HBRUSH>(COLOR_WINDOW);
|
||||
windowClass.hIcon = static_cast<HICON>(LoadImageW(
|
||||
windowClass.hInstance,
|
||||
MAKEINTRESOURCE(IDS_KEYBOARDMANAGER_ICON),
|
||||
IMAGE_ICON,
|
||||
48,
|
||||
48,
|
||||
LR_DEFAULTCOLOR);
|
||||
LR_DEFAULTCOLOR));
|
||||
|
||||
if (RegisterClassEx(&windowClass) == NULL)
|
||||
{
|
||||
@@ -433,7 +433,7 @@ LRESULT CALLBACK EditKeyboardWindowProc(HWND hWnd, UINT messageCode, WPARAM wPar
|
||||
// To avoid UI elements overlapping on making the window smaller enforce a minimum window size
|
||||
case WM_GETMINMAXINFO:
|
||||
{
|
||||
LPMINMAXINFO mmi = (LPMINMAXINFO)lParam;
|
||||
LPMINMAXINFO mmi = reinterpret_cast<LPMINMAXINFO>(lParam);
|
||||
float minWidth = EditorConstants::MinimumEditKeyboardWindowWidth;
|
||||
float minHeight = EditorConstants::MinimumEditKeyboardWindowHeight;
|
||||
DPIAware::Convert(MonitorFromWindow(hWnd, MONITOR_DEFAULTTONULL), minWidth, minHeight);
|
||||
|
||||
@@ -75,14 +75,14 @@ inline void CreateEditShortcutsWindowImpl(HINSTANCE hInst, KBMEditor::KeyboardMa
|
||||
windowClass.lpfnWndProc = EditShortcutsWindowProc;
|
||||
windowClass.hInstance = hInst;
|
||||
windowClass.lpszClassName = szWindowClass;
|
||||
windowClass.hbrBackground = (HBRUSH)(COLOR_WINDOW);
|
||||
windowClass.hIcon = (HICON)LoadImageW(
|
||||
windowClass.hbrBackground = reinterpret_cast<HBRUSH>(COLOR_WINDOW);
|
||||
windowClass.hIcon = static_cast<HICON>(LoadImageW(
|
||||
windowClass.hInstance,
|
||||
MAKEINTRESOURCE(IDS_KEYBOARDMANAGER_ICON),
|
||||
IMAGE_ICON,
|
||||
48,
|
||||
48,
|
||||
LR_DEFAULTCOLOR);
|
||||
LR_DEFAULTCOLOR));
|
||||
if (RegisterClassEx(&windowClass) == NULL)
|
||||
{
|
||||
MessageBox(NULL, GET_RESOURCE_STRING(IDS_REGISTERCLASSFAILED_ERRORMESSAGE).c_str(), GET_RESOURCE_STRING(IDS_REGISTERCLASSFAILED_ERRORTITLE).c_str(), NULL);
|
||||
@@ -199,7 +199,7 @@ inline void CreateEditShortcutsWindowImpl(HINSTANCE hInst, KBMEditor::KeyboardMa
|
||||
StackPanel tableHeader = StackPanel();
|
||||
tableHeader.Orientation(Orientation::Horizontal);
|
||||
tableHeader.Margin({ 10, 0, 0, 10 });
|
||||
auto originalShortcutContainer = UIHelpers::GetWrapped(originalShortcutHeader, EditorConstants::ShortcutOriginColumnWidth + (double)EditorConstants::ShortcutArrowColumnWidth);
|
||||
auto originalShortcutContainer = UIHelpers::GetWrapped(originalShortcutHeader, EditorConstants::ShortcutOriginColumnWidth + static_cast<double>(EditorConstants::ShortcutArrowColumnWidth));
|
||||
tableHeader.Children().Append(originalShortcutContainer.as<FrameworkElement>());
|
||||
auto newShortcutHeaderContainer = UIHelpers::GetWrapped(newShortcutHeader, EditorConstants::ShortcutTargetColumnWidth);
|
||||
tableHeader.Children().Append(newShortcutHeaderContainer.as<FrameworkElement>());
|
||||
@@ -386,7 +386,7 @@ LRESULT CALLBACK EditShortcutsWindowProc(HWND hWnd, UINT messageCode, WPARAM wPa
|
||||
// To avoid UI elements overlapping on making the window smaller enforce a minimum window size
|
||||
case WM_GETMINMAXINFO:
|
||||
{
|
||||
LPMINMAXINFO mmi = (LPMINMAXINFO)lParam;
|
||||
LPMINMAXINFO mmi = reinterpret_cast<LPMINMAXINFO>(lParam);
|
||||
float minWidth = EditorConstants::MinimumEditShortcutsWindowWidth;
|
||||
float minHeight = EditorConstants::MinimumEditShortcutsWindowHeight;
|
||||
DPIAware::Convert(MonitorFromWindow(hWnd, MONITOR_DEFAULTTONULL), minWidth, minHeight);
|
||||
|
||||
@@ -326,7 +326,7 @@ void KeyDropDownControl::AddDropDown(StackPanel& table, StackPanel row, Variable
|
||||
keyDropDownControlObjects[keyDropDownControlObjects.size() - 1]->SetSelectionHandler(table, row, parent, colIndex, shortcutRemapBuffer, keyDropDownControlObjects, targetApp, isHybridControl, isSingleKeyWindow);
|
||||
|
||||
// Update accessible name
|
||||
SetAccessibleNameForComboBox(keyDropDownControlObjects[keyDropDownControlObjects.size() - 1]->GetComboBox(), (int)keyDropDownControlObjects.size());
|
||||
SetAccessibleNameForComboBox(keyDropDownControlObjects[keyDropDownControlObjects.size() - 1]->GetComboBox(), static_cast<int>(keyDropDownControlObjects.size()));
|
||||
}
|
||||
|
||||
// Function to get the list of key codes from the shortcut combo box stack panel
|
||||
|
||||
@@ -254,7 +254,7 @@ void ShortcutControl::AddNewShortcutControlRow(StackPanel& parent, std::vector<s
|
||||
row.Children().Append(deleteShortcutContainer);
|
||||
|
||||
// Set accessible names
|
||||
UpdateAccessibleNames(keyboardRemapControlObjects[keyboardRemapControlObjects.size() - 1][0]->GetShortcutControl(), keyboardRemapControlObjects[keyboardRemapControlObjects.size() - 1][1]->GetShortcutControl(), targetAppTextBox, deleteShortcut, (int)keyboardRemapControlObjects.size());
|
||||
UpdateAccessibleNames(keyboardRemapControlObjects[keyboardRemapControlObjects.size() - 1][0]->GetShortcutControl(), keyboardRemapControlObjects[keyboardRemapControlObjects.size() - 1][1]->GetShortcutControl(), targetAppTextBox, deleteShortcut, static_cast<int>(keyboardRemapControlObjects.size()));
|
||||
|
||||
// Set the shortcut text if the two vectors are not empty (i.e. default args)
|
||||
if (EditorHelpers::IsValidShortcut(originalKeys) && !(newKeys.index() == 0 && std::get<DWORD>(newKeys) == NULL) && !(newKeys.index() == 1 && !EditorHelpers::IsValidShortcut(std::get<Shortcut>(newKeys))))
|
||||
|
||||
@@ -206,7 +206,7 @@ void SingleKeyRemapControl::AddNewControlKeyRemapRow(StackPanel& parent, std::ve
|
||||
}
|
||||
|
||||
// Set accessible names
|
||||
UpdateAccessibleNames(keyboardRemapControlObjects.back()[0]->getSingleKeyRemapControl(), keyboardRemapControlObjects.back()[1]->getSingleKeyRemapControl(), deleteRemapKeys, (int)keyboardRemapControlObjects.size());
|
||||
UpdateAccessibleNames(keyboardRemapControlObjects.back()[0]->getSingleKeyRemapControl(), keyboardRemapControlObjects.back()[1]->getSingleKeyRemapControl(), deleteRemapKeys, static_cast<int>(keyboardRemapControlObjects.size()));
|
||||
}
|
||||
|
||||
// Function to return the stack panel element of the SingleKeyRemapControl. This is the externally visible UI element which can be used to add it to other layouts
|
||||
|
||||
@@ -141,7 +141,7 @@ bool XamlBridge::NavigateFocus(MSG* msg)
|
||||
}
|
||||
|
||||
// Function to run the message loop for the xaml island window
|
||||
int XamlBridge::MessageLoop()
|
||||
WPARAM XamlBridge::MessageLoop()
|
||||
{
|
||||
MSG msg = {};
|
||||
HRESULT hr = S_OK;
|
||||
@@ -160,10 +160,10 @@ int XamlBridge::MessageLoop()
|
||||
}
|
||||
|
||||
Logger::trace("XamlBridge::MessageLoop() stopped");
|
||||
return (int)msg.wParam;
|
||||
return msg.wParam;
|
||||
}
|
||||
|
||||
static const WPARAM invalidKey = (WPARAM)-1;
|
||||
static const WPARAM invalidKey = 0xFFFFFFFFFFFFFFFF;
|
||||
|
||||
constexpr WPARAM GetKeyFromReason(winrt::Windows::UI::Xaml::Hosting::XamlSourceFocusNavigationReason reason)
|
||||
{
|
||||
|
||||
@@ -5,7 +5,7 @@ class XamlBridge
|
||||
{
|
||||
public:
|
||||
// Function to run the message loop for the xaml island window
|
||||
int MessageLoop();
|
||||
WPARAM MessageLoop();
|
||||
|
||||
// Constructor
|
||||
XamlBridge(HWND parent) :
|
||||
|
||||
Reference in New Issue
Block a user