summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2014-12-22 22:26:47 +0000
committerGeorge Hazan <george.hazan@gmail.com>2014-12-22 22:26:47 +0000
commita57b972035bf2866fece4b832849d98e07485a98 (patch)
treeeb4b86cce93c592464b7f46cc1e5a68d0fd81b27
parent0e060269c29a4bf71a8552ba4abd394bc55c2adf (diff)
- minus another critical section;
- struct SHORTDATA => SHORTDATA git-svn-id: http://svn.miranda-ng.org/main/trunk@11592 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
-rw-r--r--plugins/Clist_modern/src/hdr/modern_cache_funcs.h4
-rw-r--r--plugins/Clist_modern/src/hdr/modern_clist.h4
-rw-r--r--plugins/Clist_modern/src/hdr/modern_static_clui.h2
-rw-r--r--plugins/Clist_modern/src/modern_aniavatars.cpp4
-rw-r--r--plugins/Clist_modern/src/modern_cachefuncs.cpp10
-rw-r--r--plugins/Clist_modern/src/modern_clc.cpp5
-rw-r--r--plugins/Clist_modern/src/modern_clcmsgs.cpp213
-rw-r--r--plugins/Clist_modern/src/modern_clui.cpp2
-rw-r--r--plugins/Clist_modern/src/modern_gettextasync.cpp2
-rw-r--r--plugins/Clist_modern/src/modern_skinengine.cpp402
10 files changed, 304 insertions, 344 deletions
diff --git a/plugins/Clist_modern/src/hdr/modern_cache_funcs.h b/plugins/Clist_modern/src/hdr/modern_cache_funcs.h
index b3fc754b88..26146a0164 100644
--- a/plugins/Clist_modern/src/hdr/modern_cache_funcs.h
+++ b/plugins/Clist_modern/src/hdr/modern_cache_funcs.h
@@ -34,8 +34,8 @@ Created by Pescuma
void Cache_GetText(ClcData *dat, ClcContact *contact, BOOL forceRenew);
void Cache_GetFirstLineText(ClcData *dat, ClcContact *contact);
-void Cache_GetSecondLineText(struct SHORTDATA *dat, ClcCacheEntry *pdnce);
-void Cache_GetThirdLineText(struct SHORTDATA *dat, ClcCacheEntry *pdnce);
+void Cache_GetSecondLineText(SHORTDATA *dat, ClcCacheEntry *pdnce);
+void Cache_GetThirdLineText(SHORTDATA *dat, ClcCacheEntry *pdnce);
void Cache_GetAvatar(ClcData *dat, ClcContact *contact);
void Cache_GetTimezone(ClcData *dat, MCONTACT hContact);
int Cache_GetLineText(ClcCacheEntry *pdnce, int type, LPTSTR text, int text_size, TCHAR *variable_text, BOOL xstatus_has_priority,
diff --git a/plugins/Clist_modern/src/hdr/modern_clist.h b/plugins/Clist_modern/src/hdr/modern_clist.h
index 2884c731cd..a9c5c64fb4 100644
--- a/plugins/Clist_modern/src/hdr/modern_clist.h
+++ b/plugins/Clist_modern/src/hdr/modern_clist.h
@@ -60,13 +60,13 @@ public:
DestroySmileyList();
}
- void ReplaceSmileys(struct SHORTDATA *dat, struct ClcCacheEntry *pdnce, TCHAR *szText, BOOL replace_smileys);
+ void ReplaceSmileys(struct SHORTDATA *dat, ClcCacheEntry *pdnce, TCHAR *szText, BOOL replace_smileys);
/** Destroy smiley list */
void DestroySmileyList();
/** Copy Smiley List */
void _CopySmileyList(SortedList *plInput);
- void AddListeningToIcon(struct SHORTDATA *dat, TCHAR *szText);
+ void AddListeningToIcon(SHORTDATA *dat, TCHAR *szText);
};
diff --git a/plugins/Clist_modern/src/hdr/modern_static_clui.h b/plugins/Clist_modern/src/hdr/modern_static_clui.h
index 7d19d6dd92..c1cbe7044c 100644
--- a/plugins/Clist_modern/src/hdr/modern_static_clui.h
+++ b/plugins/Clist_modern/src/hdr/modern_static_clui.h
@@ -55,7 +55,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
/* Declaration of prototypes in other modules */
int ClcUnloadModule();
-int ClcGetShortData(ClcData* pData, struct SHORTDATA *pShortData);
+int ClcGetShortData(ClcData* pData, SHORTDATA *pShortData);
int ClcEnterDragToScroll(HWND hwnd, int Y);
int CListMod_ContactListShutdownProc(WPARAM wParam, LPARAM lParam);
diff --git a/plugins/Clist_modern/src/modern_aniavatars.cpp b/plugins/Clist_modern/src/modern_aniavatars.cpp
index 9a88b89732..9d66b73d2b 100644
--- a/plugins/Clist_modern/src/modern_aniavatars.cpp
+++ b/plugins/Clist_modern/src/modern_aniavatars.cpp
@@ -222,8 +222,8 @@ static void CALLBACK _AniAva_SyncCallerUserAPCProc(DWORD_PTR dwParam)
static INT_PTR _AniAva_CreateAvatarWindowSync_Worker(WPARAM tszName, LPARAM)
{
- HWND hwnd = CreateWindowEx(WS_EX_TOPMOST | WS_EX_TRANSPARENT | WS_EX_NOPARENTNOTIFY, ANIAVAWINDOWCLASS, (TCHAR*)tszName, WS_POPUP,
- 0, 0, 1, 1, pcli->hwndContactList, NULL, pcli->hInst, NULL);
+ HWND hwnd = CreateWindowEx(WS_EX_TOPMOST | WS_EX_TRANSPARENT | WS_EX_NOPARENTNOTIFY, ANIAVAWINDOWCLASS,
+ (TCHAR*)tszName, WS_POPUP, 0, 0, 1, 1, pcli->hwndContactList, NULL, pcli->hInst, NULL);
return (INT_PTR)hwnd;
}
diff --git a/plugins/Clist_modern/src/modern_cachefuncs.cpp b/plugins/Clist_modern/src/modern_cachefuncs.cpp
index e904b1d407..acae75305a 100644
--- a/plugins/Clist_modern/src/modern_cachefuncs.cpp
+++ b/plugins/Clist_modern/src/modern_cachefuncs.cpp
@@ -75,7 +75,7 @@ void Cache_GetText(ClcData *dat, ClcContact *contact, BOOL forceRenew)
}
}
-void CSmileyString::AddListeningToIcon(struct SHORTDATA *dat, TCHAR *szText)
+void CSmileyString::AddListeningToIcon(SHORTDATA *dat, TCHAR *szText)
{
iMaxSmileyHeight = 0;
DestroySmileyList();
@@ -179,7 +179,7 @@ void CSmileyString::DestroySmileyList()
* Parsing of text for smiley
*/
-void CSmileyString::ReplaceSmileys(struct SHORTDATA *dat, ClcCacheEntry *pdnce, TCHAR * szText, BOOL replace_smileys)
+void CSmileyString::ReplaceSmileys(SHORTDATA *dat, ClcCacheEntry *pdnce, TCHAR * szText, BOOL replace_smileys)
{
int last_pos = 0;
iMaxSmileyHeight = 0;
@@ -535,7 +535,7 @@ void Cache_GetFirstLineText(ClcData *dat, ClcContact *contact)
else mir_tstrncpy(contact->szText, name, SIZEOF(contact->szText));
if (!dat->force_in_dialog) {
- struct SHORTDATA data = { 0 };
+ SHORTDATA data = { 0 };
Sync(CLUI_SyncGetShortData, (WPARAM)pcli->hwndContactTree, (LPARAM)&data);
contact->ssText.ReplaceSmileys(&data, pdnce, contact->szText, dat->first_line_draw_smileys);
}
@@ -545,7 +545,7 @@ void Cache_GetFirstLineText(ClcData *dat, ClcContact *contact)
* Get the text for Second Line
*/
-void Cache_GetSecondLineText(struct SHORTDATA *dat, ClcCacheEntry *pdnce)
+void Cache_GetSecondLineText(SHORTDATA *dat, ClcCacheEntry *pdnce)
{
TCHAR Text[240 - EXTRA_ICON_COUNT] = { 0 };
int type = TEXT_EMPTY;
@@ -570,7 +570,7 @@ void Cache_GetSecondLineText(struct SHORTDATA *dat, ClcCacheEntry *pdnce)
/*
* Get the text for Third Line
*/
-void Cache_GetThirdLineText(struct SHORTDATA *dat, ClcCacheEntry *pdnce)
+void Cache_GetThirdLineText(SHORTDATA *dat, ClcCacheEntry *pdnce)
{
TCHAR Text[240 - EXTRA_ICON_COUNT] = { 0 };
int type = TEXT_EMPTY;
diff --git a/plugins/Clist_modern/src/modern_clc.cpp b/plugins/Clist_modern/src/modern_clc.cpp
index f7dd80ce5f..e6b5cc8717 100644
--- a/plugins/Clist_modern/src/modern_clc.cpp
+++ b/plugins/Clist_modern/src/modern_clc.cpp
@@ -208,8 +208,7 @@ static int clcHookSettingChanged(WPARAM hContact, LPARAM lParam)
else if (!mir_strcmp(cws->szSetting, "XStatusId") || !mir_strcmp(cws->szSetting, "XStatusName"))
cliCluiProtocolStatusChanged(0, cws->szModule);
}
- else // hContact != NULL
- {
+ else {
if (!mir_strcmp(cws->szSetting, "TickTS"))
pcli->pfnClcBroadcast(INTM_STATUSCHANGED, hContact, 0);
else if (!mir_strcmp(cws->szModule, "UserInfo")) {
@@ -1777,7 +1776,7 @@ int ClcDoProtoAck(MCONTACT, ACKDATA * ack)
return 0;
}
-int ClcGetShortData(ClcData* pData, struct SHORTDATA *pShortData)
+int ClcGetShortData(ClcData* pData, SHORTDATA *pShortData)
{
if (!pData || !pShortData)
return -1;
diff --git a/plugins/Clist_modern/src/modern_clcmsgs.cpp b/plugins/Clist_modern/src/modern_clcmsgs.cpp
index 3c37af72c4..82f47e3213 100644
--- a/plugins/Clist_modern/src/modern_clcmsgs.cpp
+++ b/plugins/Clist_modern/src/modern_clcmsgs.cpp
@@ -62,17 +62,17 @@ LRESULT cli_ProcessExternalMessages(HWND hwnd, ClcData *dat, UINT msg, WPARAM wP
return 0;
case CLM_SETHIDEEMPTYGROUPS:
- {
- BOOL old = ((GetWindowLongPtr(hwnd, GWL_STYLE) & CLS_HIDEEMPTYGROUPS) != 0);
- if (wParam)
- SetWindowLongPtr(hwnd, GWL_STYLE, GetWindowLongPtr(hwnd, GWL_STYLE) | CLS_HIDEEMPTYGROUPS);
- else
- SetWindowLongPtr(hwnd, GWL_STYLE, GetWindowLongPtr(hwnd, GWL_STYLE) &~CLS_HIDEEMPTYGROUPS);
- BOOL newval = ((GetWindowLongPtr(hwnd, GWL_STYLE) & CLS_HIDEEMPTYGROUPS) != 0);
- if (newval != old)
- pcli->pfnInitAutoRebuild(hwnd);
- }
- return 0;
+ {
+ BOOL old = ((GetWindowLongPtr(hwnd, GWL_STYLE) & CLS_HIDEEMPTYGROUPS) != 0);
+ if (wParam)
+ SetWindowLongPtr(hwnd, GWL_STYLE, GetWindowLongPtr(hwnd, GWL_STYLE) | CLS_HIDEEMPTYGROUPS);
+ else
+ SetWindowLongPtr(hwnd, GWL_STYLE, GetWindowLongPtr(hwnd, GWL_STYLE) &~CLS_HIDEEMPTYGROUPS);
+ BOOL newval = ((GetWindowLongPtr(hwnd, GWL_STYLE) & CLS_HIDEEMPTYGROUPS) != 0);
+ if (newval != old)
+ pcli->pfnInitAutoRebuild(hwnd);
+ }
+ return 0;
case CLM_SETTEXTCOLOR:
if (wParam > FONTID_MODERN_MAX) break;
@@ -105,110 +105,111 @@ LRESULT cli_ProcessExternalMessages(HWND hwnd, ClcData *dat, UINT msg, WPARAM wP
return 0;
case CLM_GETNEXTITEM:
- {
- int i = 0;
- if (wParam != CLGN_ROOT) {
- if (!pcli->pfnFindItem(hwnd, dat, lParam, &contact, &group, NULL))
- return NULL;
- i = List_IndexOf((SortedList*)&group->cl, contact);
- if (i < 0) return 0;
- }
- switch (wParam) {
- case CLGN_ROOT:
- if (dat->list.cl.count)
- return (LRESULT)pcli->pfnContactToHItem(dat->list.cl.items[0]);
- else
- return NULL;
- case CLGN_CHILD:
- if (contact->type != CLCIT_GROUP)
- return NULL;
- group = contact->group;
- if (group->cl.count == 0)
- return NULL;
- return (LRESULT)pcli->pfnContactToHItem(group->cl.items[0]);
- case CLGN_PARENT:
- return group->groupId | HCONTACT_ISGROUP;
- case CLGN_NEXT:
- do {
- if (++i >= group->cl.count)
+ {
+ int i = 0;
+ if (wParam != CLGN_ROOT) {
+ if (!pcli->pfnFindItem(hwnd, dat, lParam, &contact, &group, NULL))
+ return NULL;
+ i = List_IndexOf((SortedList*)&group->cl, contact);
+ if (i < 0) return 0;
+ }
+ switch (wParam) {
+ case CLGN_ROOT:
+ if (dat->list.cl.count)
+ return (LRESULT)pcli->pfnContactToHItem(dat->list.cl.items[0]);
+ else
+ return NULL;
+ case CLGN_CHILD:
+ if (contact->type != CLCIT_GROUP)
+ return NULL;
+ group = contact->group;
+ if (group->cl.count == 0)
+ return NULL;
+ return (LRESULT)pcli->pfnContactToHItem(group->cl.items[0]);
+ case CLGN_PARENT:
+ return group->groupId | HCONTACT_ISGROUP;
+ case CLGN_NEXT:
+ do {
+ if (++i >= group->cl.count)
+ return NULL;
+ } while (group->cl.items[i]->type == CLCIT_DIVIDER);
+ return (LRESULT)pcli->pfnContactToHItem(group->cl.items[i]);
+ case CLGN_PREVIOUS:
+ do {
+ if (--i < 0)
+ return NULL;
+ } while (group->cl.items[i]->type == CLCIT_DIVIDER);
+ return (LRESULT)pcli->pfnContactToHItem(group->cl.items[i]);
+ case CLGN_NEXTCONTACT:
+ for (i++; i < group->cl.count; i++)
+ if (group->cl.items[i]->type == CLCIT_CONTACT)
+ break;
+ if (i >= group->cl.count)
+ return NULL;
+ return (LRESULT)pcli->pfnContactToHItem(group->cl.items[i]);
+ case CLGN_PREVIOUSCONTACT:
+ if (i >= group->cl.count)
+ return NULL;
+ for (i--; i >= 0; i--)
+ if (group->cl.items[i]->type == CLCIT_CONTACT)
+ break;
+ if (i < 0)
return NULL;
- } while (group->cl.items[i]->type == CLCIT_DIVIDER);
- return (LRESULT)pcli->pfnContactToHItem(group->cl.items[i]);
- case CLGN_PREVIOUS:
- do {
- if (--i < 0)
+ return (LRESULT)pcli->pfnContactToHItem(group->cl.items[i]);
+ case CLGN_NEXTGROUP:
+ for (i++; i < group->cl.count; i++)
+ if (group->cl.items[i]->type == CLCIT_GROUP)
+ break;
+ if (i >= group->cl.count)
return NULL;
- } while (group->cl.items[i]->type == CLCIT_DIVIDER);
- return (LRESULT)pcli->pfnContactToHItem(group->cl.items[i]);
- case CLGN_NEXTCONTACT:
- for (i++; i < group->cl.count; i++)
- if (group->cl.items[i]->type == CLCIT_CONTACT)
- break;
- if (i >= group->cl.count)
- return NULL;
- return (LRESULT)pcli->pfnContactToHItem(group->cl.items[i]);
- case CLGN_PREVIOUSCONTACT:
- if (i >= group->cl.count)
- return NULL;
- for (i--; i >= 0; i--)
- if (group->cl.items[i]->type == CLCIT_CONTACT)
- break;
- if (i < 0)
- return NULL;
- return (LRESULT)pcli->pfnContactToHItem(group->cl.items[i]);
- case CLGN_NEXTGROUP:
- for (i++; i < group->cl.count; i++)
- if (group->cl.items[i]->type == CLCIT_GROUP)
- break;
- if (i >= group->cl.count)
- return NULL;
- return (LRESULT)pcli->pfnContactToHItem(group->cl.items[i]);
- case CLGN_PREVIOUSGROUP:
- if (i >= group->cl.count)
- return NULL;
- for (i--; i >= 0; i--)
- if (group->cl.items[i]->type == CLCIT_GROUP)
- break;
- if (i < 0)
- return NULL;
- return (LRESULT)pcli->pfnContactToHItem(group->cl.items[i]);
+ return (LRESULT)pcli->pfnContactToHItem(group->cl.items[i]);
+ case CLGN_PREVIOUSGROUP:
+ if (i >= group->cl.count)
+ return NULL;
+ for (i--; i >= 0; i--)
+ if (group->cl.items[i]->type == CLCIT_GROUP)
+ break;
+ if (i < 0)
+ return NULL;
+ return (LRESULT)pcli->pfnContactToHItem(group->cl.items[i]);
+ }
}
return NULL;
- }
+
case CLM_SELECTITEM:
- {
ClcGroup *tgroup;
- int index = -1;
- int mainindex = -1;
- if (!pcli->pfnFindItem(hwnd, dat, wParam, &contact, &group, NULL))
- break;
- for (tgroup = group; tgroup; tgroup = tgroup->parent)
- pcli->pfnSetGroupExpand(hwnd, dat, tgroup, 1);
-
- if (!contact->isSubcontact) {
- index = List_IndexOf((SortedList*)&group->cl, contact);
- mainindex = index;
- }
- else {
- index = List_IndexOf((SortedList*)&group->cl, contact->subcontacts);
- mainindex = index;
- index += contact->isSubcontact;
- }
+ {
+ int index = -1;
+ int mainindex = -1;
+ if (!pcli->pfnFindItem(hwnd, dat, wParam, &contact, &group, NULL))
+ break;
+ for (tgroup = group; tgroup; tgroup = tgroup->parent)
+ pcli->pfnSetGroupExpand(hwnd, dat, tgroup, 1);
+
+ if (!contact->isSubcontact) {
+ index = List_IndexOf((SortedList*)&group->cl, contact);
+ mainindex = index;
+ }
+ else {
+ index = List_IndexOf((SortedList*)&group->cl, contact->subcontacts);
+ mainindex = index;
+ index += contact->isSubcontact;
+ }
- BYTE k = db_get_b(NULL, "CLC", "MetaExpanding", SETTING_METAEXPANDING_DEFAULT);
- if (k) {
- for (int i = 0; i < mainindex; i++)
- {
- ClcContact *tempCont = group->cl.items[i];
- if (tempCont->type == CLCIT_CONTACT && tempCont->SubAllocated && tempCont->SubExpanded)
- index += tempCont->SubAllocated;
+ BYTE k = db_get_b(NULL, "CLC", "MetaExpanding", SETTING_METAEXPANDING_DEFAULT);
+ if (k) {
+ for (int i = 0; i < mainindex; i++)
+ {
+ ClcContact *tempCont = group->cl.items[i];
+ if (tempCont->type == CLCIT_CONTACT && tempCont->SubAllocated && tempCont->SubExpanded)
+ index += tempCont->SubAllocated;
+ }
}
- }
- dat->selection = pcli->pfnGetRowsPriorTo(&dat->list, group, index);
- pcli->pfnEnsureVisible(hwnd, dat, dat->selection, 0);
- }
- return 0;
+ dat->selection = pcli->pfnGetRowsPriorTo(&dat->list, group, index);
+ pcli->pfnEnsureVisible(hwnd, dat, dat->selection, 0);
+ }
+ return 0;
case CLM_SETEXTRAIMAGE:
if (LOWORD(lParam) >= dat->extraColumnsCount)
diff --git a/plugins/Clist_modern/src/modern_clui.cpp b/plugins/Clist_modern/src/modern_clui.cpp
index a87d3c4cad..46baf2e67b 100644
--- a/plugins/Clist_modern/src/modern_clui.cpp
+++ b/plugins/Clist_modern/src/modern_clui.cpp
@@ -1267,7 +1267,7 @@ int CLUI_SyncGetShortData(WPARAM wParam, LPARAM lParam)
{
HWND hwnd = (HWND)wParam;
ClcData *dat = (ClcData *)GetWindowLongPtr(hwnd, 0);
- return ClcGetShortData(dat, (struct SHORTDATA *)lParam);
+ return ClcGetShortData(dat, (SHORTDATA*)lParam);
}
int CLUI_IconsChanged(WPARAM, LPARAM)
diff --git a/plugins/Clist_modern/src/modern_gettextasync.cpp b/plugins/Clist_modern/src/modern_gettextasync.cpp
index 9e0d957baa..f43217f13c 100644
--- a/plugins/Clist_modern/src/modern_gettextasync.cpp
+++ b/plugins/Clist_modern/src/modern_gettextasync.cpp
@@ -82,7 +82,7 @@ static void gtaThreadProc(void*)
SleepEx(0, TRUE); //1000 contacts per second
GTACHAINITEM mpChain = { 0 };
- struct SHORTDATA dat2 = { 0 };
+ SHORTDATA dat2 = { 0 };
if (!gtaGetItem(&mpChain))
break;
diff --git a/plugins/Clist_modern/src/modern_skinengine.cpp b/plugins/Clist_modern/src/modern_skinengine.cpp
index c0b522e461..64c8b0d7e8 100644
--- a/plugins/Clist_modern/src/modern_skinengine.cpp
+++ b/plugins/Clist_modern/src/modern_skinengine.cpp
@@ -71,7 +71,7 @@ static BYTE pbGammaWeight[256] = { 0 };
static BYTE pbGammaWeightAdv[256] = { 0 };
static BOOL bGammaWeightFilled = FALSE;
-static CRITICAL_SECTION cs_SkinChanging = { 0 };
+static mir_cs cs_SkinChanging;
static LISTMODERNMASK *MainModernMaskList = NULL;
@@ -366,7 +366,6 @@ BOOL IniParser::_DoParseLine(char *szLine)
HRESULT SkinEngineLoadModule()
{
ModernSkinButtonLoadModule();
- InitializeCriticalSection(&cs_SkinChanging);
MainModernMaskList = (LISTMODERNMASK*)mir_calloc(sizeof(LISTMODERNMASK));
//init variables
g_SkinObjectList.dwObjLPAlocated = 0;
@@ -414,7 +413,6 @@ int SkinEngineUnloadModule()
ReleaseDC(NULL, g_pCachedWindow->hScreenDC);
mir_free_and_nil(g_pCachedWindow);
}
- DeleteCriticalSection(&cs_SkinChanging);
GdiFlush();
DestroyHookableEvent(g_CluiData.hEventSkinServicesCreated);
AniAva_UnloadModule();
@@ -440,18 +438,6 @@ BOOL ske_AlphaBlend(HDC hdcDest, int nXOriginDest, int nYOriginDest, int nWidthD
return AlphaBlend(hdcDest, nXOriginDest, nYOriginDest, nWidthDest, nHeightDest, hdcSrc, nXOriginSrc, nYOriginSrc, nWidthSrc, nHeightSrc, blendFunction);
}
-static int ske_LockSkin()
-{
- EnterCriticalSection(&cs_SkinChanging);
- return 0;
-}
-
-static int ske_UnlockSkin()
-{
- LeaveCriticalSection(&cs_SkinChanging);
- return 0;
-}
-
struct DCBUFFER
{
HDC hdcOwnedBy;
@@ -1445,43 +1431,39 @@ LPSKINOBJECTDESCRIPTOR ske_FindObjectByName(const char * szName, BYTE objType, S
INT_PTR ske_Service_DrawGlyph(WPARAM wParam, LPARAM lParam)
{
- LPSKINDRAWREQUEST preq;
+ LPSKINDRAWREQUEST preq = (LPSKINDRAWREQUEST)wParam;
+ if (preq == NULL)
+ return -1;
+
+ mir_cslock lck(cs_SkinChanging);
+
LPSKINOBJECTDESCRIPTOR pgl;
- LPGLYPHOBJECT gl;
- if (!wParam) return -1;
- ske_LockSkin();
- __try {
- preq = (LPSKINDRAWREQUEST)wParam;
- if (lParam)
- pgl = ske_FindObjectByMask((MODERNMASK*)lParam, NULL);
- else
- pgl = ske_FindObject(preq->szObjectID, NULL);
- if (pgl == NULL) return -1;
- if (pgl->Data == NULL) return -1;
-
- gl = (LPGLYPHOBJECT)pgl->Data;
- int iStyle = gl->Style & 7;
- if (iStyle == ST_SKIP)
- return ST_SKIP;
-
- if (gl->hGlyph == NULL && gl->hGlyph != (HBITMAP)-1 && (iStyle == ST_IMAGE || iStyle == ST_FRAGMENT || iStyle == ST_SOLARIZE))
- if (gl->szFileName) {
- gl->hGlyph = ske_LoadGlyphImage(_A2T(gl->szFileName));
- if (gl->hGlyph) {
- BITMAP bmp = { 0 };
- GetObject(gl->hGlyph, sizeof(BITMAP), &bmp);
- gl->bmBitsPixel = (BYTE)bmp.bmBitsPixel;
- gl->bmHeight = bmp.bmHeight;
- gl->bmWidth = bmp.bmWidth;
- }
- else gl->hGlyph = (HBITMAP)-1; //invalid
+ if (lParam)
+ pgl = ske_FindObjectByMask((MODERNMASK*)lParam, NULL);
+ else
+ pgl = ske_FindObject(preq->szObjectID, NULL);
+ if (pgl == NULL) return -1;
+ if (pgl->Data == NULL) return -1;
+
+ LPGLYPHOBJECT gl = (LPGLYPHOBJECT)pgl->Data;
+ int iStyle = gl->Style & 7;
+ if (iStyle == ST_SKIP)
+ return ST_SKIP;
+
+ if (gl->hGlyph == NULL && gl->hGlyph != (HBITMAP)-1 && (iStyle == ST_IMAGE || iStyle == ST_FRAGMENT || iStyle == ST_SOLARIZE)) {
+ if (gl->szFileName) {
+ gl->hGlyph = ske_LoadGlyphImage(_A2T(gl->szFileName));
+ if (gl->hGlyph) {
+ BITMAP bmp = { 0 };
+ GetObject(gl->hGlyph, sizeof(BITMAP), &bmp);
+ gl->bmBitsPixel = (BYTE)bmp.bmBitsPixel;
+ gl->bmHeight = bmp.bmHeight;
+ gl->bmWidth = bmp.bmWidth;
}
- return ske_DrawSkinObject(preq, gl);
- }
- __finally {
- ske_UnlockSkin();
+ else gl->hGlyph = (HBITMAP)-1; //invalid
+ }
}
- return -1;
+ return ske_DrawSkinObject(preq, gl);
}
@@ -1801,49 +1783,46 @@ static HBITMAP ske_skinLoadGlyphImage(const TCHAR *tszFileName)
HBITMAP ske_LoadGlyphImage(const TCHAR *tszFileName)
{
// try to find image in loaded
- DWORD i;
- HBITMAP hbmp;
TCHAR szFile[MAX_PATH] = { 0 };
ske_GetFullFilename(szFile, tszFileName, g_SkinObjectList.szSkinPlace, TRUE);
- ske_LockSkin();
+
+ mir_cslock lck(cs_SkinChanging);
+
if (pLoadedImages) {
- for (i = 0; i < dwLoadedImagesCount; i++) {
+ for (DWORD i = 0; i < dwLoadedImagesCount; i++) {
if (mir_bool_tstrcmpi(pLoadedImages[i].szFileName, szFile)) {
pLoadedImages[i].dwLoadedTimes++;
- ske_UnlockSkin();
return pLoadedImages[i].hGlyph;
}
}
}
+
// load new image
- hbmp = ske_skinLoadGlyphImage(szFile);
- if (hbmp == NULL) {
- ske_UnlockSkin();
+ HBITMAP hbmp = ske_skinLoadGlyphImage(szFile);
+ if (hbmp == NULL)
return NULL;
- }
+
// add to loaded list
if (dwLoadedImagesCount + 1>dwLoadedImagesAlocated) {
pLoadedImages = (GLYPHIMAGE*)mir_realloc(pLoadedImages, sizeof(GLYPHIMAGE)*(dwLoadedImagesCount + 1));
- if (pLoadedImages) dwLoadedImagesAlocated++;
- else {
- ske_UnlockSkin();
+ if (!pLoadedImages)
return NULL;
- }
+ dwLoadedImagesAlocated++;
}
+
pLoadedImages[dwLoadedImagesCount].dwLoadedTimes = 1;
pLoadedImages[dwLoadedImagesCount].hGlyph = hbmp;
pLoadedImages[dwLoadedImagesCount].szFileName = mir_tstrdup(szFile);
dwLoadedImagesCount++;
- ske_UnlockSkin();
return hbmp;
}
int ske_UnloadGlyphImage(HBITMAP hbmp)
{
- DWORD i;
- for (i = 0; i < dwLoadedImagesCount && pLoadedImages; i++) {
+ for (DWORD i = 0; i < dwLoadedImagesCount && pLoadedImages; i++) {
if (hbmp != pLoadedImages[i].hGlyph)
continue;
+
pLoadedImages[i].dwLoadedTimes--;
if (pLoadedImages[i].dwLoadedTimes == 0) {
LPGLYPHIMAGE gl = &(pLoadedImages[i]);
@@ -1864,8 +1843,6 @@ int ske_UnloadGlyphImage(HBITMAP hbmp)
int ske_UnloadSkin(SKINOBJECTSLIST * Skin)
{
- DWORD i;
- ske_LockSkin();
ClearMaskList(Skin->pMaskList);
//clear font list
@@ -1886,50 +1863,45 @@ int ske_UnloadSkin(SKINOBJECTSLIST * Skin)
if (Skin->pTextList) List_Destroy(Skin->pTextList);
mir_free_and_nil(Skin->pTextList);
ModernSkinButtonDeleteAll();
- if (Skin->dwObjLPAlocated == 0) { ske_UnlockSkin(); return 0; }
- for (i = 0; i < Skin->dwObjLPAlocated; i++) {
+ if (Skin->dwObjLPAlocated == 0)
+ return 0;
+
+ for (DWORD i = 0; i < Skin->dwObjLPAlocated; i++) {
switch (Skin->pObjects[i].bType) {
case OT_GLYPHOBJECT:
- {
- GLYPHOBJECT * dt;
- dt = (GLYPHOBJECT*)Skin->pObjects[i].Data;
+ GLYPHOBJECT *dt = (GLYPHOBJECT*)Skin->pObjects[i].Data;
if (dt->hGlyph && dt->hGlyph != (HBITMAP)-1)
ske_UnloadGlyphImage(dt->hGlyph);
dt->hGlyph = NULL;
mir_free_and_nil(dt->szFileName);
- {// delete texts
- int i;
- if (dt->plTextList && dt->plTextList->realCount > 0) {
- for (i = 0; i < dt->plTextList->realCount; i++) {
- GLYPHTEXT * gt = (GLYPHTEXT *)dt->plTextList->items[i];
- if (gt) {
- mir_free(gt->stText);
- mir_free(gt->stValueText);
- mir_free(gt->szFontID);
- mir_free(gt->szGlyphTextID);
- mir_free(gt);
- }
+
+ if (dt->plTextList && dt->plTextList->realCount > 0) {
+ for (int i = 0; i < dt->plTextList->realCount; i++) {
+ GLYPHTEXT *gt = (GLYPHTEXT *)dt->plTextList->items[i];
+ if (gt) {
+ mir_free(gt->stText);
+ mir_free(gt->stValueText);
+ mir_free(gt->szFontID);
+ mir_free(gt->szGlyphTextID);
+ mir_free(gt);
}
- List_Destroy(dt->plTextList);
- mir_free(dt->plTextList);
}
+ List_Destroy(dt->plTextList);
+ mir_free(dt->plTextList);
}
mir_free(dt);
- }
- break;
+ break;
}
mir_free_and_nil(Skin->pObjects[i].szObjectID);
-
}
mir_free_and_nil(Skin->pObjects);
Skin->pTextList = NULL;
Skin->dwObjLPAlocated = 0;
Skin->dwObjLPReserved = 0;
- ske_UnlockSkin();
return 0;
}
-static void RegisterMaskByParce(const char * szSetting, char * szValue, SKINOBJECTSLIST * pSkin)
+static void RegisterMaskByParce(const char *szSetting, char *szValue, SKINOBJECTSLIST *pSkin)
{
size_t i, val_len = mir_strlen(szValue);
@@ -1950,7 +1922,7 @@ static void RegisterMaskByParce(const char * szSetting, char * szValue, SKINOBJE
}
}
-static int ske_ProcessLoadindString(const char * szSetting, char *szValue)
+static int ske_ProcessLoadindString(const char *szSetting, char *szValue)
{
if (!pCurrentSkin) return 0;
if (szSetting[0] == '$')
@@ -1966,13 +1938,11 @@ static int ske_ProcessLoadindString(const char * szSetting, char *szValue)
else return 0;
return 1;
}
+
static int ske_enumdb_SkinObjectsProc(const char *szSetting, LPARAM)
{
- char *value;
- value = db_get_sa(NULL, SKIN, szSetting);
+ ptrA value(db_get_sa(NULL, SKIN, szSetting));
ske_ProcessLoadindString(szSetting, value);
- mir_free_and_nil(value);
-
return 0;
}
@@ -1983,9 +1953,8 @@ static int ske_SortTextGlyphObjectFunc(void * first, void * second)
static void ske_LinkSkinObjects(SKINOBJECTSLIST * pObjectList)
{
- DWORD i;
// LINK Mask with objects
- for (i = 0; i < pObjectList->pMaskList->dwMaskCnt; i++) {
+ for (DWORD i = 0; i < pObjectList->pMaskList->dwMaskCnt; i++) {
MODERNMASK *mm = &(pObjectList->pMaskList->pl_Masks[i]);
void * pObject = (void*)ske_FindObjectByName(mm->szObjectName, OT_ANY, (SKINOBJECTSLIST*)pObjectList);
mir_free_and_nil(mm->szObjectName);
@@ -2029,13 +1998,15 @@ static void ske_LinkSkinObjects(SKINOBJECTSLIST * pObjectList)
mir_free_and_nil(pObjectList->pTextList);
}
}
+
// Getting skin objects and masks from DB
+
static int ske_GetSkinFromDB(char *, SKINOBJECTSLIST *Skin)
{
if (Skin == NULL) return 0;
ske_UnloadSkin(Skin);
g_CluiData.fDisableSkinEngine = db_get_b(NULL, "ModernData", "DisableEngine", SETTING_DISABLESKIN_DEFAULT);
- //window borders
+ // window borders
if (g_CluiData.fDisableSkinEngine) {
g_CluiData.LeftClientMargin = 0;
g_CluiData.RightClientMargin = 0;
@@ -2043,14 +2014,15 @@ static int ske_GetSkinFromDB(char *, SKINOBJECTSLIST *Skin)
g_CluiData.BottomClientMargin = 0;
}
else {
- //window borders
+ // window borders
g_CluiData.LeftClientMargin = (int)db_get_b(NULL, "CLUI", "LeftClientMargin", SETTING_LEFTCLIENTMARIGN_DEFAULT);
g_CluiData.RightClientMargin = (int)db_get_b(NULL, "CLUI", "RightClientMargin", SETTING_RIGHTCLIENTMARIGN_DEFAULT);
g_CluiData.TopClientMargin = (int)db_get_b(NULL, "CLUI", "TopClientMargin", SETTING_TOPCLIENTMARIGN_DEFAULT);
g_CluiData.BottomClientMargin = (int)db_get_b(NULL, "CLUI", "BottomClientMargin", SETTING_BOTTOMCLIENTMARIGN_DEFAULT);
}
- if (g_CluiData.fDisableSkinEngine) return 0;
+ if (g_CluiData.fDisableSkinEngine)
+ return 0;
Skin->pMaskList = (LISTMODERNMASK*)mir_alloc(sizeof(LISTMODERNMASK));
memset(Skin->pMaskList, 0, sizeof(LISTMODERNMASK));
@@ -2063,31 +2035,29 @@ static int ske_GetSkinFromDB(char *, SKINOBJECTSLIST *Skin)
Skin->szSkinPlace = mir_tstrdup(_T("%Default%"));
ske_LoadSkinFromResource(bOnlyObjects);
}
- //Load objects
- {
- DBCONTACTENUMSETTINGS dbces;
- pCurrentSkin = Skin;
- dbces.pfnEnumProc = ske_enumdb_SkinObjectsProc;
- dbces.szModule = SKIN;
- dbces.ofsSettings = 0;
- CallService(MS_DB_CONTACT_ENUMSETTINGS, 0, (LPARAM)&dbces);
- SortMaskList(pCurrentSkin->pMaskList);
- ske_LinkSkinObjects(pCurrentSkin);
- }
- //Load Masks
+ // Load objects
+ DBCONTACTENUMSETTINGS dbces;
+ pCurrentSkin = Skin;
+ dbces.pfnEnumProc = ske_enumdb_SkinObjectsProc;
+ dbces.szModule = SKIN;
+ dbces.ofsSettings = 0;
+ CallService(MS_DB_CONTACT_ENUMSETTINGS, 0, (LPARAM)&dbces);
+
+ SortMaskList(pCurrentSkin->pMaskList);
+ ske_LinkSkinObjects(pCurrentSkin);
+
+ // Load Masks
return 0;
}
-//surrogate to be called from outside
+// surrogate to be called from outside
void ske_LoadSkinFromDB(void)
{
ske_GetSkinFromDB(SKIN, &g_SkinObjectList);
g_CluiData.dwKeyColor = db_get_dw(NULL, "ModernSettings", "KeyColor", (DWORD)SETTING_KEYCOLOR_DEFAULT);
}
-//
-
static int ske_LoadSkinFromResource(BOOL bOnlyObjects)
{
IniParser parser(g_hInst, MAKEINTRESOURCEA(IDR_MSF_DEFAULT_SKIN), "MSF", bOnlyObjects ? IniParser::FLAG_ONLY_OBJECTS : IniParser::FLAG_WITH_SETTINGS);
@@ -2100,7 +2070,7 @@ static int ske_LoadSkinFromResource(BOOL bOnlyObjects)
return 0;
}
-//Load data from ini file
+// Load data from ini file
int ske_LoadSkinFromIniFile(TCHAR *szFileName, BOOL bOnlyObjects)
{
if (_tcschr(szFileName, _T('%')))
@@ -2145,7 +2115,7 @@ static int ske_DeleteAllSettingInSection(char * SectionName)
CallService(MS_DB_CONTACT_ENUMSETTINGS, 0, (LPARAM)&dbces);
- //delete all settings
+ // delete all settings
if (nArrayLen == 0)
return 0;
@@ -2289,7 +2259,7 @@ static bool ske_DrawTextEffect(BYTE* destPt, BYTE* maskPt, DWORD width, DWORD he
gd = GetGValue(effect->EffectColor2);
bd = GetBValue(effect->EffectColor2);
- //Fill buffer by mid values of image
+ // Fill buffer by mid values of image
for (y = 0; y < height; y++) {
bufline = buf + y*width;
maskline = maskPt + ((y*width) << 2);
@@ -2306,7 +2276,7 @@ static bool ske_DrawTextEffect(BYTE* destPt, BYTE* maskPt, DWORD width, DWORD he
maskline += 4;
}
}
- //Here perform effect on buffer and place results to outbuf
+ // Here perform effect on buffer and place results to outbuf
for (k = 0; k < (effectCount & 0x7F); k++) {
minX = max(0, minX + mcLeftStart - 2);
minY = max(0, minY + mcTopStart - 2);
@@ -2646,7 +2616,6 @@ INT_PTR ske_Service_DrawTextWithEffect(WPARAM wParam, LPARAM)
BOOL ske_DrawText(HDC hdc, LPCTSTR lpString, int nCount, RECT *lpRect, UINT format)
{
- DWORD form = 0, color = 0;
RECT r = *lpRect;
OffsetRect(&r, 1, 1);
if (format & DT_RTLREADING)
@@ -2654,10 +2623,10 @@ BOOL ske_DrawText(HDC hdc, LPCTSTR lpString, int nCount, RECT *lpRect, UINT form
if (format & DT_CALCRECT)
return DrawText(hdc, lpString, nCount, lpRect, format);
if (format & DT_FORCENATIVERENDER || g_CluiData.fDisableSkinEngine)
- return DrawText(hdc, lpString, nCount, lpRect, format&~DT_FORCENATIVERENDER);
+ return DrawText(hdc, lpString, nCount, lpRect, format & ~DT_FORCENATIVERENDER);
- form = format;
- color = GetTextColor(hdc);
+ DWORD form = format;
+ DWORD color = GetTextColor(hdc);
return ske_AlphaTextOut(hdc, lpString, nCount, lpRect, form, color);
}
@@ -2668,15 +2637,15 @@ HICON ske_ImageList_GetIcon(HIMAGELIST himl, int i)
if (i != -1) {
ImageList_GetImageInfo(himl, i, &imi);
GetObject(imi.hbmImage, sizeof(bm), &bm);
- if (bm.bmBitsPixel == 32) //stupid bug of Microsoft
- // Icons bitmaps are not premultiplied
- // So Imagelist_AddIcon - premultiply alpha
- // But incorrect - it is possible that alpha will
- // be less than color and
- // ImageList_GetIcon will return overflowed colors
- // TODO: Direct draw Icon from imagelist without
- // extracting of icon
- {
+ // stupid bug of Microsoft
+ // Icons bitmaps are not premultiplied
+ // So Imagelist_AddIcon - premultiply alpha
+ // But incorrect - it is possible that alpha will
+ // be less than color and
+ // ImageList_GetIcon will return overflowed colors
+ // TODO: Direct draw Icon from imagelist without
+ // extracting of icon
+ if (bm.bmBitsPixel == 32) {
BYTE *bits = (BYTE*)bm.bmBits;
if (!bits) {
bits = (BYTE*)malloc(bm.bmWidthBytes*bm.bmHeight);
@@ -2760,9 +2729,7 @@ BOOL ske_DrawIconEx(HDC hdcDst, int xLeft, int yTop, HICON hIcon, int cxWidth, i
BYTE alpha = (BYTE)((diFlags & 0xFF000000) >> 24);
HBITMAP tBmp = NULL;
- BITMAP imbt, immaskbt;
BYTE *imbits, *imimagbits, *immaskbits;
- DWORD cx, cy, icy;
BYTE *t1, *t2, *t3;
//lockimagelist
@@ -2775,14 +2742,17 @@ BOOL ske_DrawIconEx(HDC hdcDst, int xLeft, int yTop, HICON hIcon, int cxWidth, i
if (!GetIconInfo(hIcon, &ici))
return 0;
+ BITMAP imbt;
GetObject(ici.hbmColor, sizeof(BITMAP), &imbt);
if (imbt.bmWidth*imbt.bmHeight == 0) {
DeleteObject(ici.hbmColor);
DeleteObject(ici.hbmMask);
return 0;
}
+
+ BITMAP immaskbt;
GetObject(ici.hbmMask, sizeof(BITMAP), &immaskbt);
- cy = imbt.bmHeight;
+ DWORD cy = imbt.bmHeight;
if (imbt.bmBitsPixel != 32) {
no32bit = TRUE;
@@ -2794,7 +2764,6 @@ BOOL ske_DrawIconEx(HDC hdcDst, int xLeft, int yTop, HICON hIcon, int cxWidth, i
DrawIconEx(tempDC1, 0, 0, hIcon, imbt.bmWidth, imbt.bmHeight, istepIfAniCur, hbrFlickerFreeDraw, DI_IMAGE);
noMirrorMask = TRUE;
SelectObject(tempDC1, otBmp);
-
}
DeleteDC(tempDC1);
}
@@ -2804,8 +2773,7 @@ BOOL ske_DrawIconEx(HDC hdcDst, int xLeft, int yTop, HICON hIcon, int cxWidth, i
imimagbits = (BYTE*)malloc(cy*imbt.bmWidthBytes);
GetBitmapBits(ici.hbmColor, cy*imbt.bmWidthBytes, (void*)imimagbits);
}
- else
- imimagbits = (BYTE*)imbt.bmBits;
+ else imimagbits = (BYTE*)imbt.bmBits;
if (immaskbt.bmBits == NULL) {
immaskbits = (BYTE*)malloc(cy*immaskbt.bmWidthBytes);
@@ -2813,9 +2781,9 @@ BOOL ske_DrawIconEx(HDC hdcDst, int xLeft, int yTop, HICON hIcon, int cxWidth, i
}
else immaskbits = (BYTE*)immaskbt.bmBits;
- icy = imbt.bmHeight;
- cx = imbt.bmWidth;
HDC imDC = CreateCompatibleDC(hdcDst);
+ DWORD icy = imbt.bmHeight;
+ DWORD cx = imbt.bmWidth;
HBITMAP imBmp = ske_CreateDIB32Point(cx, icy, (void**)&imbits);
HBITMAP oldBmp = (HBITMAP)SelectObject(imDC, imBmp);
if (imbits != NULL && imimagbits != NULL && immaskbits != NULL) {
@@ -2928,7 +2896,6 @@ static INT_PTR ske_Service_UpdateFrameImage(WPARAM wParam, LPARAM) //
return 0;
RECT wnd;
- FRAMEWND *frm;
BOOL NoCancelPost = 0;
BOOL IsAnyQueued = 0;
if (!g_CluiData.mutexOnEdgeSizing)
@@ -2946,7 +2913,7 @@ static INT_PTR ske_Service_UpdateFrameImage(WPARAM wParam, LPARAM) //
else if (wParam == 0) ske_ValidateFrameImageProc(&wnd);
else { // all Ok Update Single Frame
// TO BE LOCKED OR PROXIED
- frm = FindFrameByItsHWND((HWND)wParam);
+ FRAMEWND *frm = FindFrameByItsHWND((HWND)wParam);
if (!frm)
ske_ValidateFrameImageProc(&wnd);
// Validate frame, update window image and remove it from queue
@@ -2974,6 +2941,7 @@ static INT_PTR ske_Service_UpdateFrameImage(WPARAM wParam, LPARAM) //
}
return 1;
}
+
static INT_PTR ske_Service_InvalidateFrameImage(WPARAM wParam, LPARAM lParam) // Post request for updating
{
if (MirandaLoading()) return 0;
@@ -3032,11 +3000,8 @@ static int ske_ValidateSingleFrameImage(FRAMEWND * Frame, BOOL SkipBkgBlitting)
if (Frame->hWnd == (HWND)-1 && !Frame->PaintCallbackProc) { TRACE("ske_ValidateSingleFrameImage calling without FrameProc\n"); return 0; }
// if ok update image
- HDC hdc;
- HBITMAP o, n;
RECT rcPaint, wnd;
RECT ru = { 0 };
- int w, h, x, y;
int w1, h1, x1, y1;
CLUI_SizingGetWindowRect(pcli->hwndContactList, &wnd);
@@ -3055,78 +3020,75 @@ static int ske_ValidateSingleFrameImage(FRAMEWND * Frame, BOOL SkipBkgBlitting)
rcPaint.bottom = wnd.bottom + by;
}
}
- //OffsetRect(&rcPaint,-wnd.left,-wnd.top);
- w = rcPaint.right - rcPaint.left;
- h = rcPaint.bottom - rcPaint.top;
+
+ int w = rcPaint.right - rcPaint.left;
+ int h = rcPaint.bottom - rcPaint.top;
if (w <= 0 || h <= 0) {
TRACE("Frame size smaller than 0\n");
return 0;
}
- x = rcPaint.left;
- y = rcPaint.top;
- hdc = CreateCompatibleDC(g_pCachedWindow->hImageDC);
- n = ske_CreateDIB32(w, h);
- o = (HBITMAP)SelectObject(hdc, n);
- {
- if (Frame->UpdateRgn && !SkipBkgBlitting) {
- GetRgnBox(Frame->UpdateRgn, &ru);
- {
- RECT rc;
- GetClientRect(Frame->hWnd, &rc);
- if (ru.top < 0) ru.top = 0;
- if (ru.left < 0) ru.left = 0;
- if (ru.right > rc.right) ru.right = rc.right;
- if (ru.bottom > rc.bottom) ru.bottom = rc.bottom;
- }
- if (!IsRectEmpty(&ru)) {
- x1 = ru.left;
- y1 = ru.top;
- w1 = ru.right - ru.left;
- h1 = ru.bottom - ru.top;
- }
- else {
- x1 = 0; y1 = 0; w1 = w; h1 = h;
- }
- // copy image at hdc
- if (SkipBkgBlitting) //image already at foreground
- {
- BitBlt(hdc, x1, y1, w1, h1, g_pCachedWindow->hImageDC, x + x1, y + y1, SRCCOPY);
- }
- else {
- BitBlt(hdc, x1, y1, w1, h1, g_pCachedWindow->hBackDC, x + x1, y + y1, SRCCOPY);
- }
- Frame->PaintCallbackProc(Frame->hWnd, hdc, &ru, Frame->UpdateRgn, Frame->dwFlags, Frame->PaintData);
+ int x = rcPaint.left;
+ int y = rcPaint.top;
+ HDC hdc = CreateCompatibleDC(g_pCachedWindow->hImageDC);
+ HBITMAP n = ske_CreateDIB32(w, h);
+ HBITMAP o = (HBITMAP)SelectObject(hdc, n);
+
+ if (Frame->UpdateRgn && !SkipBkgBlitting) {
+ GetRgnBox(Frame->UpdateRgn, &ru);
+ {
+ RECT rc;
+ GetClientRect(Frame->hWnd, &rc);
+ if (ru.top < 0) ru.top = 0;
+ if (ru.left < 0) ru.left = 0;
+ if (ru.right > rc.right) ru.right = rc.right;
+ if (ru.bottom > rc.bottom) ru.bottom = rc.bottom;
+ }
+ if (!IsRectEmpty(&ru)) {
+ x1 = ru.left;
+ y1 = ru.top;
+ w1 = ru.right - ru.left;
+ h1 = ru.bottom - ru.top;
}
else {
- HRGN rgnUpdate;
- RECT r;
- GetClientRect(Frame->hWnd, &r);
- rgnUpdate = CreateRectRgn(r.left, r.top, r.right, r.bottom);
- ru = r;
- if (!IsRectEmpty(&ru)) {
- x1 = ru.left;
- y1 = ru.top;
- w1 = ru.right - ru.left;
- h1 = ru.bottom - ru.top;
- }
- else {
- x1 = 0; y1 = 0; w1 = w; h1 = h;
- }
- // copy image at hdc
- if (SkipBkgBlitting) //image already at foreground
- {
- BitBlt(hdc, x1, y1, w1, h1, g_pCachedWindow->hImageDC, x + x1, y + y1, SRCCOPY);
- }
- else {
- BitBlt(hdc, x1, y1, w1, h1, g_pCachedWindow->hBackDC, x + x1, y + y1, SRCCOPY);
- }
- Frame->PaintCallbackProc(Frame->hWnd, hdc, &r, rgnUpdate, Frame->dwFlags, Frame->PaintData);
- ru = r;
- DeleteObject(rgnUpdate);
+ x1 = 0; y1 = 0; w1 = w; h1 = h;
+ }
+
+ // copy image at hdc
+ if (SkipBkgBlitting) //image already at foreground
+ BitBlt(hdc, x1, y1, w1, h1, g_pCachedWindow->hImageDC, x + x1, y + y1, SRCCOPY);
+ else
+ BitBlt(hdc, x1, y1, w1, h1, g_pCachedWindow->hBackDC, x + x1, y + y1, SRCCOPY);
+
+ Frame->PaintCallbackProc(Frame->hWnd, hdc, &ru, Frame->UpdateRgn, Frame->dwFlags, Frame->PaintData);
+ }
+ else {
+ RECT r;
+ GetClientRect(Frame->hWnd, &r);
+ HRGN rgnUpdate = CreateRectRgn(r.left, r.top, r.right, r.bottom);
+ ru = r;
+ if (!IsRectEmpty(&ru)) {
+ x1 = ru.left;
+ y1 = ru.top;
+ w1 = ru.right - ru.left;
+ h1 = ru.bottom - ru.top;
+ }
+ else {
+ x1 = 0; y1 = 0; w1 = w; h1 = h;
}
- DeleteObject(Frame->UpdateRgn);
- Frame->UpdateRgn = 0;
+
+ // copy image at hdc
+ if (SkipBkgBlitting) //image already at foreground
+ BitBlt(hdc, x1, y1, w1, h1, g_pCachedWindow->hImageDC, x + x1, y + y1, SRCCOPY);
+ else
+ BitBlt(hdc, x1, y1, w1, h1, g_pCachedWindow->hBackDC, x + x1, y + y1, SRCCOPY);
+
+ Frame->PaintCallbackProc(Frame->hWnd, hdc, &r, rgnUpdate, Frame->dwFlags, Frame->PaintData);
+ ru = r;
+ DeleteObject(rgnUpdate);
}
+ DeleteObject(Frame->UpdateRgn);
+ Frame->UpdateRgn = 0;
+
if (!IsRectEmpty(&ru)) {
x1 = ru.left;
y1 = ru.top;
@@ -3204,7 +3166,6 @@ int ske_BltBackImage(HWND destHWND, HDC destDC, RECT *BltClientRect)
}
int ske_ReCreateBackImage(BOOL Erase, RECT *w)
{
- HBITMAP hb2;
RECT wnd = { 0 };
BOOL IsNewCache = 0;
if (g_CluiData.fDisableSkinEngine) return 0;
@@ -3250,7 +3211,7 @@ int ske_ReCreateBackImage(BOOL Erase, RECT *w)
}
if ((Erase || IsNewCache) && (g_pCachedWindow->Width != 0 && g_pCachedWindow->Height != 0)) {
- hb2 = ske_CreateDIB32(g_pCachedWindow->Width, g_pCachedWindow->Height);
+ HBITMAP hb2 = ske_CreateDIB32(g_pCachedWindow->Width, g_pCachedWindow->Height);
SelectObject(g_pCachedWindow->hBackDC, hb2);
DeleteObject(g_pCachedWindow->hBackDIB);
g_pCachedWindow->hBackDIB = hb2;
@@ -3658,8 +3619,7 @@ static void ske_AddParseSkinFont(char * szFontID, char * szDefineString)
else
mir_free(sf);
}
- else
- mir_free(sf);
+ else mir_free(sf);
}
/*
@@ -3747,8 +3707,6 @@ static DWORD ske_Blend(DWORD X1, DWORD X2, BYTE alpha)
HICON ske_CreateJoinedIcon(HICON hBottom, HICON hTop, BYTE alpha)
{
- HBITMAP nMask;
- BYTE *ptPixels;
ICONINFO iNew = { 0 };
ICONINFO iciBottom = { 0 };
ICONINFO iciTop = { 0 };
@@ -3760,6 +3718,8 @@ HICON ske_CreateJoinedIcon(HICON hBottom, HICON hTop, BYTE alpha)
BITMAP bmp_bottom_mask = { 0 };
HDC tempDC = CreateCompatibleDC(NULL);
+
+ BYTE *ptPixels;
HBITMAP nImage = ske_CreateDIB32Point(16, 16, (void**)&ptPixels);
HBITMAP oImage = (HBITMAP)SelectObject(tempDC, nImage);
@@ -3866,7 +3826,7 @@ HICON ske_CreateJoinedIcon(HICON hBottom, HICON hTop, BYTE alpha)
DeleteDC(tempDC);
BYTE p[32] = { 0 };
- nMask = CreateBitmap(16, 16, 1, 1, (void*)&p);
+ HBITMAP nMask = CreateBitmap(16, 16, 1, 1, (void*)&p);
{
HDC tempDC2 = CreateCompatibleDC(NULL);
HDC tempDC3 = CreateCompatibleDC(NULL);
@@ -3902,7 +3862,7 @@ HICON ske_CreateJoinedIcon(HICON hBottom, HICON hTop, BYTE alpha)
#define SKINSETSECTION "SkinnedSettings"
-BOOL SkinDBGetContactSetting(MCONTACT hContact, const char* szSection, const char*szKey, DBVARIANT * retdbv, BOOL * bSkinned)
+BOOL SkinDBGetContactSetting(MCONTACT hContact, const char *szSection, const char *szKey, DBVARIANT *retdbv, BOOL *bSkinned)
{
if (!hContact) { //only for not contact settings
char *szSkinKey;
@@ -3917,7 +3877,7 @@ BOOL SkinDBGetContactSetting(MCONTACT hContact, const char* szSection, const cha
return db_get(hContact, szSection, szKey, retdbv);
}
-BYTE SkinDBGetContactSettingByte(MCONTACT hContact, const char* szSection, const char*szKey, BYTE bDefault)
+BYTE SkinDBGetContactSettingByte(MCONTACT hContact, const char *szSection, const char *szKey, BYTE bDefault)
{
DBVARIANT dbv = { 0 };
BOOL bSkinned = FALSE;
@@ -3936,7 +3896,7 @@ BYTE SkinDBGetContactSettingByte(MCONTACT hContact, const char* szSection, const
return bDefault;
}
-WORD SkinDBGetContactSettingWord(MCONTACT hContact, const char* szSection, const char*szKey, WORD wDefault)
+WORD SkinDBGetContactSettingWord(MCONTACT hContact, const char *szSection, const char *szKey, WORD wDefault)
{
BOOL bSkinned = FALSE;
DBVARIANT dbv = { 0 };
@@ -3953,7 +3913,7 @@ WORD SkinDBGetContactSettingWord(MCONTACT hContact, const char* szSection, const
return wDefault;
}
-DWORD SkinDBGetContactSettingDword(MCONTACT hContact, const char* szSection, const char*szKey, DWORD dwDefault)
+DWORD SkinDBGetContactSettingDword(MCONTACT hContact, const char *szSection, const char *szKey, DWORD dwDefault)
{
DBVARIANT dbv = { 0 };
BOOL bSkinned = FALSE;