From ced2cd88d9fe7cf74bd594b6fd3cfe81b47c6c77 Mon Sep 17 00:00:00 2001 From: RadAd Date: Mon, 31 Jan 2022 16:09:24 +1100 Subject: [PATCH] Change desktop number system to 1-based --- .../VirtualDesktop/VirtualDesktop.ini | 36 +++++++++---------- src/VDUtils.cpp | 10 +++--- 2 files changed, 23 insertions(+), 23 deletions(-) diff --git a/Skins/VirtualDesktopDemo/VirtualDesktop/VirtualDesktop.ini b/Skins/VirtualDesktopDemo/VirtualDesktop/VirtualDesktop.ini index f809a61..d2b6b50 100644 --- a/Skins/VirtualDesktopDemo/VirtualDesktop/VirtualDesktop.ini +++ b/Skins/VirtualDesktopDemo/VirtualDesktop/VirtualDesktop.ini @@ -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] @@ -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] @@ -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] @@ -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] @@ -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] @@ -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] @@ -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] @@ -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] @@ -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 diff --git a/src/VDUtils.cpp b/src/VDUtils.cpp index 34ced81..f67cf4f 100644 --- a/src/VDUtils.cpp +++ b/src/VDUtils.cpp @@ -51,7 +51,7 @@ const CComPtr& GetVirtualNotificationService const CComPtr& GetDesktopManagerInternal(LogF* pLog, void* logdata) { - static CComPtr pDesktopManagerInternal;; + static CComPtr pDesktopManagerInternal; if (!pDesktopManagerInternal) { const CComPtr& pServiceProvider = GetImmersiveShell(pLog, logdata); @@ -62,7 +62,7 @@ const CComPtr& GetDesktopManagerInternal(LogF* p CComPtr GetCurrentDesktop(LogF* pLog, void* logdata) { - CComPtr pCurrentDesktop;; + CComPtr pCurrentDesktop; const CComPtr& pDesktopManagerInternal = GetDesktopManagerInternal(pLog, logdata); LogHR(pLog, logdata, pDesktopManagerInternal->GetCurrentDesktop(&pCurrentDesktop), L"GetCurrentDesktop"); return pCurrentDesktop; @@ -102,7 +102,7 @@ int GetDesktopCount(LogF* pLog, void* logdata) int GetDesktopNumber(LogF* pLog, void* logdata, const CComPtr& pFindDesktop) { - int dn = -1; + int dn = 0; const CComPtr& pDesktopManagerInternal = GetDesktopManagerInternal(pLog, logdata); CComPtr pDesktopArray; if (pDesktopManagerInternal && SUCCEEDED(pDesktopManagerInternal->GetDesktops(&pDesktopArray))) @@ -138,7 +138,7 @@ std::wstring GetDesktopName(LogF* pLog, void* logdata, const CComPtr GetDesktop(LogF* pLog, void* logdata, int d) if (pDesktopManagerInternal && SUCCEEDED(pDesktopManagerInternal->GetDesktops(&pDesktopArray))) { CComPtr 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