32
32
#endif
33
33
34
34
const 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;
36
37
static int g_LastTaskbar=MAIN_TASK_BAR;
37
38
static int g_NextTaskbar=0 ;
38
39
HWND g_TaskBar, g_OwnerWindow;
@@ -67,7 +68,7 @@ static RECT g_TaskbarMargins;
67
68
int g_CurrentCSMTaskbar=-1 , g_CurrentWSMTaskbar=-1 ;
68
69
69
70
static void FindWindowsMenu ( void );
70
- static void RecreateStartButton ( int taskbarId );
71
+ static void RecreateStartButton ( size_t taskbarId );
71
72
static bool WindowsMenuOpened ( void );
72
73
73
74
static tSetWindowCompositionAttribute SetWindowCompositionAttribute;
@@ -302,7 +303,7 @@ class COwnerWindow: public CWindowImpl<COwnerWindow>
302
303
if (LOWORD (wParam)!=WA_INACTIVE)
303
304
return 0 ;
304
305
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))
306
307
return 0 ;
307
308
308
309
// check if another menu window is being activated
@@ -390,37 +391,37 @@ static const TaskbarInfo *GetDefaultTaskbarInfo( void )
390
391
if (GetSettingBool (L" AllTaskbars" ))
391
392
{
392
393
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)
394
395
{
395
396
MONITORINFO info;
396
397
HMONITOR monitor2=NULL ;
397
398
if (GetTaskbarPosition (it->second .taskBar ,&info,&monitor2,NULL )!=0xFFFFFFFF && monitor2==monitor)
398
399
return &it->second ;
399
400
}
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);
401
402
if (it!=g_TaskbarInfos.end ())
402
403
return &it->second ;
403
404
}
404
405
return &g_TaskbarInfos.begin ()->second ;
405
406
}
406
407
407
- TaskbarInfo *GetTaskbarInfo ( int taskbarId )
408
+ TaskbarInfo *GetTaskbarInfo ( size_t taskbarId )
408
409
{
409
- std::map<int ,TaskbarInfo>::iterator it=g_TaskbarInfos.find (taskbarId);
410
+ std::map<size_t ,TaskbarInfo>::iterator it=g_TaskbarInfos.find (taskbarId);
410
411
return (it==g_TaskbarInfos.end ())?NULL :&it->second ;
411
412
}
412
413
413
414
static TaskbarInfo *FindTaskBarInfoButton ( HWND button )
414
415
{
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)
416
417
if (it->second .startButton ==button || it->second .oldButton ==button)
417
418
return &it->second ;
418
419
return NULL ;
419
420
}
420
421
421
422
static TaskbarInfo *FindTaskBarInfoBar ( HWND bar )
422
423
{
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)
424
425
if (it->second .taskBar ==bar)
425
426
return &it->second ;
426
427
return NULL ;
@@ -694,7 +695,7 @@ UINT GetTaskbarPosition( HWND taskBar, MONITORINFO *pInfo, HMONITOR *pMonitor, R
694
695
}
695
696
696
697
// 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 )
698
699
{
699
700
const TaskbarInfo *taskBar=GetTaskbarInfo (taskbarId);
700
701
if (!taskBar || !taskBar->startButton ) return false ;
@@ -708,7 +709,7 @@ bool PointAroundStartButton( int taskbarId, const CPoint &pt )
708
709
GetWindowRect (taskBar->startButton ,&rc);
709
710
if (uEdge==ABE_LEFT || uEdge==ABE_RIGHT)
710
711
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)
712
713
return pt.x >rc.left ;
713
714
else
714
715
return pt.x <rc.right ;
@@ -752,7 +753,7 @@ void ResetHotCorners( void )
752
753
753
754
void RedrawTaskbars ( void )
754
755
{
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)
756
757
InvalidateRect (it->second .taskBar ,NULL ,TRUE );
757
758
}
758
759
@@ -828,7 +829,7 @@ class CMonitorModeEvents: public IAppVisibilityEvents
828
829
HMONITOR monitor;
829
830
if (SUCCEEDED (pMonitor->GetHandle (&monitor)))
830
831
{
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)
832
833
{
833
834
if (monitor==MonitorFromWindow (it->second .taskBar ,MONITOR_DEFAULTTONULL))
834
835
{
@@ -1046,7 +1047,7 @@ static LRESULT CALLBACK HookAppManager( int code, WPARAM wParam, LPARAM lParam )
1046
1047
return CallNextHookEx (NULL ,code,wParam,lParam);
1047
1048
typedef BOOL (WINAPI *tGetWindowBand)(HWND,DWORD*);
1048
1049
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)
1050
1051
{
1051
1052
DWORD band;
1052
1053
if (!GetWindowBand || !GetWindowBand (it->second .taskBar ,&band) || band==1 )
@@ -1091,7 +1092,7 @@ static LRESULT CALLBACK HookAppManager( int code, WPARAM wParam, LPARAM lParam )
1091
1092
}
1092
1093
if (corner==1 )
1093
1094
{
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)
1095
1096
{
1096
1097
UINT uEdge=GetTaskbarPosition (it->second .taskBar ,NULL ,NULL ,NULL );
1097
1098
if (uEdge==ABE_BOTTOM)
@@ -1739,9 +1740,9 @@ static LRESULT CALLBACK SubclassTaskBarProc( HWND hWnd, UINT uMsg, WPARAM wParam
1739
1740
else
1740
1741
{
1741
1742
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))
1743
1744
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))
1745
1746
zPos=HWND_TOP;
1746
1747
if (zPos==HWND_BOTTOM)
1747
1748
buttonFlags|=SWP_NOZORDER;
@@ -1762,7 +1763,7 @@ static LRESULT CALLBACK SubclassTaskBarProc( HWND hWnd, UINT uMsg, WPARAM wParam
1762
1763
}
1763
1764
else
1764
1765
{
1765
- if (GetWindowLong (taskBar->rebar ,GWL_EXSTYLE)&WS_EX_LAYOUTRTL)
1766
+ if (GetWindowLongPtr (taskBar->rebar ,GWL_EXSTYLE)&WS_EX_LAYOUTRTL)
1766
1767
x=rcTask.right -taskBar->startButtonSize .cx ;
1767
1768
else
1768
1769
x=rcTask.left ;
@@ -2386,7 +2387,7 @@ void UpdateTaskBars( TUpdateTaskbar update )
2386
2387
DeleteDC (hdc);
2387
2388
}
2388
2389
}
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)
2390
2391
RedrawWindow (it->second .taskBar ,NULL ,NULL ,RDW_INVALIDATE|RDW_ALLCHILDREN);
2391
2392
}
2392
2393
return ;
@@ -2406,7 +2407,7 @@ void UpdateTaskBars( TUpdateTaskbar update )
2406
2407
}
2407
2408
if (g_bTrimHooks)
2408
2409
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)
2410
2411
{
2411
2412
TaskbarInfo &taskBar=it->second ;
2412
2413
bool bButton2=bButton && (bAll || taskBar.taskBar ==g_TaskBar);
@@ -2550,7 +2551,7 @@ void UpdateTaskBars( TUpdateTaskbar update )
2550
2551
}
2551
2552
}
2552
2553
}
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)
2554
2555
{
2555
2556
TaskbarInfo &taskBar=it->second ;
2556
2557
SendMessage (taskBar.taskBar ,WM_SETTINGCHANGE,0 ,0 );
@@ -3006,9 +3007,9 @@ if (!g_bTrimHooks)
3006
3007
UpdateTaskBars (TASKBAR_UPDATE_TEXTURE);
3007
3008
}
3008
3009
3009
- static void RecreateStartButton ( int taskbarId )
3010
+ static void RecreateStartButton ( size_t taskbarId )
3010
3011
{
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)
3012
3013
{
3013
3014
TaskbarInfo &taskBar=it->second ;
3014
3015
if (taskbarId>=0 && taskBar.taskbarId !=taskbarId)
@@ -3133,7 +3134,7 @@ static void CleanStartMenuDLL( void )
3133
3134
ResetHotCorners ();
3134
3135
UpdateTaskBars (TASKBAR_CLEAR);
3135
3136
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)
3137
3138
{
3138
3139
if (it->second .rebar )
3139
3140
RemoveWindowSubclass (it->second .rebar ,SubclassRebarProc,' CLSH' );
0 commit comments