Fixed some warnings and added code to close active windows on disable (#2915)

This commit is contained in:
Arjun Balgovind
2020-05-12 15:58:11 -07:00
committed by GitHub
parent a1e1d663c3
commit ce96e34d25
6 changed files with 50 additions and 21 deletions

View File

@@ -61,10 +61,10 @@ void createEditShortcutsWindow(HINSTANCE hInst, KeyboardManagerState& keyboardMa
windowClass.hbrBackground = (HBRUSH)(COLOR_WINDOW);
windowClass.hIcon = (HICON)LoadImageW(
windowClass.hInstance,
MAKEINTRESOURCE(IDS_KEYBOARDMANAGER_ICON),
IMAGE_ICON,
48,
48,
MAKEINTRESOURCE(IDS_KEYBOARDMANAGER_ICON),
IMAGE_ICON,
48,
48,
LR_DEFAULTCOLOR);
if (RegisterClassEx(&windowClass) == NULL)
{
@@ -87,7 +87,7 @@ void createEditShortcutsWindow(HINSTANCE hInst, KeyboardManagerState& keyboardMa
HWND _hWndEditShortcutsWindow = CreateWindow(
szWindowClass,
L"Remap Shortcuts",
WS_OVERLAPPEDWINDOW | WS_VISIBLE,
WS_OVERLAPPED | WS_CAPTION | WS_SYSMENU | WS_THICKFRAME | WS_MAXIMIZEBOX,
(desktopRect.right / 2) - (windowWidth / 2),
(desktopRect.bottom / 2) - (windowHeight / 2),
windowWidth,
@@ -377,3 +377,13 @@ bool CheckEditShortcutsWindowActive()
return result;
}
// Function to close any active Edit Shortcuts window
void CloseActiveEditShortcutsWindow()
{
std::unique_lock<std::mutex> hwndLock(editShortcutsWindowMutex);
if (hwndEditShortcutsNativeWindow != nullptr)
{
PostMessage(hwndEditShortcutsNativeWindow, WM_CLOSE, 0, 0);
}
}