Skip to content

Commit

Permalink
Change desktop number system to 1-based
Browse files Browse the repository at this point in the history
  • Loading branch information
RadAd committed Jan 31, 2022
1 parent 8a439dc commit ced2cd8
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 23 deletions.
36 changes: 18 additions & 18 deletions Skins/VirtualDesktopDemo/VirtualDesktop/VirtualDesktop.ini
Original file line number Diff line number Diff line change
Expand Up @@ -100,22 +100,13 @@ Y=-10r
W=100
MeterStyle=StyleText

[Desktop0]
Meter=Button
MeterStyle=StyleSolidButton
Group=DesktopButton
ButtonCommand=[!CommandMeasure MeasureVirtualDesktop "Switch 0"]
ToolTipText=[MeasureVirtualDesktop:Name(0)]
Hidden=([MeasureVirtualDesktopCount]<=0?)
DynamicVariables=1

[Desktop1]
Meter=Button
MeterStyle=StyleSolidButton
Group=DesktopButton
ButtonCommand=[!CommandMeasure MeasureVirtualDesktop "Switch 1"]
ToolTipText=[MeasureVirtualDesktop:Name(1)]
Hidden=([MeasureVirtualDesktopCount]<=1?)
Hidden=([MeasureVirtualDesktopCount]<1?)
DynamicVariables=1

[Desktop2]
Expand All @@ -124,7 +115,7 @@ MeterStyle=StyleSolidButton
Group=DesktopButton
ButtonCommand=[!CommandMeasure MeasureVirtualDesktop "Switch 2"]
ToolTipText=[MeasureVirtualDesktop:Name(2)]
Hidden=([MeasureVirtualDesktopCount]<=2?)
Hidden=([MeasureVirtualDesktopCount]<2?)
DynamicVariables=1

[Desktop3]
Expand All @@ -133,7 +124,7 @@ MeterStyle=StyleSolidButton
Group=DesktopButton
ButtonCommand=[!CommandMeasure MeasureVirtualDesktop "Switch 3"]
ToolTipText=[MeasureVirtualDesktop:Name(3)]
Hidden=([MeasureVirtualDesktopCount]<=3?)
Hidden=([MeasureVirtualDesktopCount]<3?)
DynamicVariables=1

[Desktop4]
Expand All @@ -142,7 +133,7 @@ MeterStyle=StyleSolidButton
Group=DesktopButton
ButtonCommand=[!CommandMeasure MeasureVirtualDesktop "Switch 4"]
ToolTipText=[MeasureVirtualDesktop:Name(4)]
Hidden=([MeasureVirtualDesktopCount]<=4?)
Hidden=([MeasureVirtualDesktopCount]<4?)
DynamicVariables=1

[Desktop5]
Expand All @@ -151,7 +142,7 @@ MeterStyle=StyleSolidButton
Group=DesktopButton
ButtonCommand=[!CommandMeasure MeasureVirtualDesktop "Switch 5"]
ToolTipText=[MeasureVirtualDesktop:Name(5)]
Hidden=([MeasureVirtualDesktopCount]<=5?)
Hidden=([MeasureVirtualDesktopCount]<5?)
DynamicVariables=1

[Desktop6]
Expand All @@ -160,7 +151,7 @@ MeterStyle=StyleSolidButton
Group=DesktopButton
ButtonCommand=[!CommandMeasure MeasureVirtualDesktop "Switch 6"]
ToolTipText=[MeasureVirtualDesktop:Name(6)]
Hidden=([MeasureVirtualDesktopCount]<=6?)
Hidden=([MeasureVirtualDesktopCount]<6?)
DynamicVariables=1

[Desktop7]
Expand All @@ -169,7 +160,7 @@ MeterStyle=StyleSolidButton
Group=DesktopButton
ButtonCommand=[!CommandMeasure MeasureVirtualDesktop "Switch 7"]
ToolTipText=[MeasureVirtualDesktop:Name(7)]
Hidden=([MeasureVirtualDesktopCount]<=7?)
Hidden=([MeasureVirtualDesktopCount]<7?)
DynamicVariables=1

[Desktop8]
Expand All @@ -178,7 +169,7 @@ MeterStyle=StyleSolidButton
Group=DesktopButton
ButtonCommand=[!CommandMeasure MeasureVirtualDesktop "Switch 8"]
ToolTipText=[MeasureVirtualDesktop:Name(8)]
Hidden=([MeasureVirtualDesktopCount]<=8?)
Hidden=([MeasureVirtualDesktopCount]<8?)
DynamicVariables=1

