diff options
author | George Hazan <george.hazan@gmail.com> | 2014-07-31 19:20:38 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2014-07-31 19:20:38 +0000 |
commit | 5ccc401594b2c465352b03df6b2868fffbf3ffc2 (patch) | |
tree | ad79c35a69b965a78bbe335e86e7f0e13495d358 /plugins | |
parent | 3e5959daa64de93186b2dceaeaf0a85c0535a5c6 (diff) |
AVS: no need to rebuild the whole control for the same contact
git-svn-id: http://svn.miranda-ng.org/main/trunk@10008 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/AVS/src/acc.cpp | 43 |
1 files changed, 24 insertions, 19 deletions
diff --git a/plugins/AVS/src/acc.cpp b/plugins/AVS/src/acc.cpp index 3d79469baf..72d9c3b3b6 100644 --- a/plugins/AVS/src/acc.cpp +++ b/plugins/AVS/src/acc.cpp @@ -374,6 +374,7 @@ static void DrawText(HDC hdc, HFONT hFont, const RECT &rc, const TCHAR *text) static LRESULT CALLBACK ACCWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
ACCData *data = (ACCData*)GetWindowLongPtr(hwnd, 0);
+ char *szProto;
switch (msg) {
case WM_NCCREATE:
@@ -414,33 +415,37 @@ static LRESULT CALLBACK ACCWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lP break;
case AVATAR_SETCONTACT:
- DestroyAnimation(hwnd, data);
+ if (lParam == 0)
+ return FALSE;
- data->hContact = lParam;
- if (lParam == NULL)
- data->proto[0] = '\0';
- else
- lstrcpynA(data->proto, GetContactProto(data->hContact), sizeof(data->proto));
+ if (data->hContact != lParam) {
+ DestroyAnimation(hwnd, data);
- StartAnimation(hwnd, data);
+ data->hContact = lParam;
+ if (lParam == NULL)
+ data->proto[0] = '\0';
+ else
+ lstrcpynA(data->proto, GetContactProto(data->hContact), sizeof(data->proto));
- NotifyAvatarChange(hwnd);
- Invalidate(hwnd);
+ StartAnimation(hwnd, data);
+
+ NotifyAvatarChange(hwnd);
+ Invalidate(hwnd);
+ }
return TRUE;
case AVATAR_SETPROTOCOL:
- DestroyAnimation(hwnd, data);
-
- data->hContact = NULL;
- if (lParam == NULL)
- data->proto[0] = '\0';
- else
- lstrcpynA(data->proto, (char *)lParam, sizeof(data->proto));
+ szProto = (lParam == NULL) ? "" : (char*)lParam;
+ if (data->hContact != 0 || strcmp(szProto, data->proto)) {
+ DestroyAnimation(hwnd, data);
- StartAnimation(hwnd, data);
+ data->hContact = NULL;
+ strncpy_s(data->proto, szProto, _TRUNCATE);
- NotifyAvatarChange(hwnd);
- Invalidate(hwnd);
+ StartAnimation(hwnd, data);
+ NotifyAvatarChange(hwnd);
+ Invalidate(hwnd);
+ }
return TRUE;
case AVATAR_SETBKGCOLOR:
|