[OSK] Handle the warning dialog box in its own thread

The dialog box at the startup of On-Screen Keyboard is displayed alongside with main window. While the Microsoft's OSK in XP is written in MFC and OSK is actually a mere window whereas our OSK is a dialog, the main dialog procedure call is superseded until the user does something with the warning dialog box on startup.

Just create a thread for it and handle the dialog box on startup in its own thread.
This commit is contained in:
George Bișoc 2020-05-04 12:06:22 +02:00
parent 3ad573f92f
commit aea948a79e
2 changed files with 21 additions and 2 deletions

View file

@ -3,7 +3,7 @@
* LICENSE: GPL - See COPYING in the top level directory
* PURPOSE: On-screen keyboard.
* COPYRIGHT: Denis ROBERT
* Copyright 2019 George Bișoc (george.bisoc@reactos.org)
* Copyright 2019-2020 George Bișoc (george.bisoc@reactos.org)
*/
/* INCLUDES *******************************************************************/
@ -94,6 +94,20 @@ INT_PTR CALLBACK OSK_WarningProc(HWND hDlg, UINT Msg, WPARAM wParam, LPARAM lPar
return FALSE;
}
/***********************************************************************
*
* OSK_WarningDlgThread
*
* Thread procedure routine for the warning dialog box
*/
DWORD WINAPI OSK_WarningDlgThread(LPVOID lpParameter)
{
HINSTANCE hInstance = (HINSTANCE)lpParameter;
DialogBoxW(hInstance, MAKEINTRESOURCEW(IDD_WARNINGDIALOG_OSK), Globals.hMainWnd, OSK_WarningProc);
return 0;
}
/***********************************************************************
*
* OSK_About
@ -811,7 +825,11 @@ int WINAPI wWinMain(HINSTANCE hInstance,
/* If the member of the struct (bShowWarning) is set then display the dialog box */
if (Globals.bShowWarning)
{
DialogBoxW(Globals.hInstance, MAKEINTRESOURCEW(IDD_WARNINGDIALOG_OSK), Globals.hMainWnd, OSK_WarningProc);
/* If for whatever reason the thread fails to be created then handle the dialog box in main thread... */
if (CreateThread(NULL, 0, OSK_WarningDlgThread, (PVOID)Globals.hInstance, 0, NULL) == NULL)
{
DialogBoxW(Globals.hInstance, MAKEINTRESOURCEW(IDD_WARNINGDIALOG_OSK), Globals.hMainWnd, OSK_WarningProc);
}
}
/* Before initializing the dialog execution, check if the chosen keyboard type is standard or enhanced */

View file

@ -65,6 +65,7 @@ BOOL OSK_DlgCommand(WPARAM wCommand, HWND hWndControl);
BOOL OSK_ReleaseKey(WORD ScanCode);
INT_PTR APIENTRY OSK_DlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam);
LRESULT APIENTRY OSK_ThemeHandler(HWND hDlg, NMCUSTOMDRAW *pNmDraw);
DWORD WINAPI OSK_WarningDlgThread(LPVOID lpParameter);
int WINAPI wWinMain(HINSTANCE, HINSTANCE, LPWSTR, int);
VOID OSK_RestoreDlgPlacement(HWND hDlg);
VOID OSK_RefreshLEDKeys(VOID);