2019-05-03 00:29:04 +02:00
|
|
|
// Copyright (c) Microsoft Corporation.
|
|
|
|
// Licensed under the MIT license.
|
|
|
|
|
|
|
|
#include "precomp.h"
|
|
|
|
|
2020-03-20 21:35:12 +01:00
|
|
|
CConsoleTSF* g_pConsoleTSF = nullptr;
|
2019-05-03 00:29:04 +02:00
|
|
|
|
2021-10-04 16:29:56 +02:00
|
|
|
extern "C" BOOL ActivateTextServices(HWND hwndConsole, GetSuggestionWindowPos pfnPosition, GetTextBoxAreaPos pfnTextArea)
|
2019-05-03 00:29:04 +02:00
|
|
|
{
|
|
|
|
if (!g_pConsoleTSF && hwndConsole)
|
|
|
|
{
|
2021-10-04 16:29:56 +02:00
|
|
|
g_pConsoleTSF = new (std::nothrow) CConsoleTSF(hwndConsole, pfnPosition, pfnTextArea);
|
2019-05-03 00:29:04 +02:00
|
|
|
if (g_pConsoleTSF && SUCCEEDED(g_pConsoleTSF->Initialize()))
|
|
|
|
{
|
|
|
|
// Conhost calls this function only when the console window has focus.
|
|
|
|
g_pConsoleTSF->SetFocus(TRUE);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
SafeReleaseClear(g_pConsoleTSF);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return g_pConsoleTSF ? TRUE : FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
extern "C" void DeactivateTextServices()
|
|
|
|
{
|
|
|
|
if (g_pConsoleTSF)
|
|
|
|
{
|
|
|
|
g_pConsoleTSF->Uninitialize();
|
|
|
|
SafeReleaseClear(g_pConsoleTSF);
|
|
|
|
}
|
|
|
|
}
|