3232#endif
3333
3434const int MAIN_TASK_BAR=0 ;
35- std::map<int ,TaskbarInfo> g_TaskbarInfos;
35+ typedef std::map<size_t ,TaskbarInfo> id_taskbar_map;
36+ id_taskbar_map g_TaskbarInfos;
3637static int g_LastTaskbar=MAIN_TASK_BAR;
3738static int g_NextTaskbar=0 ;
3839HWND g_TaskBar, g_OwnerWindow;
@@ -67,7 +68,7 @@ static RECT g_TaskbarMargins;
6768int g_CurrentCSMTaskbar=-1 , g_CurrentWSMTaskbar=-1 ;
6869
6970static void FindWindowsMenu ( void );
70- static void RecreateStartButton ( int taskbarId );
71+ static void RecreateStartButton ( size_t taskbarId );
7172static bool WindowsMenuOpened ( void );
7273
7374static tSetWindowCompositionAttribute SetWindowCompositionAttribute;
@@ -302,7 +303,7 @@ class COwnerWindow: public CWindowImpl<COwnerWindow>
302303 if (LOWORD (wParam)!=WA_INACTIVE)
303304 return 0 ;
304305
305- if (CMenuContainer::s_bPreventClosing && lParam && (::GetWindowLong ((HWND)lParam,GWL_EXSTYLE)&WS_EX_TOPMOST))
306+ if (CMenuContainer::s_bPreventClosing && lParam && (::GetWindowLongPtr ((HWND)lParam,GWL_EXSTYLE)&WS_EX_TOPMOST))
306307 return 0 ;
307308
308309 // check if another menu window is being activated
@@ -390,37 +391,37 @@ static const TaskbarInfo *GetDefaultTaskbarInfo( void )
390391 if (GetSettingBool (L" AllTaskbars" ))
391392 {
392393 HMONITOR monitor=MonitorFromPoint (CPoint (GetMessagePos ()),MONITOR_DEFAULTTONEAREST);
393- for (std::map<int ,TaskbarInfo>::const_iterator it=g_TaskbarInfos.begin ();it!=g_TaskbarInfos.end ();++it)
394+ for (std::map<size_t ,TaskbarInfo>::const_iterator it=g_TaskbarInfos.begin ();it!=g_TaskbarInfos.end ();++it)
394395 {
395396 MONITORINFO info;
396397 HMONITOR monitor2=NULL ;
397398 if (GetTaskbarPosition (it->second .taskBar ,&info,&monitor2,NULL )!=0xFFFFFFFF && monitor2==monitor)
398399 return &it->second ;
399400 }
400- std::map< int ,TaskbarInfo> ::const_iterator it=g_TaskbarInfos.find (g_LastTaskbar);
401+ id_taskbar_map ::const_iterator it=g_TaskbarInfos.find (g_LastTaskbar);
401402 if (it!=g_TaskbarInfos.end ())
402403 return &it->second ;
403404 }
404405 return &g_TaskbarInfos.begin ()->second ;
405406}
406407
407- TaskbarInfo *GetTaskbarInfo ( int taskbarId )
408+ TaskbarInfo *GetTaskbarInfo ( size_t taskbarId )
408409{
409- std::map<int ,TaskbarInfo>::iterator it=g_TaskbarInfos.find (taskbarId);
410+ std::map<size_t ,TaskbarInfo>::iterator it=g_TaskbarInfos.find (taskbarId);
410411 return (it==g_TaskbarInfos.end ())?NULL :&it->second ;
411412}
412413
413414static TaskbarInfo *FindTaskBarInfoButton ( HWND button )
414415{
415- for (std::map< int ,TaskbarInfo> ::iterator it=g_TaskbarInfos.begin ();it!=g_TaskbarInfos.end ();++it)
416+ for (id_taskbar_map ::iterator it=g_TaskbarInfos.begin ();it!=g_TaskbarInfos.end ();++it)
416417 if (it->second .startButton ==button || it->second .oldButton ==button)
417418 return &it->second ;
418419 return NULL ;
419420}
420421
421422static TaskbarInfo *FindTaskBarInfoBar ( HWND bar )
422423{
423- for (std::map< int ,TaskbarInfo> ::iterator it=g_TaskbarInfos.begin ();it!=g_TaskbarInfos.end ();++it)
424+ for (id_taskbar_map ::iterator it=g_TaskbarInfos.begin ();it!=g_TaskbarInfos.end ();++it)
424425 if (it->second .taskBar ==bar)
425426 return &it->second ;
426427 return NULL ;
@@ -694,7 +695,7 @@ UINT GetTaskbarPosition( HWND taskBar, MONITORINFO *pInfo, HMONITOR *pMonitor, R
694695}
695696
696697// Returns true if the mouse is on the taskbar portion of the start button
697- bool PointAroundStartButton ( int taskbarId, const CPoint &pt )
698+ bool PointAroundStartButton ( size_t taskbarId, const CPoint &pt )
698699{
699700 const TaskbarInfo *taskBar=GetTaskbarInfo (taskbarId);
700701 if (!taskBar || !taskBar->startButton ) return false ;
@@ -708,7 +709,7 @@ bool PointAroundStartButton( int taskbarId, const CPoint &pt )
708709 GetWindowRect (taskBar->startButton ,&rc);
709710 if (uEdge==ABE_LEFT || uEdge==ABE_RIGHT)
710711 return pt.y <rc.bottom ;
711- else if (GetWindowLong (taskBar->taskBar ,GWL_EXSTYLE)&WS_EX_LAYOUTRTL)
712+ else if (GetWindowLongPtr (taskBar->taskBar ,GWL_EXSTYLE)&WS_EX_LAYOUTRTL)
712713 return pt.x >rc.left ;
713714 else
714715 return pt.x <rc.right ;
@@ -752,7 +753,7 @@ void ResetHotCorners( void )
752753
753754void RedrawTaskbars ( void )
754755{
755- for (std::map< int ,TaskbarInfo> ::const_iterator it=g_TaskbarInfos.begin ();it!=g_TaskbarInfos.end ();++it)
756+ for (id_taskbar_map ::const_iterator it=g_TaskbarInfos.begin ();it!=g_TaskbarInfos.end ();++it)
756757 InvalidateRect (it->second .taskBar ,NULL ,TRUE );
757758}
758759
@@ -828,7 +829,7 @@ class CMonitorModeEvents: public IAppVisibilityEvents
828829 HMONITOR monitor;
829830 if (SUCCEEDED (pMonitor->GetHandle (&monitor)))
830831 {
831- for (std::map< int ,TaskbarInfo> ::const_iterator it=g_TaskbarInfos.begin ();it!=g_TaskbarInfos.end ();++it)
832+ for (id_taskbar_map ::const_iterator it=g_TaskbarInfos.begin ();it!=g_TaskbarInfos.end ();++it)
832833 {
833834 if (monitor==MonitorFromWindow (it->second .taskBar ,MONITOR_DEFAULTTONULL))
834835 {
@@ -1046,7 +1047,7 @@ static LRESULT CALLBACK HookAppManager( int code, WPARAM wParam, LPARAM lParam )
10461047 return CallNextHookEx (NULL ,code,wParam,lParam);
10471048 typedef BOOL (WINAPI *tGetWindowBand)(HWND,DWORD*);
10481049 static tGetWindowBand GetWindowBand=(tGetWindowBand)GetProcAddress (GetModuleHandle (L" user32.dll" )," GetWindowBand" );
1049- for (std::map< int ,TaskbarInfo> ::const_iterator it=g_TaskbarInfos.begin ();it!=g_TaskbarInfos.end ();++it)
1050+ for (id_taskbar_map ::const_iterator it=g_TaskbarInfos.begin ();it!=g_TaskbarInfos.end ();++it)
10501051 {
10511052 DWORD band;
10521053 if (!GetWindowBand || !GetWindowBand (it->second .taskBar ,&band) || band==1 )
@@ -1091,7 +1092,7 @@ static LRESULT CALLBACK HookAppManager( int code, WPARAM wParam, LPARAM lParam )
10911092 }
10921093 if (corner==1 )
10931094 {
1094- for (std::map< int ,TaskbarInfo> ::const_iterator it=g_TaskbarInfos.begin ();it!=g_TaskbarInfos.end ();++it)
1095+ for (id_taskbar_map ::const_iterator it=g_TaskbarInfos.begin ();it!=g_TaskbarInfos.end ();++it)
10951096 {
10961097 UINT uEdge=GetTaskbarPosition (it->second .taskBar ,NULL ,NULL ,NULL );
10971098 if (uEdge==ABE_BOTTOM)
@@ -1739,9 +1740,9 @@ static LRESULT CALLBACK SubclassTaskBarProc( HWND hWnd, UINT uMsg, WPARAM wParam
17391740 else
17401741 {
17411742 zPos=pPos->hwndInsertAfter ;
1742- if (zPos==HWND_TOP && !(GetWindowLong (taskBar->startButton ,GWL_EXSTYLE)&WS_EX_TOPMOST))
1743+ if (zPos==HWND_TOP && !(GetWindowLongPtr (taskBar->startButton ,GWL_EXSTYLE)&WS_EX_TOPMOST))
17431744 zPos=HWND_TOPMOST;
1744- if (zPos==HWND_TOPMOST && !(GetWindowLong (hWnd,GWL_EXSTYLE)&WS_EX_TOPMOST))
1745+ if (zPos==HWND_TOPMOST && !(GetWindowLongPtr (hWnd,GWL_EXSTYLE)&WS_EX_TOPMOST))
17451746 zPos=HWND_TOP;
17461747 if (zPos==HWND_BOTTOM)
17471748 buttonFlags|=SWP_NOZORDER;
@@ -1762,7 +1763,7 @@ static LRESULT CALLBACK SubclassTaskBarProc( HWND hWnd, UINT uMsg, WPARAM wParam
17621763 }
17631764 else
17641765 {
1765- if (GetWindowLong (taskBar->rebar ,GWL_EXSTYLE)&WS_EX_LAYOUTRTL)
1766+ if (GetWindowLongPtr (taskBar->rebar ,GWL_EXSTYLE)&WS_EX_LAYOUTRTL)
17661767 x=rcTask.right -taskBar->startButtonSize .cx ;
17671768 else
17681769 x=rcTask.left ;
@@ -2386,7 +2387,7 @@ void UpdateTaskBars( TUpdateTaskbar update )
23862387 DeleteDC (hdc);
23872388 }
23882389 }
2389- for (std::map< int ,TaskbarInfo> ::iterator it=g_TaskbarInfos.begin ();it!=g_TaskbarInfos.end ();++it)
2390+ for (id_taskbar_map ::iterator it=g_TaskbarInfos.begin ();it!=g_TaskbarInfos.end ();++it)
23902391 RedrawWindow (it->second .taskBar ,NULL ,NULL ,RDW_INVALIDATE|RDW_ALLCHILDREN);
23912392 }
23922393 return ;
@@ -2406,7 +2407,7 @@ void UpdateTaskBars( TUpdateTaskbar update )
24062407 }
24072408 if (g_bTrimHooks)
24082409 bButton=false ;
2409- for (std::map< int ,TaskbarInfo> ::iterator it=g_TaskbarInfos.begin ();it!=g_TaskbarInfos.end ();++it)
2410+ for (id_taskbar_map ::iterator it=g_TaskbarInfos.begin ();it!=g_TaskbarInfos.end ();++it)
24102411 {
24112412 TaskbarInfo &taskBar=it->second ;
24122413 bool bButton2=bButton && (bAll || taskBar.taskBar ==g_TaskBar);
@@ -2550,7 +2551,7 @@ void UpdateTaskBars( TUpdateTaskbar update )
25502551 }
25512552 }
25522553 }
2553- for (std::map< int ,TaskbarInfo> ::iterator it=g_TaskbarInfos.begin ();it!=g_TaskbarInfos.end ();++it)
2554+ for (id_taskbar_map ::iterator it=g_TaskbarInfos.begin ();it!=g_TaskbarInfos.end ();++it)
25542555 {
25552556 TaskbarInfo &taskBar=it->second ;
25562557 SendMessage (taskBar.taskBar ,WM_SETTINGCHANGE,0 ,0 );
@@ -3006,9 +3007,9 @@ if (!g_bTrimHooks)
30063007 UpdateTaskBars (TASKBAR_UPDATE_TEXTURE);
30073008}
30083009
3009- static void RecreateStartButton ( int taskbarId )
3010+ static void RecreateStartButton ( size_t taskbarId )
30103011{
3011- for (std::map< int ,TaskbarInfo> ::iterator it=g_TaskbarInfos.begin ();it!=g_TaskbarInfos.end ();++it)
3012+ for (id_taskbar_map ::iterator it=g_TaskbarInfos.begin ();it!=g_TaskbarInfos.end ();++it)
30123013 {
30133014 TaskbarInfo &taskBar=it->second ;
30143015 if (taskbarId>=0 && taskBar.taskbarId !=taskbarId)
@@ -3133,7 +3134,7 @@ static void CleanStartMenuDLL( void )
31333134 ResetHotCorners ();
31343135 UpdateTaskBars (TASKBAR_CLEAR);
31353136 g_WinStartButton=NULL ;
3136- for (std::map< int ,TaskbarInfo> ::const_iterator it=g_TaskbarInfos.begin ();it!=g_TaskbarInfos.end ();++it)
3137+ for (id_taskbar_map ::const_iterator it=g_TaskbarInfos.begin ();it!=g_TaskbarInfos.end ();++it)
31373138 {
31383139 if (it->second .rebar )
31393140 RemoveWindowSubclass (it->second .rebar ,SubclassRebarProc,' CLSH' );
0 commit comments