diff options
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/AVS/src/main.cpp | 18 | ||||
-rw-r--r-- | plugins/BasicHistory/src/Scheduler.cpp | 39 | ||||
-rw-r--r-- | plugins/Clist_modern/src/hdr/modern_commonprototypes.h | 8 | ||||
-rw-r--r-- | plugins/Clist_modern/src/hdr/modern_static_clui.h | 9 | ||||
-rw-r--r-- | plugins/Clist_modern/src/modern_aniavatars.cpp | 74 | ||||
-rw-r--r-- | plugins/Clist_modern/src/modern_awaymsg.cpp | 29 | ||||
-rw-r--r-- | plugins/Clist_modern/src/modern_clui.cpp | 111 | ||||
-rw-r--r-- | plugins/Clist_modern/src/modern_gettextasync.cpp | 4 | ||||
-rw-r--r-- | plugins/PackUpdater/Src/Common.h | 4 | ||||
-rw-r--r-- | plugins/PackUpdater/Src/Events.cpp | 4 | ||||
-rw-r--r-- | plugins/PackUpdater/Src/PackUpdater.cpp | 4 | ||||
-rw-r--r-- | plugins/PackUpdater/Src/Utils.cpp | 22 | ||||
-rw-r--r-- | plugins/PluginUpdater/src/Common.h | 2 | ||||
-rw-r--r-- | plugins/PluginUpdater/src/PluginUpdater.cpp | 4 | ||||
-rw-r--r-- | plugins/PluginUpdater/src/Scanner.cpp | 10 | ||||
-rw-r--r-- | plugins/PluginUpdater/src/Utils.cpp | 2 | ||||
-rw-r--r-- | plugins/Quotes/src/Forex.cpp | 3 |
17 files changed, 153 insertions, 194 deletions
diff --git a/plugins/AVS/src/main.cpp b/plugins/AVS/src/main.cpp index 7e21146fca..2cc5b49c40 100644 --- a/plugins/AVS/src/main.cpp +++ b/plugins/AVS/src/main.cpp @@ -33,7 +33,7 @@ static long hwndSetMyAvatar = 0; static HANDLE hMyAvatarsFolder;
static HANDLE hGlobalAvatarFolder;
-static HANDLE hLoaderEvent, hLoaderThread;
+static HANDLE hLoaderEvent;
HANDLE hEventChanged, hEventContactAvatarChanged, hMyAvatarChanged;
HICON g_hIcon = 0;
@@ -1986,8 +1986,7 @@ static int ModulesLoaded(WPARAM wParam, LPARAM lParam) mir_sntprintf(szEventName, 100, _T("avs_loaderthread_%d"), GetCurrentThreadId());
hLoaderEvent = CreateEvent(NULL, TRUE, FALSE, szEventName);
- hLoaderThread = (HANDLE) mir_forkthread(PicLoader, 0);
- SetThreadPriority(hLoaderThread, THREAD_PRIORITY_IDLE);
+ SetThreadPriority( mir_forkthread(PicLoader, 0), THREAD_PRIORITY_IDLE);
// Folders plugin support
hMyAvatarsFolder = FoldersRegisterCustomPathT(LPGEN("Avatars"), LPGEN("My Avatars"), MIRANDA_USERDATAT _T("\\Avatars"));
@@ -2004,17 +2003,16 @@ static int ModulesLoaded(WPARAM wParam, LPARAM lParam) PROTOACCOUNT **accs = NULL;
int accCount;
- ProtoEnumAccounts( &accCount, &accs );
+ ProtoEnumAccounts(&accCount, &accs);
- if ( fei != NULL )
- {
+ if ( fei != NULL ) {
LoadDefaultInfo();
PROTOCOLDESCRIPTOR** proto;
int protoCount;
CallService(MS_PROTO_ENUMPROTOS, ( WPARAM )&protoCount, ( LPARAM )&proto);
- for ( i=0; i < protoCount; i++ )
+ for (i=0; i < protoCount; i++ )
LoadProtoInfo( proto[i] );
- for(i = 0; i < accCount; i++)
+ for (i=0; i < accCount; i++)
LoadAccountInfo( accs[i] );
}
@@ -2048,9 +2046,9 @@ static void ReloadMyAvatar(LPVOID lpParam) continue;
}
- } else if (lstrcmpA(myAvatarProto, szProto)) {
- continue;
}
+ else if (lstrcmpA(myAvatarProto, szProto))
+ continue;
if (g_MyAvatars[i].hbmPic)
DeleteObject(g_MyAvatars[i].hbmPic);
diff --git a/plugins/BasicHistory/src/Scheduler.cpp b/plugins/BasicHistory/src/Scheduler.cpp index 3b2ba18ab9..a317a7dac4 100644 --- a/plugins/BasicHistory/src/Scheduler.cpp +++ b/plugins/BasicHistory/src/Scheduler.cpp @@ -40,8 +40,8 @@ time_t GetNextExportTime(TaskOptions& to); void SchedulerThreadFunc(void*);
volatile bool finishThread = false;
bool initTask = false;
-HANDLE thread = NULL;
-HANDLE threadEvent;
+HANDLE hThread = NULL;
+HANDLE hThreadEvent;
time_t nextExportTime;
void StartThread(bool init);
void StopThread();
@@ -856,24 +856,21 @@ void SchedulerThreadFunc(void*) {
if(initTask)
{
- WaitForSingleObject(threadEvent, 5 * 1000);
+ WaitForSingleObject(hThreadEvent, 5 * 1000);
initTask = false;
}
- while(!finishThread)
- {
+ while(!finishThread) {
DWORD timeWait;
time_t now = time(NULL);
while(nextExportTime <= now)
- {
if(!ExecuteCurrentTask(now))
return;
- }
time_t dif = nextExportTime - now;
timeWait = (dif > 60 * 60 * 24) ? (60 * 60 * 1000) : (60 * 1000);
- WaitForSingleObject(threadEvent, timeWait);
+ WaitForSingleObject(hThreadEvent, timeWait);
}
}
@@ -883,26 +880,24 @@ void StartThread(bool init) initTask = false;
bool isExport = GetNextExportTime(init, time(NULL));
- if(isExport)
- {
+ if(isExport) {
finishThread = false;
- threadEvent = CreateEvent(NULL, TRUE, FALSE, NULL);
- thread = mir_forkthread(SchedulerThreadFunc, NULL);
+ hThreadEvent = CreateEvent(NULL, TRUE, FALSE, NULL);
+ hThread = mir_forkthread(SchedulerThreadFunc, NULL);
}
}
void StopThread()
{
- if(thread != NULL)
- {
- finishThread = true;
- SetEvent(threadEvent);
- WaitForSingleObject(thread, INFINITE);
- //CloseHandle(thread);
- CloseHandle(threadEvent);
- thread = NULL;
- threadEvent = NULL;
- }
+ if(hThread == NULL)
+ return;
+
+ finishThread = true;
+ SetEvent(hThreadEvent);
+ WaitForSingleObject(hThread, INFINITE);
+ CloseHandle(hThreadEvent);
+ hThread = NULL;
+ hThreadEvent = NULL;
}
bool GetNextExportTime(bool init, time_t now)
diff --git a/plugins/Clist_modern/src/hdr/modern_commonprototypes.h b/plugins/Clist_modern/src/hdr/modern_commonprototypes.h index efbb035932..69516c1d5d 100644 --- a/plugins/Clist_modern/src/hdr/modern_commonprototypes.h +++ b/plugins/Clist_modern/src/hdr/modern_commonprototypes.h @@ -67,12 +67,8 @@ extern BOOL g_bTransparentFlag; extern HINSTANCE g_hInst;
extern HIMAGELIST hCListImages;
extern BOOL g_mutex_bChangingMode;
-extern DWORD g_dwMainThreadID;
-extern DWORD g_dwAwayMsgThreadID;
-extern DWORD g_dwGetTextAsyncThreadID;
-extern DWORD g_dwSmoothAnimationThreadID;
-extern DWORD g_dwFillFontListThreadID;
-extern HWND g_hwndViewModeFrame;
+extern UINT g_dwMainThreadID, g_dwAwayMsgThreadID, g_dwGetTextAsyncThreadID, g_dwSmoothAnimationThreadID;
+extern HWND g_hwndViewModeFrame;
extern HANDLE hSmileyAddOptionsChangedHook,hAvatarChanged,hIconChangedHook;
extern BYTE gl_TrimText;
diff --git a/plugins/Clist_modern/src/hdr/modern_static_clui.h b/plugins/Clist_modern/src/hdr/modern_static_clui.h index 7a7d205f14..22925fc4d2 100644 --- a/plugins/Clist_modern/src/hdr/modern_static_clui.h +++ b/plugins/Clist_modern/src/hdr/modern_static_clui.h @@ -105,11 +105,10 @@ int UnhookAll(); /* Global variables */ -DWORD g_dwMainThreadID=0, - g_dwAwayMsgThreadID=0, - g_dwGetTextAsyncThreadID=0, - g_dwSmoothAnimationThreadID=0, - g_dwFillFontListThreadID=0; +UINT g_dwMainThreadID = 0, + g_dwAwayMsgThreadID = 0, + g_dwGetTextAsyncThreadID = 0, + g_dwSmoothAnimationThreadID = 0; HMENU g_hMenuMain; BOOL g_bTransparentFlag=FALSE; diff --git a/plugins/Clist_modern/src/modern_aniavatars.cpp b/plugins/Clist_modern/src/modern_aniavatars.cpp index ad35b6f3fd..7c92ae4b18 100644 --- a/plugins/Clist_modern/src/modern_aniavatars.cpp +++ b/plugins/Clist_modern/src/modern_aniavatars.cpp @@ -148,7 +148,7 @@ typedef struct _tagAniAva int width;
int height;
SortedList * AniAvatarList;
- DWORD AnimationThreadID;
+ UINT AnimationThreadID;
HANDLE AnimationThreadHandle;
HANDLE hExitEvent;
//Objects
@@ -166,7 +166,6 @@ static void _AniAva_PausePainting(); static void _AniAva_ResumePainting();
static void _AniAva_LoadOptions();
static void _AniAva_ReduceAvatarImages(int startY, int dY, BOOL bDestroyWindow);
-static void _AniAva_AnimationTreadProc(HANDLE hExitEvent);
static void _AniAva_RemoveAniAvaDC(ANIAVA * pAniAva);
static void _AniAva_RealRemoveAvatar(DWORD UniqueID);
static int _AniAva_LoadAvatarFromImage(TCHAR * szFileName, int width, int height, ANIAVATARIMAGEINFO * pRetAII);
@@ -188,6 +187,36 @@ int _AniAva_OnModulesUnload(WPARAM wParam,LPARAM lParam) return 0;
}
+static unsigned __stdcall _AniAva_AnimationTreadProc(HANDLE hExitEvent)
+{
+ //wait forever till hExitEvent signalled
+ DWORD rc;
+ HANDLE hThread = 0;
+ DuplicateHandle(GetCurrentProcess(),GetCurrentThread(),GetCurrentProcess(),&hThread, 0, FALSE,DUPLICATE_SAME_ACCESS);
+ AniAva.AnimationThreadHandle = hThread;
+ SetThreadPriority(hThread,THREAD_PRIORITY_LOWEST);
+ for (;;) {
+ if ( fnMsgWaitForMultipleObjectsEx )
+ rc = fnMsgWaitForMultipleObjectsEx(1,&hExitEvent, INFINITE, QS_ALLINPUT, MWMO_ALERTABLE);
+ else
+ rc = MsgWaitForMultipleObjects(1,&hExitEvent, FALSE, INFINITE, QS_ALLINPUT);
+
+ ResetEvent(hExitEvent);
+ if (rc == WAIT_OBJECT_0 + 1) {
+ MSG msg;
+ while ( PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) {
+ if ( IsDialogMessage(msg.hwnd, &msg)) continue;
+ TranslateMessage(&msg);
+ DispatchMessage(&msg);
+ }
+ }
+ else if ( rc == WAIT_OBJECT_0 )
+ break;
+ }
+ CloseHandle(AniAva.AnimationThreadHandle);
+ AniAva.AnimationThreadHandle = NULL;
+ return 0;
+}
// Init AniAva module
int AniAva_InitModule()
@@ -197,14 +226,11 @@ int AniAva_InitModule() if ( !( db_get_b(NULL,"CList","AvatarsAnimated",( ServiceExists(MS_AV_GETAVATARBITMAP) && !g_CluiData.fGDIPlusFail))
&& db_get_b(NULL,"CList","AvatarsShow",SETTINGS_SHOWAVATARS_DEFAULT))) return 0;
{
- WNDCLASSEX wc;
- ZeroMemory(&wc, sizeof(wc));
- wc.cbSize = sizeof(wc);
+ WNDCLASSEX wc = { sizeof(wc) };
wc.lpszClassName = ANIAVAWINDOWCLASS;
wc.lpfnWndProc = _AniAva_WndProc;
wc.hCursor = LoadCursor(NULL, IDC_ARROW);
wc.cbWndExtra = sizeof(ANIAVA_WINDOWINFO*);
- wc.hbrBackground = 0;
wc.style = CS_GLOBALCLASS;
RegisterClassEx(&wc);
}
@@ -214,7 +240,7 @@ int AniAva_InitModule() AniAva.AniAvatarList->sortFunc = _AniAva_SortAvatarInfo;
AniAva.bModuleStarted = TRUE;
AniAva.hExitEvent = CreateEvent(NULL,FALSE,FALSE,NULL);
- AniAva.AnimationThreadID = (DWORD)mir_forkthread(_AniAva_AnimationTreadProc, (void*)AniAva.hExitEvent);
+ mir_forkthreadex(_AniAva_AnimationTreadProc, AniAva.hExitEvent, &AniAva.AnimationThreadID);
HookEvent(ME_SYSTEM_PRESHUTDOWN, _AniAva_OnModulesUnload);
_AniAva_LoadOptions();
@@ -1029,40 +1055,6 @@ static void _AniAva_LoadOptions() }
aaunlock;
}
-static void _AniAva_AnimationTreadProc(HANDLE hExitEvent)
-{
- //wait forever till hExitEvent signalled
- DWORD rc;
- HANDLE hThread = 0;
- DuplicateHandle(GetCurrentProcess(),GetCurrentThread(),GetCurrentProcess(),&hThread, 0, FALSE,DUPLICATE_SAME_ACCESS);
- AniAva.AnimationThreadHandle = hThread;
- SetThreadPriority(hThread,THREAD_PRIORITY_LOWEST);
- for (;;)
- {
- if ( fnMsgWaitForMultipleObjectsEx )
- rc = fnMsgWaitForMultipleObjectsEx(1,&hExitEvent, INFINITE, QS_ALLINPUT, MWMO_ALERTABLE);
- else
- rc = MsgWaitForMultipleObjects(1,&hExitEvent, FALSE, INFINITE, QS_ALLINPUT);
-
- ResetEvent(hExitEvent);
- if ( rc == WAIT_OBJECT_0 + 1 )
- {
- MSG msg;
- while ( PeekMessage(&msg, NULL, 0, 0, PM_REMOVE))
- {
- if ( IsDialogMessage(msg.hwnd, &msg)) continue;
- TranslateMessage(&msg);
- DispatchMessage(&msg);
- }
- }
- else if ( rc == WAIT_OBJECT_0 )
- {
- break;
- }
- }
- CloseHandle(AniAva.AnimationThreadHandle);
- AniAva.AnimationThreadHandle = NULL;
-}
static int _AniAva_SortAvatarInfo(void * first, void * last)
{
diff --git a/plugins/Clist_modern/src/modern_awaymsg.cpp b/plugins/Clist_modern/src/modern_awaymsg.cpp index a03e61bec2..4c6241c18e 100644 --- a/plugins/Clist_modern/src/modern_awaymsg.cpp +++ b/plugins/Clist_modern/src/modern_awaymsg.cpp @@ -53,7 +53,6 @@ static DWORD amRequestTick = 0; static int amAddHandleToChain(HANDLE hContact);
static HANDLE amGetCurrentChain();
-static int amThreadProc(HWND hwnd);
/*
* Add contact handle to requests queue
@@ -116,7 +115,7 @@ static HANDLE amGetCurrentChain() /*
* Tread sub to ask protocol to retrieve away message
*/
-static int amThreadProc(HWND hwnd)
+static unsigned __stdcall amThreadProc(void *)
{
DWORD time;
HANDLE hContact;
@@ -127,14 +126,11 @@ static int amThreadProc(HWND hwnd) while (!MirandaExiting())
{
hContact = amGetCurrentChain();
- while (hContact)
- {
+ while (hContact) {
time = GetTickCount();
- if ((time-amRequestTick) < AMASKPERIOD)
- {
+ if ((time-amRequestTick) < AMASKPERIOD) {
SleepEx(AMASKPERIOD-(time-amRequestTick)+10, TRUE);
- if (MirandaExiting())
- {
+ if (MirandaExiting()) {
g_dwAwayMsgThreadID = 0;
return 0;
}
@@ -144,8 +140,7 @@ static int amThreadProc(HWND hwnd) Sync(CLUI_SyncGetPDNCE, (WPARAM) 0, (LPARAM)&dnce);
if (dnce.ApparentMode != ID_STATUS_OFFLINE) //don't ask if contact is always invisible (should be done with protocol)
ACK = (HANDLE)CallContactService(hContact,PSS_GETAWAYMSG, 0, 0);
- if ( !ACK)
- {
+ if ( !ACK) {
ACKDATA ack;
ack.hContact = hContact;
ack.type = ACKTYPE_AWAYMSG;
@@ -159,18 +154,16 @@ static int amThreadProc(HWND hwnd) CListSettings_FreeCacheItemData(&dnce);
amRequestTick = time;
hContact = amGetCurrentChain();
- if (hContact)
- {
+ if (hContact) {
DWORD i=0;
- do
- {
+ do {
i++;
SleepEx(50, TRUE);
- } while (i < AMASKPERIOD/50 && !MirandaExiting());
+ }
+ while (i < AMASKPERIOD/50 && !MirandaExiting());
}
else break;
- if (MirandaExiting())
- {
+ if (MirandaExiting()) {
g_dwAwayMsgThreadID = 0;
return 0;
}
@@ -216,7 +209,7 @@ void InitAwayMsgModule() {
InitializeCriticalSection(&amLockChain);
hamProcessEvent = CreateEvent(NULL,FALSE,FALSE,NULL);
- g_dwAwayMsgThreadID = (DWORD)mir_forkthread((pThreadFunc)amThreadProc,0);
+ mir_forkthreadex(amThreadProc, 0, &g_dwAwayMsgThreadID);
}
void UninitAwayMsgModule()
diff --git a/plugins/Clist_modern/src/modern_clui.cpp b/plugins/Clist_modern/src/modern_clui.cpp index f1e57fa4fc..cb072264db 100644 --- a/plugins/Clist_modern/src/modern_clui.cpp +++ b/plugins/Clist_modern/src/modern_clui.cpp @@ -516,8 +516,7 @@ static BOOL CLUI_WaitThreadsCompletion(HWND hwnd) g_CluiData.mutexPaintLock ||
g_dwAwayMsgThreadID ||
g_dwGetTextAsyncThreadID ||
- g_dwSmoothAnimationThreadID ||
- g_dwFillFontListThreadID) && !Miranda_Terminated())
+ g_dwSmoothAnimationThreadID) && !Miranda_Terminated())
{
TRACE("Waiting threads");
TRACEVAR("g_mutex_nCalcRowHeightLock: %x",g_mutex_nCalcRowHeightLock);
@@ -525,7 +524,7 @@ static BOOL CLUI_WaitThreadsCompletion(HWND hwnd) TRACEVAR("g_dwAwayMsgThreadID: %x",g_dwAwayMsgThreadID);
TRACEVAR("g_dwGetTextAsyncThreadID: %x",g_dwGetTextAsyncThreadID);
TRACEVAR("g_dwSmoothAnimationThreadID: %x",g_dwSmoothAnimationThreadID);
- TRACEVAR("g_dwFillFontListThreadID: %x",g_dwFillFontListThreadID);
+
bEntersCount++;
SleepEx(10, TRUE);
return TRUE;
@@ -1293,11 +1292,6 @@ int CLUI_SyncGetShortData(WPARAM wParam, LPARAM lParam) return ClcGetShortData(dat,(struct SHORTDATA *)lParam);
}
-int CLUI_SyncSmoothAnimation(WPARAM wParam, LPARAM lParam)
-{
- return CLUI_SmoothAlphaThreadTransition((HWND)lParam);
-}
-
int CLUI_IconsChanged(WPARAM wParam,LPARAM lParam)
{
if (MirandaExiting())
@@ -1451,33 +1445,37 @@ int CLUI_SizingOnBorder(POINT pt, int PerformSize) }
return SCF_NONE;
}
-int CLUI_SyncSmoothAnimation(WPARAM wParam, LPARAM lParam);
-static void CLUI_SmoothAnimationThreadProc(HWND hwnd)
+
+static int CLUI_SyncSmoothAnimation(WPARAM wParam, LPARAM lParam)
{
- // return;
- if ( !mutex_bAnimationInProgress)
- {
+ return CLUI_SmoothAlphaThreadTransition((HWND)lParam);
+}
+
+static unsigned __stdcall CLUI_SmoothAnimationThreadProc(void *param)
+{
+ if ( !mutex_bAnimationInProgress) {
g_dwSmoothAnimationThreadID = 0;
- return; /// Should be some locked to avoid painting against contact deletion.
+ return 0; /// Should be some locked to avoid painting against contact deletion.
}
- do
- {
- if ( !g_mutex_bLockUpdating)
- {
+
+ do {
+ if ( !g_mutex_bLockUpdating) {
if ( !MirandaExiting())
- Sync(CLUI_SyncSmoothAnimation, 0, (LPARAM)hwnd );
+ Sync(CLUI_SyncSmoothAnimation, 0, (LPARAM)param);
+
SleepEx(20, TRUE);
- if (MirandaExiting())
- {
+ if (MirandaExiting()) {
g_dwSmoothAnimationThreadID = 0;
- return;
+ return 0;
}
}
else SleepEx(0, TRUE);
- } while (mutex_bAnimationInProgress);
+ }
+ while (mutex_bAnimationInProgress);
+
g_dwSmoothAnimationThreadID = 0;
- return;
+ return 0;
}
static int CLUI_SmoothAlphaThreadTransition(HWND hwnd)
@@ -1551,14 +1549,13 @@ int CLUI_SmoothAlphaTransition(HWND hwnd, BYTE GoalAlpha, BOOL wParam) }
return 0;
}
- if (mutex_bShowHideCalledFromAnimation) return 0;
- if (wParam != 2) //not from timer
- {
+ if (mutex_bShowHideCalledFromAnimation)
+ return 0;
+
+ if (wParam != 2) { //not from timer
bAlphaEnd = GoalAlpha;
- if ( !mutex_bAnimationInProgress)
- {
- if ((!IsWindowVisible(hwnd) || g_CluiData.bCurrentAlpha == 0) && bAlphaEnd>0 )
- {
+ if ( !mutex_bAnimationInProgress) {
+ if ((!IsWindowVisible(hwnd) || g_CluiData.bCurrentAlpha == 0) && bAlphaEnd > 0) {
mutex_bShowHideCalledFromAnimation = 1;
CLUI_ShowWindowMod(pcli->hwndContactList,SW_SHOWNA);
Sync(CLUIFrames_OnShowHide, hwnd,SW_SHOW);
@@ -1566,47 +1563,37 @@ int CLUI_SmoothAlphaTransition(HWND hwnd, BYTE GoalAlpha, BOOL wParam) g_CluiData.bCurrentAlpha = 1;
ske_UpdateWindowImage();
}
- if (IsWindowVisible(hwnd) && !g_dwSmoothAnimationThreadID)
- {
+ if (IsWindowVisible(hwnd) && !g_dwSmoothAnimationThreadID) {
mutex_bAnimationInProgress = 1;
if (g_CluiData.fSmoothAnimation)
- g_dwSmoothAnimationThreadID = (DWORD)mir_forkthread((pThreadFunc)CLUI_SmoothAnimationThreadProc,pcli->hwndContactList);
-
+ mir_forkthreadex(CLUI_SmoothAnimationThreadProc, pcli->hwndContactList, &g_dwSmoothAnimationThreadID);
}
}
}
- {
- int step;
- int a;
- step = (g_CluiData.bCurrentAlpha>bAlphaEnd)?-1*ANIMATION_STEP:ANIMATION_STEP;
- a = g_CluiData.bCurrentAlpha+step;
- if ((step >= 0 && a >= bAlphaEnd) || (step <= 0 && a <= bAlphaEnd) || g_CluiData.bCurrentAlpha == bAlphaEnd || !g_CluiData.fSmoothAnimation) //stop animation;
- {
- KillTimer(hwnd,TM_SMOTHALPHATRANSITION);
- mutex_bAnimationInProgress = 0;
- if (bAlphaEnd == 0)
- {
- g_CluiData.bCurrentAlpha = 1;
- ske_UpdateWindowImage();
- mutex_bShowHideCalledFromAnimation = 1;
- CLUI_ShowWindowMod(pcli->hwndContactList,0);
- Sync(CLUIFrames_OnShowHide, pcli->hwndContactList,0);
- mutex_bShowHideCalledFromAnimation = 0;
- g_CluiData.bCurrentAlpha = 0;
- }
- else
- {
- g_CluiData.bCurrentAlpha = bAlphaEnd;
- ske_UpdateWindowImage();
- }
+ int step = (g_CluiData.bCurrentAlpha>bAlphaEnd) ? -1*ANIMATION_STEP : ANIMATION_STEP;
+ int a = g_CluiData.bCurrentAlpha+step;
+ if ((step >= 0 && a >= bAlphaEnd) || (step <= 0 && a <= bAlphaEnd) || g_CluiData.bCurrentAlpha == bAlphaEnd || !g_CluiData.fSmoothAnimation) { //stop animation;
+ KillTimer(hwnd,TM_SMOTHALPHATRANSITION);
+ mutex_bAnimationInProgress = 0;
+ if (bAlphaEnd == 0) {
+ g_CluiData.bCurrentAlpha = 1;
+ ske_UpdateWindowImage();
+ mutex_bShowHideCalledFromAnimation = 1;
+ CLUI_ShowWindowMod(pcli->hwndContactList,0);
+ Sync(CLUIFrames_OnShowHide, pcli->hwndContactList,0);
+ mutex_bShowHideCalledFromAnimation = 0;
+ g_CluiData.bCurrentAlpha = 0;
}
- else
- {
- g_CluiData.bCurrentAlpha = a;
+ else {
+ g_CluiData.bCurrentAlpha = bAlphaEnd;
ske_UpdateWindowImage();
}
}
+ else {
+ g_CluiData.bCurrentAlpha = a;
+ ske_UpdateWindowImage();
+ }
return 0;
}
diff --git a/plugins/Clist_modern/src/modern_gettextasync.cpp b/plugins/Clist_modern/src/modern_gettextasync.cpp index 7ec2ca1c3c..1244e8b49c 100644 --- a/plugins/Clist_modern/src/modern_gettextasync.cpp +++ b/plugins/Clist_modern/src/modern_gettextasync.cpp @@ -76,7 +76,7 @@ static BOOL gtaGetItem(GTACHAINITEM * mpChain) return FALSE;
}
-static int gtaThreadProc(void * lpParam)
+static unsigned __stdcall gtaThreadProc(void * lpParam)
{
HWND hwnd = pcli->hwndContactList;
struct SHORTDATA data = {0};
@@ -178,7 +178,7 @@ void InitCacheAsync() {
InitializeCriticalSection(>aCS);
hgtaWakeupEvent = CreateEvent(NULL,FALSE,FALSE,NULL);
- g_dwGetTextAsyncThreadID = (DWORD)mir_forkthread((pThreadFunc)gtaThreadProc,0);
+ mir_forkthreadex(gtaThreadProc, 0, &g_dwGetTextAsyncThreadID);
HookEvent(ME_SYSTEM_PRESHUTDOWN, gtaOnModulesUnload);
}
diff --git a/plugins/PackUpdater/Src/Common.h b/plugins/PackUpdater/Src/Common.h index 5317428f06..881a558062 100644 --- a/plugins/PackUpdater/Src/Common.h +++ b/plugins/PackUpdater/Src/Common.h @@ -95,7 +95,7 @@ extern BYTE Reminder, UpdateOnStartup, UpdateOnPeriod, OnlyOnceADay, PeriodMeasu extern TCHAR tszRoot[MAX_PATH], tszDialogMsg[2048];
extern FILEINFO* pFileInfo;
extern FILEURL* pFileUrl;
-extern HANDLE CheckThread, hOnPreShutdown, hOptHook, hLoadHook;
+extern HANDLE hCheckThread, hOnPreShutdown, hOptHook, hLoadHook;
extern MYOPTIONS MyOptions;
extern aPopups PopupsList[POPUPS];
extern LPCTSTR Title, Text;
@@ -111,7 +111,7 @@ INT_PTR MenuCommand(WPARAM wParam,LPARAM lParam); INT_PTR EmptyFolder(WPARAM wParam,LPARAM lParam);
INT OnPreShutdown(WPARAM wParam, LPARAM lParam);
INT OptInit(WPARAM wParam, LPARAM lParam);
-VOID DoCheck(INT iFlag, INT iFlag2);
+VOID DoCheck(INT iFlag);
BOOL DownloadFile(LPCTSTR tszURL, LPCTSTR tszLocal);
VOID show_popup(HWND hDlg, LPCTSTR Title, LPCTSTR Text, INT Number, INT ActType);
VOID DlgDownloadProc();
diff --git a/plugins/PackUpdater/Src/Events.cpp b/plugins/PackUpdater/Src/Events.cpp index 85cd8ea63f..f1fd530493 100644 --- a/plugins/PackUpdater/Src/Events.cpp +++ b/plugins/PackUpdater/Src/Events.cpp @@ -38,7 +38,7 @@ int ModulesLoaded(WPARAM wParam, LPARAM lParam) Hotkey_Register(&hkd);
if (AllowUpdateOnStartup())
- DoCheck(UpdateOnStartup, (int)CheckThread);
+ DoCheck(UpdateOnStartup);
Timer = CreateWaitableTimer(NULL, FALSE, NULL);
InitTimer();
@@ -49,7 +49,7 @@ int ModulesLoaded(WPARAM wParam, LPARAM lParam) INT_PTR MenuCommand(WPARAM wParam,LPARAM lParam)
{
Silent = false;
- DoCheck(1, (int)CheckThread);
+ DoCheck(TRUE);
return 0;
}
diff --git a/plugins/PackUpdater/Src/PackUpdater.cpp b/plugins/PackUpdater/Src/PackUpdater.cpp index 24086278ab..ed5213062e 100644 --- a/plugins/PackUpdater/Src/PackUpdater.cpp +++ b/plugins/PackUpdater/Src/PackUpdater.cpp @@ -98,8 +98,8 @@ extern "C" __declspec(dllexport) int Load(void) extern "C" __declspec(dllexport) int Unload(void)
{
- if (CheckThread)
- CheckThread = NULL;
+ if (hCheckThread)
+ hCheckThread = NULL;
NetlibUnInit();
DestroyServiceFunction(hCheckUpdates);
DestroyServiceFunction(hEmptyFolder);
diff --git a/plugins/PackUpdater/Src/Utils.cpp b/plugins/PackUpdater/Src/Utils.cpp index 5e438cd934..f68f2ba46b 100644 --- a/plugins/PackUpdater/Src/Utils.cpp +++ b/plugins/PackUpdater/Src/Utils.cpp @@ -28,7 +28,7 @@ INT Period; TCHAR tszDialogMsg[2048] = {0};
FILEINFO* pFileInfo = NULL;
FILEURL* pFileUrl = NULL;
-HANDLE CheckThread = NULL, hNetlibUser = NULL;
+HANDLE hCheckThread = NULL, hNetlibUser = NULL;
MYOPTIONS MyOptions = {0};
aPopups PopupsList[POPUPS];
LPCTSTR Title = {0}, Text = {0};
@@ -210,7 +210,7 @@ static void CheckUpdates(void *) else if (DBGetContactSettingByte(NULL, MODNAME, "Popups1M", DEFAULT_MESSAGE_ENABLED))
MessageBox(NULL, Text, Title, MB_ICONSTOP);
DBFreeVariant(&dbVar);
- CheckThread = NULL;
+ hCheckThread = NULL;
return;
}
// Download version info
@@ -225,7 +225,7 @@ static void CheckUpdates(void *) mir_free(pFileUrl);
if (!DlgDld)
{
- CheckThread = NULL;
+ hCheckThread = NULL;
return;
}
@@ -304,7 +304,7 @@ static void CheckUpdates(void *) {
MessageBox(NULL, TranslateT("Update is not possible!\nYou have no Administrator's rights.\nPlease run Miranda NG with Administrator's rights."), Title, MB_ICONINFORMATION);
DeleteFile(tszTmpIni);
- CheckThread = NULL;
+ hCheckThread = NULL;
return;
} // user have not admin's rights
else
@@ -365,7 +365,7 @@ static void CheckUpdates(void *) DeleteFile(tszTmpIni);
if (upd_ret == IDCANCEL)
{
- CheckThread = NULL;
+ hCheckThread = NULL;
return;
}
if (!UpdatesCount && !Silent)
@@ -392,12 +392,12 @@ static void CheckUpdates(void *) else if (DBGetContactSettingByte(NULL, MODNAME, "Popups2M", DEFAULT_MESSAGE_ENABLED))
MessageBox(NULL, Text, Title, MB_ICONINFORMATION);
}
- CheckThread = NULL;
-}//end* static void CheckUpdates(void *)
+ hCheckThread = NULL;
+}
-void DoCheck(int iFlag, int iFlag2)
+void DoCheck(int iFlag)
{
- if (iFlag2)
+ if (hCheckThread != NULL)
{
Title = TranslateT("Pack Updater");
Text = TranslateT("Update checking already started!");
@@ -411,7 +411,7 @@ void DoCheck(int iFlag, int iFlag2) }
else if (iFlag)
{
- CheckThread = mir_forkthread(CheckUpdates, 0);
+ hCheckThread = mir_forkthread(CheckUpdates, 0);
DBWriteContactSettingDword(NULL, MODNAME, "LastUpdate", time(NULL));
}
}
@@ -451,7 +451,7 @@ LONG PeriodToMilliseconds(const INT period, BYTE& periodMeasure) VOID CALLBACK TimerAPCProc(LPVOID lpArg, DWORD dwTimerLowValue, DWORD dwTimerHighValue)
{
- DoCheck(1, (int)CheckThread);
+ DoCheck(TRUE);
}
VOID InitTimer()
diff --git a/plugins/PluginUpdater/src/Common.h b/plugins/PluginUpdater/src/Common.h index 33a5b031db..f0ffa25310 100644 --- a/plugins/PluginUpdater/src/Common.h +++ b/plugins/PluginUpdater/src/Common.h @@ -114,7 +114,7 @@ extern HINSTANCE hInst; extern TCHAR tszRoot[MAX_PATH], tszDialogMsg[2048], tszTempPath[MAX_PATH];
extern FILEINFO *pFileInfo;
-extern HANDLE CheckThread, hPluginUpdaterFolder;
+extern HANDLE hCheckThread, hPluginUpdaterFolder;
extern PlugOptions opts;
extern POPUP_OPTIONS PopupOptions;
extern aPopups PopupsList[POPUPS];
diff --git a/plugins/PluginUpdater/src/PluginUpdater.cpp b/plugins/PluginUpdater/src/PluginUpdater.cpp index 610d87e284..d0875df06c 100644 --- a/plugins/PluginUpdater/src/PluginUpdater.cpp +++ b/plugins/PluginUpdater/src/PluginUpdater.cpp @@ -131,8 +131,8 @@ extern "C" __declspec(dllexport) int Load(void) extern "C" __declspec(dllexport) int Unload(void)
{
- if (CheckThread)
- CheckThread = NULL;
+ if (hCheckThread)
+ hCheckThread = NULL;
NetlibUnInit();
DestroyServiceFunction(hCheckUpdates);
diff --git a/plugins/PluginUpdater/src/Scanner.cpp b/plugins/PluginUpdater/src/Scanner.cpp index 86c0acceb3..bb9f7e339b 100644 --- a/plugins/PluginUpdater/src/Scanner.cpp +++ b/plugins/PluginUpdater/src/Scanner.cpp @@ -297,7 +297,7 @@ static void CheckUpdates(void *) mir_sntprintf(pFileUrl.tszDiskPath, SIZEOF(pFileUrl.tszDiskPath), _T("%s\\hashes.zip"), tszTempPath);
if (!DownloadFile(pFileUrl.tszDownloadURL, pFileUrl.tszDiskPath, 0)) {
ShowPopup(0, LPGENT("Plugin Updater"), LPGENT("An error occured while downloading the update."), 1, 0);
- CheckThread = NULL;
+ hCheckThread = NULL;
return;
}
@@ -308,7 +308,7 @@ static void CheckUpdates(void *) mir_sntprintf(tszTmpIni, SIZEOF(tszTmpIni), _T("%s\\hashes.txt"), tszTempPath);
FILE *fp = _tfopen(tszTmpIni, _T("r"));
if (!fp) {
- CheckThread = NULL;
+ hCheckThread = NULL;
return;
}
@@ -351,12 +351,12 @@ static void CheckUpdates(void *) }
else CallFunctionAsync(LaunchDialog, UpdateFiles);
- CheckThread = NULL;
+ hCheckThread = NULL;
}
void DoCheck(int iFlag)
{
- if (CheckThread)
+ if (hCheckThread)
ShowPopup(0, LPGENT("Plugin Updater"), LPGENT("Update checking already started!"), 2, 0);
else if (hwndDialog) {
ShowWindow(hwndDialog, SW_SHOW);
@@ -364,7 +364,7 @@ void DoCheck(int iFlag) SetFocus(hwndDialog);
}
else if (iFlag) {
- CheckThread = mir_forkthread(CheckUpdates, 0);
+ hCheckThread = mir_forkthread(CheckUpdates, 0);
DBWriteContactSettingDword(NULL, MODNAME, "LastUpdate", time(NULL));
}
}
diff --git a/plugins/PluginUpdater/src/Utils.cpp b/plugins/PluginUpdater/src/Utils.cpp index 4d169825f2..bb2ee1380a 100644 --- a/plugins/PluginUpdater/src/Utils.cpp +++ b/plugins/PluginUpdater/src/Utils.cpp @@ -23,7 +23,7 @@ BOOL DlgDld; int Number = 0;
TCHAR tszDialogMsg[2048] = {0};
FILEINFO *pFileInfo = NULL;
-HANDLE CheckThread = NULL, hNetlibUser = NULL;
+HANDLE hCheckThread = NULL, hNetlibUser = NULL;
POPUP_OPTIONS PopupOptions = {0};
aPopups PopupsList[POPUPS];
diff --git a/plugins/Quotes/src/Forex.cpp b/plugins/Quotes/src/Forex.cpp index 8bc53324d2..be9da5bb35 100644 --- a/plugins/Quotes/src/Forex.cpp +++ b/plugins/Quotes/src/Forex.cpp @@ -243,8 +243,7 @@ namespace for(CQuotesProviders::TQuotesProviders::const_iterator i = rapProviders.begin();i != rapProviders.end();++i)
{
const CQuotesProviders::TQuotesProviderPtr& pProvider = *i;
- HANDLE hThread = reinterpret_cast<HANDLE>(mir_forkthread(WorkingThread,pProvider.get()));
- g_ahThreads.push_back(hThread);
+ g_ahThreads.push_back( mir_forkthread(WorkingThread, pProvider.get()));
}
}
|