summaryrefslogtreecommitdiff
path: root/libs
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2020-05-10 12:39:41 +0300
committerGeorge Hazan <ghazan@miranda.im>2020-05-10 12:39:47 +0300
commit17895ec37e6e958d9dec963484091f38a3329443 (patch)
tree5f21c1014674f807fea54f802293db26654a3001 /libs
parent0ef19712e4a5130e58f3931f19090ca8cfe6cf3a (diff)
mTextControl related code cleaning
Diffstat (limited to 'libs')
-rw-r--r--libs/mTextControl/src/services.cpp12
-rw-r--r--libs/mTextControl/src/textcontrol.cpp3
2 files changed, 9 insertions, 6 deletions
diff --git a/libs/mTextControl/src/services.cpp b/libs/mTextControl/src/services.cpp
index 4e1ca40034..c457ba3156 100644
--- a/libs/mTextControl/src/services.cpp
+++ b/libs/mTextControl/src/services.cpp
@@ -158,10 +158,14 @@ MTEXTCONTROL_DLL(int) MTextDisplay(HDC dc, POINT pos, SIZE sz, HANDLE text)
/////////////////////////////////////////////////////////////////////////////////////////
// set parent window for text object (this is required for mouse handling, etc)
-MTEXTCONTROL_DLL(int) MTextSetParent(HANDLE text, HWND hwnd, RECT rect)
+MTEXTCONTROL_DLL(int) MTextSetParent(HANDLE text, HWND hwnd)
{
- if (text)
- ((TextObject *)text)->ftd->setParentWnd(hwnd, rect);
+ if (text) {
+ RECT rc;
+ GetClientRect(hwnd, &rc);
+
+ ((TextObject *)text)->ftd->setParentWnd(hwnd, rc);
+ }
return 0;
}
@@ -178,7 +182,7 @@ MTEXTCONTROL_DLL(int) MTextSendMessage(HWND hwnd, HANDLE text, UINT msg, WPARAM
if (hwnd && (msg == WM_MOUSEMOVE)) {
HDC hdc = GetDC(hwnd);
- ((TextObject *)text)->ftd->getTextService()->OnTxSetCursor(DVASPECT_CONTENT, 0, nullptr, nullptr, hdc, nullptr, nullptr, LOWORD(0), HIWORD(0));
+ ((TextObject *)text)->ftd->getTextService()->OnTxSetCursor(DVASPECT_CONTENT, 0, nullptr, nullptr, hdc, nullptr, nullptr, LOWORD(lParam), HIWORD(lParam));
ReleaseDC(hwnd, hdc);
}
diff --git a/libs/mTextControl/src/textcontrol.cpp b/libs/mTextControl/src/textcontrol.cpp
index a7069ae88c..c62148269b 100644
--- a/libs/mTextControl/src/textcontrol.cpp
+++ b/libs/mTextControl/src/textcontrol.cpp
@@ -78,8 +78,7 @@ LRESULT CALLBACK MTextControlWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM
GetWindowText(hwnd, data->text, textLength + 1);
data->mtext = MTextCreateW(data->htu, data->text);
- RECT rc; GetClientRect(hwnd, &rc);
- MTextSetParent(data->mtext, hwnd, rc);
+ MTextSetParent(data->mtext, hwnd);
InvalidateRect(hwnd, nullptr, TRUE);
}