forked from microsoft/terminal
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcontsf.cpp
33 lines (29 loc) · 893 Bytes
/
contsf.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.
#include "precomp.h"
CConsoleTSF* g_pConsoleTSF = nullptr;
extern "C" BOOL ActivateTextServices(HWND hwndConsole, GetSuggestionWindowPos pfnPosition)
{
if (!g_pConsoleTSF && hwndConsole)
{
g_pConsoleTSF = new (std::nothrow) CConsoleTSF(hwndConsole, pfnPosition);
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);
}
}