diff options
author | George Hazan <george.hazan@gmail.com> | 2013-06-21 15:11:57 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2013-06-21 15:11:57 +0000 |
commit | 57edbfdb0eea5ca07e8052f576c52a4fd9398204 (patch) | |
tree | 4526cc40f58226f2c3e1c34afa9a25a04845c980 /plugins/TabSRMM/src/chat/window.cpp | |
parent | 1c28535b64607096f699432e1de151f6e8f9983e (diff) |
fix for regression in rev. 5010
git-svn-id: http://svn.miranda-ng.org/main/trunk@5080 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/TabSRMM/src/chat/window.cpp')
-rw-r--r-- | plugins/TabSRMM/src/chat/window.cpp | 85 |
1 files changed, 41 insertions, 44 deletions
diff --git a/plugins/TabSRMM/src/chat/window.cpp b/plugins/TabSRMM/src/chat/window.cpp index 8700c05e3e..6f9beeffd2 100644 --- a/plugins/TabSRMM/src/chat/window.cpp +++ b/plugins/TabSRMM/src/chat/window.cpp @@ -1411,12 +1411,10 @@ static void ProcessNickListHovering(HWND hwnd, int hoveredItem, POINT * pt, SESS static int currentHovered = -1;
static HWND hwndToolTip = NULL;
static HWND oldParent = NULL;
- TOOLINFO ti = {0};
- RECT clientRect;
- BOOL bNewTip = FALSE;
- USERINFO *ui1 = NULL;
- if (hoveredItem == currentHovered) return;
+ if (hoveredItem == currentHovered)
+ return;
+
currentHovered = hoveredItem;
if (oldParent != hwnd && hwndToolTip) {
@@ -1424,50 +1422,49 @@ static void ProcessNickListHovering(HWND hwnd, int hoveredItem, POINT * pt, SESS DestroyWindow(hwndToolTip);
hwndToolTip = NULL;
}
- if (hoveredItem == -1) {
+ if (hoveredItem == -1) {
SendMessage(hwndToolTip, TTM_ACTIVATE, 0, 0);
+ return;
+ }
- } else {
-
- if (!hwndToolTip) {
- hwndToolTip = CreateWindowEx(WS_EX_TOPMOST, TOOLTIPS_CLASS, NULL,
- WS_POPUP | TTS_NOPREFIX | TTS_ALWAYSTIP,
- CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT,
- hwnd, NULL, g_hInst, NULL);
- bNewTip = TRUE;
- }
-
- GetClientRect(hwnd, &clientRect);
- ti.cbSize = sizeof(TOOLINFO);
- ti.uFlags = TTF_SUBCLASS;
- ti.hinst = g_hInst;
- ti.hwnd = hwnd;
- ti.uId = 1;
- ti.rect = clientRect;
-
- ti.lpszText = NULL;
+ BOOL bNewTip = FALSE;
+ if (!hwndToolTip) {
+ hwndToolTip = CreateWindowEx(WS_EX_TOPMOST, TOOLTIPS_CLASS, NULL,
+ WS_POPUP | TTS_NOPREFIX | TTS_ALWAYSTIP,
+ CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT,
+ hwnd, NULL, g_hInst, NULL);
+ bNewTip = TRUE;
+ }
- ui1 = SM_GetUserFromIndex(parentdat->ptszID, parentdat->pszModule, currentHovered);
- if (ui1) {
- if ( ProtoServiceExists(parentdat->pszModule, MS_GC_PROTO_GETTOOLTIPTEXT))
- ti.lpszText = (TCHAR*)CallProtoService(parentdat->pszModule, MS_GC_PROTO_GETTOOLTIPTEXT, (WPARAM)parentdat->ptszID, (LPARAM)ui1->pszUID);
- else {
- TCHAR ptszBuf[ 1024 ];
- mir_sntprintf( ptszBuf, SIZEOF(ptszBuf), _T("%s: %s\r\n%s: %s\r\n%s: %s"),
- TranslateT("Nick name"), ui1->pszNick,
- TranslateT("Unique Id"), ui1->pszUID,
- TranslateT("Status"), TM_WordToString( parentdat->pStatuses, ui1->Status ));
- ti.lpszText = mir_tstrdup( ptszBuf );
- }
+ RECT clientRect;
+ GetClientRect(hwnd, &clientRect);
+
+ TOOLINFO ti = { sizeof(ti) };
+ ti.uFlags = TTF_SUBCLASS;
+ ti.hinst = g_hInst;
+ ti.hwnd = hwnd;
+ ti.uId = 1;
+ ti.rect = clientRect;
+
+ TCHAR ptszBuf[1024];
+
+ USERINFO *ui1 = SM_GetUserFromIndex(parentdat->ptszID, parentdat->pszModule, currentHovered);
+ if (ui1) {
+ if ( ProtoServiceExists(parentdat->pszModule, MS_GC_PROTO_GETTOOLTIPTEXT))
+ ti.lpszText = (TCHAR*)ProtoCallService(parentdat->pszModule, MS_GC_PROTO_GETTOOLTIPTEXT, (WPARAM)parentdat->ptszID, (LPARAM)ui1->pszUID);
+ else {
+ mir_sntprintf(ptszBuf, SIZEOF(ptszBuf), _T("%s: %s\r\n%s: %s\r\n%s: %s"),
+ TranslateT("Nick name"), ui1->pszNick,
+ TranslateT("Unique Id"), ui1->pszUID,
+ TranslateT("Status"), TM_WordToString( parentdat->pStatuses, ui1->Status));
+ ti.lpszText = ptszBuf;
}
-
- SendMessage(hwndToolTip, bNewTip ? TTM_ADDTOOL : TTM_UPDATETIPTEXT, 0, (LPARAM)&ti);
- SendMessage(hwndToolTip, TTM_ACTIVATE, (ti.lpszText != NULL) , 0);
- SendMessage(hwndToolTip, TTM_SETMAXTIPWIDTH, 0 , 400);
- if (ti.lpszText)
- mir_free(ti.lpszText);
}
+
+ SendMessage(hwndToolTip, bNewTip ? TTM_ADDTOOL : TTM_UPDATETIPTEXT, 0, (LPARAM)&ti);
+ SendMessage(hwndToolTip, TTM_ACTIVATE, (ti.lpszText != NULL) , 0);
+ SendMessage(hwndToolTip, TTM_SETMAXTIPWIDTH, 0 , 400);
}
/*
@@ -1843,7 +1840,7 @@ static LRESULT CALLBACK NicklistSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, ti.cbSize = sizeof(ti);
if (ProtoServiceExists(parentdat->pszModule, MS_GC_PROTO_GETTOOLTIPTEXT))
- _tcsncpy(ptszBuf, (TCHAR*)CallProtoService(parentdat->pszModule, MS_GC_PROTO_GETTOOLTIPTEXT, (WPARAM)parentdat->ptszID, (LPARAM)ui1->pszUID), SIZEOF(ptszBuf));
+ _tcsncpy(ptszBuf, (TCHAR*)ProtoCallService(parentdat->pszModule, MS_GC_PROTO_GETTOOLTIPTEXT, (WPARAM)parentdat->ptszID, (LPARAM)ui1->pszUID), SIZEOF(ptszBuf));
else
mir_sntprintf(ptszBuf, SIZEOF(ptszBuf), _T("<b>%s:</b>\t%s\n<b>%s:</b>\t%s\n<b>%s:</b>\t%s"),
TranslateT("Nick"), ui1->pszNick,
|