summaryrefslogtreecommitdiff
path: root/libs/mTextControl/src/richeditutils.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'libs/mTextControl/src/richeditutils.cpp')
-rw-r--r--libs/mTextControl/src/richeditutils.cpp15
1 files changed, 11 insertions, 4 deletions
diff --git a/libs/mTextControl/src/richeditutils.cpp b/libs/mTextControl/src/richeditutils.cpp
index 31ac38a35b..24392a7560 100644
--- a/libs/mTextControl/src/richeditutils.cpp
+++ b/libs/mTextControl/src/richeditutils.cpp
@@ -108,6 +108,7 @@ void InitRichEdit(ITextServices *ts)
/////////////////////////////////////////////////////////////////////////////////////////
static ATOM winClass = 0;
+static HWND hwndProxy = 0;
static LRESULT CALLBACK RichEditProxyWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
@@ -120,7 +121,7 @@ static LRESULT CALLBACK RichEditProxyWndProc(HWND hwnd, UINT msg, WPARAM wParam,
return 1;
}
-HWND CreateProxyWindow(ITextServices *ts)
+HWND CreateProxyWindow()
{
if (winClass == 0) {
WNDCLASSEX wcl = {};
@@ -134,13 +135,19 @@ HWND CreateProxyWindow(ITextServices *ts)
winClass = RegisterClassExW(&wcl);
}
- HWND hwnd = CreateWindow(L"NBRichEditProxyWndClass", L"", 0, 0, 0, 0, 0, nullptr, nullptr, g_hInst, nullptr);
- SetWindowLongPtr(hwnd, GWLP_USERDATA, (LONG_PTR)ts);
- return hwnd;
+ if (hwndProxy == 0)
+ hwndProxy = CreateWindow(L"NBRichEditProxyWndClass", L"", 0, 0, 0, 0, 0, nullptr, nullptr, g_hInst, nullptr);
+
+ return hwndProxy;
}
void DestroyProxyWindow()
{
+ if (hwndProxy) {
+ SetWindowLongPtr(hwndProxy, GWLP_USERDATA, 0);
+ DestroyWindow(hwndProxy);
+ }
+
if (winClass != 0)
UnregisterClassW(L"NBRichEditProxyWndClass", g_hInst);
} \ No newline at end of file