[Desktop9]
Expand All @@ -187,5 +178,14 @@ MeterStyle=StyleSolidButton
Group=DesktopButton
ButtonCommand=[!CommandMeasure MeasureVirtualDesktop "Switch 9"]
ToolTipText=[MeasureVirtualDesktop:Name(9)]
Hidden=([MeasureVirtualDesktopCount]<=9?)
Hidden=([MeasureVirtualDesktopCount]<9?)
DynamicVariables=1

[Desktop10]
Meter=Button
MeterStyle=StyleSolidButton
Group=DesktopButton
ButtonCommand=[!CommandMeasure MeasureVirtualDesktop "Switch 10"]
ToolTipText=[MeasureVirtualDesktop:Name(10)]
Hidden=([MeasureVirtualDesktopCount]<10?)
DynamicVariables=1
10 changes: 5 additions & 5 deletions src/VDUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ const CComPtr<IVirtualDesktopNotificationService>& GetVirtualNotificationService

const CComPtr<IVirtualDesktopManagerInternal>& GetDesktopManagerInternal(LogF* pLog, void* logdata)
{
static CComPtr<IVirtualDesktopManagerInternal> pDesktopManagerInternal;;
static CComPtr<IVirtualDesktopManagerInternal> pDesktopManagerInternal;
if (!pDesktopManagerInternal)
{
const CComPtr<IServiceProvider>& pServiceProvider = GetImmersiveShell(pLog, logdata);
Expand All @@ -62,7 +62,7 @@ const CComPtr<IVirtualDesktopManagerInternal>& GetDesktopManagerInternal(LogF* p

CComPtr<IVirtualDesktop> GetCurrentDesktop(LogF* pLog, void* logdata)
{
CComPtr<IVirtualDesktop> pCurrentDesktop;;
CComPtr<IVirtualDesktop> pCurrentDesktop;
const CComPtr<IVirtualDesktopManagerInternal>& pDesktopManagerInternal = GetDesktopManagerInternal(pLog, logdata);
LogHR(pLog, logdata, pDesktopManagerInternal->GetCurrentDesktop(&pCurrentDesktop), L"GetCurrentDesktop");
return pCurrentDesktop;
Expand Down Expand Up @@ -102,7 +102,7 @@ int GetDesktopCount(LogF* pLog, void* logdata)

int GetDesktopNumber(LogF* pLog, void* logdata, const CComPtr<IVirtualDesktop>& pFindDesktop)
{
int dn = -1;
int dn = 0;
const CComPtr<IVirtualDesktopManagerInternal>& pDesktopManagerInternal = GetDesktopManagerInternal(pLog, logdata);
CComPtr<IObjectArray> pDesktopArray;
if (pDesktopManagerInternal && SUCCEEDED(pDesktopManagerInternal->GetDesktops(&pDesktopArray)))
Expand Down Expand Up @@ -138,7 +138,7 @@ std::wstring GetDesktopName(LogF* pLog, void* logdata, const CComPtr<IVirtualDes
else
{
WCHAR buffer[128];
_snwprintf_s(buffer, _TRUNCATE, L"Desktop %d", GetDesktopNumber(pLog, logdata, pDesktop) + 1);
_snwprintf_s(buffer, _TRUNCATE, L"Desktop %d", GetDesktopNumber(pLog, logdata, pDesktop));
ret = buffer;
}
}
Expand All @@ -153,7 +153,7 @@ CComPtr<IVirtualDesktop> GetDesktop(LogF* pLog, void* logdata, int d)
if (pDesktopManagerInternal && SUCCEEDED(pDesktopManagerInternal->GetDesktops(&pDesktopArray)))
{
CComPtr<IVirtualDesktop> pDesktop;
LogHR(pLog, logdata, pDesktopArray->GetAt(d, IID_PPV_ARGS(&pDesktop)), E_INVALIDARG, L"IObjectArray GetAt");
LogHR(pLog, logdata, pDesktopArray->GetAt(d - 1, IID_PPV_ARGS(&pDesktop)), E_INVALIDARG, L"IObjectArray GetAt");
return pDesktop;
}
else
Expand Down

0 comments on commit ced2cd8

Please sign in to comment.