diff --git a/src/VDNotification.cpp b/src/VDNotification.cpp index 1ac04c5..73e5b17 100644 --- a/src/VDNotification.cpp +++ b/src/VDNotification.cpp @@ -87,34 +87,29 @@ STDMETHODIMP VirtualDesktopNotification::VirtualDesktopNameChanged(Win10::IVirtu // Win11::IVirtualDesktopNotification -STDMETHODIMP VirtualDesktopNotification::VirtualDesktopCreated(IObjectArray* monitors, Win11::IVirtualDesktop* pDesktop) +STDMETHODIMP VirtualDesktopNotification::VirtualDesktopCreated(Win11::IVirtualDesktop* pDesktop) { _notify->VirtualDesktopCreated(pDesktop); return S_OK; } -STDMETHODIMP VirtualDesktopNotification::VirtualDesktopDestroyBegin(IObjectArray* monitors, Win11::IVirtualDesktop* pDesktopDestroyed, Win11::IVirtualDesktop* pDesktopFallback) +STDMETHODIMP VirtualDesktopNotification::VirtualDesktopDestroyBegin(Win11::IVirtualDesktop* pDesktopDestroyed, Win11::IVirtualDesktop* pDesktopFallback) { return S_OK; } -STDMETHODIMP VirtualDesktopNotification::VirtualDesktopDestroyFailed(IObjectArray* monitors, Win11::IVirtualDesktop* pDesktopDestroyed, Win11::IVirtualDesktop* pDesktopFallback) +STDMETHODIMP VirtualDesktopNotification::VirtualDesktopDestroyFailed(Win11::IVirtualDesktop* pDesktopDestroyed, Win11::IVirtualDesktop* pDesktopFallback) { return S_OK; } -STDMETHODIMP VirtualDesktopNotification::VirtualDesktopDestroyed(IObjectArray* monitors, Win11::IVirtualDesktop* pDesktopDestroyed, Win11::IVirtualDesktop* pDesktopFallback) +STDMETHODIMP VirtualDesktopNotification::VirtualDesktopDestroyed(Win11::IVirtualDesktop* pDesktopDestroyed, Win11::IVirtualDesktop* pDesktopFallback) { _notify->VirtualDesktopDestroyed(pDesktopDestroyed, pDesktopFallback); return S_OK; } -STDMETHODIMP VirtualDesktopNotification::VirtualDesktopIsPerMonitorChanged(_In_ BOOL isPerMonitor) -{ - return S_OK; -} - -STDMETHODIMP VirtualDesktopNotification::VirtualDesktopMoved(IObjectArray* monitors, Win11::IVirtualDesktop* pDesktop, int64_t oldIndex, int64_t newIndex) +STDMETHODIMP VirtualDesktopNotification::VirtualDesktopMoved(Win11::IVirtualDesktop* pDesktop, int64_t oldIndex, int64_t newIndex) { _notify->VirtualDesktopMoved(pDesktop, oldIndex, newIndex); return S_OK; @@ -131,7 +126,7 @@ STDMETHODIMP VirtualDesktopNotification::ViewVirtualDesktopChanged11(IApplicatio return S_OK; } -STDMETHODIMP VirtualDesktopNotification::CurrentVirtualDesktopChanged(IObjectArray* monitors, Win11::IVirtualDesktop* pDesktopOld, Win11::IVirtualDesktop* pDesktopNew) +STDMETHODIMP VirtualDesktopNotification::CurrentVirtualDesktopChanged(Win11::IVirtualDesktop* pDesktopOld, Win11::IVirtualDesktop* pDesktopNew) { _notify->CurrentVirtualDesktopChanged(pDesktopOld, pDesktopNew); return S_OK; @@ -141,3 +136,13 @@ STDMETHODIMP VirtualDesktopNotification::VirtualDesktopWallpaperChanged(Win11::I { return S_OK; } + +STDMETHODIMP VirtualDesktopNotification::VirtualDesktopSwitched(Win11::IVirtualDesktop* pDesktop) +{ + return S_OK; +} + +STDMETHODIMP VirtualDesktopNotification::RemoteVirtualDesktopConnected(Win11::IVirtualDesktop* pDesktop) +{ + return S_OK; +} diff --git a/src/VDNotification.h b/src/VDNotification.h index 2ba6a7c..ab630de 100644 --- a/src/VDNotification.h +++ b/src/VDNotification.h @@ -17,6 +17,9 @@ class IVDNotification virtual void VirtualDesktopMoved(Win11::IVirtualDesktop* pDesktop, int64_t oldIndex, int64_t newIndex) = 0; virtual void VirtualDesktopNameChanged(Win11::IVirtualDesktop* pDesktop, HSTRING name) = 0; virtual void CurrentVirtualDesktopChanged(Win11::IVirtualDesktop* pDesktopOld, Win11::IVirtualDesktop* pDesktopNew) = 0; + //virtual void VirtualDesktopWallpaperChanged(Win11::IVirtualDesktop* pDesktop, HSTRING name) = 0; + //virtual void VirtualDesktopSwitched(Win11::IVirtualDesktop* pDesktop) = 0; + //virtual void RemoteVirtualDesktopConnected(Win11::IVirtualDesktop* pDesktop) = 0; }; class VirtualDesktopNotification : public Win10::IVirtualDesktopNotification2, public Win11::IVirtualDesktopNotification @@ -42,14 +45,15 @@ class VirtualDesktopNotification : public Win10::IVirtualDesktopNotification2, p STDMETHODIMP VirtualDesktopNameChanged(Win10::IVirtualDesktop* pDesktop, HSTRING name) override; // Win10::IVirtualDesktopNotification - STDMETHODIMP VirtualDesktopCreated(IObjectArray* monitors, Win11::IVirtualDesktop* pDesktop) override; - STDMETHODIMP VirtualDesktopDestroyBegin(IObjectArray* monitors, Win11::IVirtualDesktop* pDesktopDestroyed, Win11::IVirtualDesktop* pDesktopFallback) override; - STDMETHODIMP VirtualDesktopDestroyFailed(IObjectArray* monitors, Win11::IVirtualDesktop* pDesktopDestroyed, Win11::IVirtualDesktop* pDesktopFallback) override; - STDMETHODIMP VirtualDesktopDestroyed(IObjectArray* monitors, Win11::IVirtualDesktop* pDesktopDestroyed, Win11::IVirtualDesktop* pDesktopFallback) override; - STDMETHODIMP VirtualDesktopIsPerMonitorChanged(_In_ BOOL isPerMonitor) override; - STDMETHODIMP VirtualDesktopMoved(IObjectArray* monitors, Win11::IVirtualDesktop* pDesktop, int64_t oldIndex, int64_t newIndex) override; + STDMETHODIMP VirtualDesktopCreated(Win11::IVirtualDesktop* pDesktop) override; + STDMETHODIMP VirtualDesktopDestroyBegin(Win11::IVirtualDesktop* pDesktopDestroyed, Win11::IVirtualDesktop* pDesktopFallback) override; + STDMETHODIMP VirtualDesktopDestroyFailed(Win11::IVirtualDesktop* pDesktopDestroyed, Win11::IVirtualDesktop* pDesktopFallback) override; + STDMETHODIMP VirtualDesktopDestroyed(Win11::IVirtualDesktop* pDesktopDestroyed, Win11::IVirtualDesktop* pDesktopFallback) override; + STDMETHODIMP VirtualDesktopMoved(Win11::IVirtualDesktop* pDesktop, int64_t oldIndex, int64_t newIndex) override; STDMETHODIMP VirtualDesktopNameChanged11(Win11::IVirtualDesktop* pDesktop, HSTRING name) override; STDMETHODIMP ViewVirtualDesktopChanged11(IApplicationView* pView) override; - STDMETHODIMP CurrentVirtualDesktopChanged(IObjectArray* monitors, Win11::IVirtualDesktop* pDesktopOld, Win11::IVirtualDesktop* pDesktopNew) override; + STDMETHODIMP CurrentVirtualDesktopChanged(Win11::IVirtualDesktop* pDesktopOld, Win11::IVirtualDesktop* pDesktopNew) override; STDMETHODIMP VirtualDesktopWallpaperChanged(Win11::IVirtualDesktop* pDesktop, HSTRING name) override; + STDMETHODIMP VirtualDesktopSwitched(Win11::IVirtualDesktop* pDesktop) override; + STDMETHODIMP RemoteVirtualDesktopConnected(Win11::IVirtualDesktop* pDesktop) override; }; diff --git a/src/VDUtils.cpp b/src/VDUtils.cpp index fabc278..fd9fbc7 100644 --- a/src/VDUtils.cpp +++ b/src/VDUtils.cpp @@ -112,10 +112,10 @@ CComPtr GetDesktop(LogF* pLog, void* logdata, VDMI* pDesktopManagerInternal, if (d == -1) { CComPtr pCurrentDesktop; - LogHR(pLog, logdata, GetCurrentDesktop(pDesktopManagerInternal, &pCurrentDesktop), L"GetCurrentDesktop"); + LogHR(pLog, logdata, pDesktopManagerInternal->GetCurrentDesktop(&pCurrentDesktop), L"GetCurrentDesktop"); return pCurrentDesktop; } - else if (pDesktopManagerInternal && SUCCEEDED(GetDesktops(pDesktopManagerInternal, &pDesktopArray))) + else if (pDesktopManagerInternal && SUCCEEDED(pDesktopManagerInternal->GetDesktops(&pDesktopArray))) { CComPtr pDesktop; LogHR(pLog, logdata, pDesktopArray->GetAt(d - 1, IID_PPV_ARGS(&pDesktop)), E_INVALIDARG, L"IObjectArray GetAt"); @@ -130,7 +130,7 @@ void SwitchDesktop(LogF* pLog, void* logdata, VDMI* pDesktopManagerInternal, int { CComPtr pDesktop = GetDesktop(pLog, logdata, pDesktopManagerInternal, d); if (pDesktop) - LogHR(pLog, logdata, SwitchDesktop(pDesktopManagerInternal, static_cast(pDesktop)), L"SwitchDesktop"); + LogHR(pLog, logdata, SwitchDesktop(pDesktopManagerInternal, static_cast(pDesktop), false), L"SwitchDesktop"); } void SwitchDesktop(LogF* pLog, void* logdata, int d) @@ -149,11 +149,11 @@ template void SwitchDesktop(LogF* pLog, void* logdata, VDMI* pDesktopManagerInternal, enum AdjacentDesktop direction) { CComPtr pCurrentDesktop; - LogHR(pLog, logdata, GetCurrentDesktop(pDesktopManagerInternal, &pCurrentDesktop), L"GetCurrentDesktop"); + LogHR(pLog, logdata, pDesktopManagerInternal->GetCurrentDesktop(&pCurrentDesktop), L"GetCurrentDesktop"); CComPtr pDesktop; LogHR(pLog, logdata, pDesktopManagerInternal->GetAdjacentDesktop(pCurrentDesktop, direction, &pDesktop), TYPE_E_OUTOFBOUNDS, L"GetAdjacentDesktop"); if (pDesktop) - LogHR(pLog, logdata, SwitchDesktop(pDesktopManagerInternal, static_cast(pDesktop)), L"SwitchDesktop"); + LogHR(pLog, logdata, SwitchDesktop(pDesktopManagerInternal, static_cast(pDesktop), false), L"SwitchDesktop"); } void SwitchDesktop(LogF* pLog, void* logdata, enum AdjacentDesktop direction) @@ -172,7 +172,7 @@ template int GetDesktopCount(LogF* pLog, void* logdata, VDMI* pDesktopManagerInternal) { CComPtr pDesktopArray; - if (SUCCEEDED(GetDesktops(pDesktopManagerInternal, &pDesktopArray))) + if (SUCCEEDED(pDesktopManagerInternal->GetDesktops(&pDesktopArray))) { UINT count; if (!LogHR(pLog, logdata, pDesktopArray->GetCount(&count), L"GetDesktopCount")) @@ -204,7 +204,7 @@ int GetDesktopNumber(VDMI* pDesktopManagerInternal, VD* pFindDesktop) { int dn = 0; CComPtr pDesktopArray; - if (pDesktopManagerInternal && SUCCEEDED(GetDesktops(pDesktopManagerInternal, &pDesktopArray))) + if (pDesktopManagerInternal && SUCCEEDED(pDesktopManagerInternal->GetDesktops(&pDesktopArray))) { for (CComPtr pDesktop : ObjectArrayRange(pDesktopArray)) { @@ -222,7 +222,7 @@ template int GetCurrentDesktopNumber(LogF* pLog, void* logdata, VDMI* pDesktopManagerInternal) { CComPtr pCurrentDesktop; - LogHR(pLog, logdata, GetCurrentDesktop(pDesktopManagerInternal, &pCurrentDesktop), L"GetCurrentDesktop"); + LogHR(pLog, logdata, pDesktopManagerInternal->GetCurrentDesktop(&pCurrentDesktop), L"GetCurrentDesktop"); return GetDesktopNumber(pDesktopManagerInternal, static_cast(pCurrentDesktop)); } @@ -309,7 +309,7 @@ void SetDesktopName(LogF* pLog, void* logdata, VDMI* pDesktopManagerInternal, in { HSTRING s = NULL; LogHR(pLog, logdata, WindowsCreateString(name, static_cast(wcslen(name)), &s), L"WindowsCreateString"); - LogHR(pLog, logdata, pDesktopManagerInternal->SetName(pDesktop , s), L"SetDesktopName"); + LogHR(pLog, logdata, pDesktopManagerInternal->SetDesktopName(pDesktop , s), L"SetDesktopName"); WindowsDeleteString(s); } } @@ -384,7 +384,7 @@ void SetDesktopWallpaper(LogF* pLog, void* logdata, VDMI* pDesktopManagerInterna { HSTRING s = NULL; LogHR(pLog, logdata, WindowsCreateString(wallpaper, static_cast(wcslen(wallpaper)), &s), L"WindowsCreateString"); - LogHR(pLog, logdata, pDesktopManagerInternal->SetWallpaper(pDesktop, s), L"SetDesktopWallpaper"); + LogHR(pLog, logdata, pDesktopManagerInternal->SetDesktopWallpaper(pDesktop, s), L"SetDesktopWallpaper"); WindowsDeleteString(s); } } @@ -410,9 +410,9 @@ template void CreateDesktop(LogF* pLog, void* logdata, VDMI* pDesktopManagerInternal) { CComPtr pDesktop; - LogHR(pLog, logdata, CreateDesktop(pDesktopManagerInternal, &pDesktop), L"CreateDesktop"); + LogHR(pLog, logdata, pDesktopManagerInternal->CreateDesktop(&pDesktop), L"CreateDesktop"); if (pDesktop) - LogHR(pLog, logdata, SwitchDesktop(pDesktopManagerInternal, static_cast(pDesktop)), L"SwitchDesktop"); + LogHR(pLog, logdata, SwitchDesktop(pDesktopManagerInternal, static_cast(pDesktop), false), L"SwitchDesktop"); } void CreateDesktop(LogF* pLog, void* logdata) @@ -431,7 +431,7 @@ template void RemoveDesktop(LogF* pLog, void* logdata, VDMI* pDesktopManagerInternal, int d) { CComPtr pCurrentDesktop; - LogHR(pLog, logdata, GetCurrentDesktop(pDesktopManagerInternal, &pCurrentDesktop), L"GetCurrentDesktop"); + LogHR(pLog, logdata, pDesktopManagerInternal->GetCurrentDesktop(&pCurrentDesktop), L"GetCurrentDesktop"); CComPtr pDesktop = d == -1 ? pCurrentDesktop : GetDesktop(pLog, logdata, pDesktopManagerInternal, d); CComPtr pFallbackDesktop = pCurrentDesktop; if (!pFallbackDesktop || pFallbackDesktop.IsEqualObject(pDesktop)) @@ -469,6 +469,6 @@ bool IsCurrentDesktop(LogF* pLog, void* logdata, Win11::IVirtualDesktop* pDeskto { const CComPtr& pDesktopManagerInternal11 = GetDesktopManagerInternal(pLog, logdata); CComPtr pCurrentDesktop; - LogHR(pLog, logdata, pDesktopManagerInternal11->GetCurrentDesktop(NULL, &pCurrentDesktop), L"GetCurrentDesktop"); + LogHR(pLog, logdata, pDesktopManagerInternal11->GetCurrentDesktop(&pCurrentDesktop), L"GetCurrentDesktop"); return pCurrentDesktop.IsEqualObject(pDesktop); } diff --git a/src/VirtualDesktop.rc b/src/VirtualDesktop.rc index 383fbaf..ea2401e 100644 --- a/src/VirtualDesktop.rc +++ b/src/VirtualDesktop.rc @@ -8,7 +8,7 @@ // VS_VERSION_INFO VERSIONINFO - FILEVERSION 1,4,2,0 + FILEVERSION 1,4,3,0 PRODUCTVERSION 3,0,2,2161 FILEFLAGSMASK 0x17L #ifdef _DEBUG @@ -24,7 +24,7 @@ BEGIN BEGIN BLOCK "040904E4" BEGIN - VALUE "FileVersion", "1.4.2.0" + VALUE "FileVersion", "1.4.3.0" VALUE "LegalCopyright", "© 2021 - Adam Gates" // Don't change the entries below! diff --git a/src/Win10Desktops.h b/src/Win10Desktops.h index d51c4c3..ae065d8 100644 --- a/src/Win10Desktops.h +++ b/src/Win10Desktops.h @@ -3,6 +3,8 @@ // See for more up-to-date // https://github.com/skottmckay/VirtualDesktopAccessor +// See https://github.com/y2nd66/WindowsVirtualDesktop/blob/main/11.22631.2115/11.22631.2115.txt + #pragma once //#include "framework.h" @@ -149,7 +151,7 @@ namespace Win10 { namespace Win11 { - MIDL_INTERFACE("536D3495-B208-4CC9-AE26-DE8111275BF8") + MIDL_INTERFACE("3F07F4BE-B107-441A-AF0F-39D82529072C") IVirtualDesktop : public IUnknown { public: @@ -160,14 +162,14 @@ namespace Win11 { virtual HRESULT STDMETHODCALLTYPE GetID( _Out_ GUID* pGuid) = 0; - virtual HRESULT STDMETHODCALLTYPE GetMonitor( - _Out_ HMONITOR* pMonitor) = 0; - virtual HRESULT STDMETHODCALLTYPE GetName( _Out_ HSTRING* p0) = 0; virtual HRESULT STDMETHODCALLTYPE GetWallpaperPath( _Out_ HSTRING* p0) = 0; + + virtual HRESULT STDMETHODCALLTYPE IsRemote( + _Out_ BOOL* pBool) = 0; }; } @@ -233,7 +235,7 @@ namespace Win10 { IVirtualDesktopManagerInternal2 : public IVirtualDesktopManagerInternal { public: - virtual HRESULT STDMETHODCALLTYPE SetName( + virtual HRESULT STDMETHODCALLTYPE SetDesktopName( _In_ IVirtualDesktop* p0, _In_ HSTRING name) = 0; }; @@ -251,13 +253,12 @@ namespace Win10 { namespace Win11 { - MIDL_INTERFACE("B2F925B9-5A0F-4D2E-9F4D-2B1507593C10") + MIDL_INTERFACE("A3175F2D-239C-4BD2-8AA0-EEBA8B0B138E") IVirtualDesktopManagerInternal : public IUnknown { public: virtual HRESULT STDMETHODCALLTYPE GetCount( - _In_opt_ HMONITOR monitor, - _Out_ UINT* pCount) = 0; + _Out_ UINT* pCount) = 0; virtual HRESULT STDMETHODCALLTYPE MoveViewToDesktop( _In_ IApplicationView* pView, @@ -268,14 +269,9 @@ namespace Win11 { _Out_ BOOL* pfCanViewMoveDesktops) = 0; virtual HRESULT STDMETHODCALLTYPE GetCurrentDesktop( - _In_opt_ HMONITOR monitor, _Out_ IVirtualDesktop** desktop) = 0; - virtual HRESULT STDMETHODCALLTYPE GetAllCurrentDesktops( - _Out_ IObjectArray** ppDesktops) = 0; - virtual HRESULT STDMETHODCALLTYPE GetDesktops( - _In_opt_ HMONITOR monitor, _Out_ IObjectArray** ppDesktops) = 0; virtual HRESULT STDMETHODCALLTYPE GetAdjacentDesktop( @@ -284,16 +280,13 @@ namespace Win11 { _Out_ IVirtualDesktop** ppAdjacentDesktop) = 0; virtual HRESULT STDMETHODCALLTYPE SwitchDesktop( - _In_opt_ HMONITOR monitor, _In_ IVirtualDesktop* pDesktop) = 0; virtual HRESULT STDMETHODCALLTYPE CreateDesktopW( - _In_opt_ HMONITOR monitor, _Out_ IVirtualDesktop** ppNewDesktop) = 0; - virtual HRESULT STDMETHODCALLTYPE MoveDesktop( // New for Win11 + virtual HRESULT STDMETHODCALLTYPE MoveDesktop( _In_ IVirtualDesktop* desktop, - _In_opt_ HMONITOR monitor, _In_ INT32 index) = 0; virtual HRESULT STDMETHODCALLTYPE RemoveDesktop( @@ -309,11 +302,11 @@ namespace Win11 { _Out_ IObjectArray** ppDesktops1, _Out_ IObjectArray** ppDesktops2) = 0; - virtual HRESULT STDMETHODCALLTYPE SetName( + virtual HRESULT STDMETHODCALLTYPE SetDesktopName( _In_ IVirtualDesktop* p0, _In_ HSTRING name) = 0; - virtual HRESULT STDMETHODCALLTYPE SetWallpaper( + virtual HRESULT STDMETHODCALLTYPE SetDesktopWallpaper( _In_ IVirtualDesktop* p0, _In_ HSTRING name) = 0; @@ -324,13 +317,21 @@ namespace Win11 { _In_ IApplicationView* p0, _In_ IApplicationView* p1) = 0; - virtual HRESULT STDMETHODCALLTYPE GetDesktopIsPerMonitor( - _Out_ BOOL* p0) = 0; + virtual HRESULT STDMETHODCALLTYPE CreateRemoteDesktop( + _In_ HSTRING name, + _Out_ IVirtualDesktop** desktop) = 0; - virtual HRESULT STDMETHODCALLTYPE SetDesktopIsPerMonitor( - _In_ BOOL p0) = 0; - }; + virtual HRESULT STDMETHODCALLTYPE SwitchRemoteDesktop( + _In_ IVirtualDesktop* pDesktop) = 0; + + virtual HRESULT STDMETHODCALLTYPE SwitchDesktopWithAnimation( + _In_ IVirtualDesktop* pDesktop) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetLastActiveDesktop( + _Out_ IVirtualDesktop** desktop) = 0; + virtual HRESULT STDMETHODCALLTYPE WaitForAnimationToComplete() = 0; + }; } namespace Win10 { @@ -389,34 +390,26 @@ namespace Win10 { namespace Win11 { - MIDL_INTERFACE("CD403E52-DEED-4C13-B437-B98380F2B1E8") + MIDL_INTERFACE("B287FA1C-7771-471A-A2DF-9B6B21F0D675") IVirtualDesktopNotification : public IUnknown { public: virtual HRESULT STDMETHODCALLTYPE VirtualDesktopCreated( - _In_ IObjectArray* monitors, - _In_ IVirtualDesktop* pDesktop) = 0; + _In_ IVirtualDesktop* pDesktop) = 0; virtual HRESULT STDMETHODCALLTYPE VirtualDesktopDestroyBegin( - _In_ IObjectArray* monitors, _In_ IVirtualDesktop* pDesktopDestroyed, _In_ IVirtualDesktop* pDesktopFallback) = 0; virtual HRESULT STDMETHODCALLTYPE VirtualDesktopDestroyFailed( - _In_ IObjectArray* monitors, _In_ IVirtualDesktop* pDesktopDestroyed, _In_ IVirtualDesktop* pDesktopFallback) = 0; virtual HRESULT STDMETHODCALLTYPE VirtualDesktopDestroyed( - _In_ IObjectArray* monitors, _In_ IVirtualDesktop* pDesktopDestroyed, _In_ IVirtualDesktop* pDesktopFallback) = 0; - virtual HRESULT STDMETHODCALLTYPE VirtualDesktopIsPerMonitorChanged( - _In_ BOOL isPerMonitor) = 0; - virtual HRESULT STDMETHODCALLTYPE VirtualDesktopMoved( - _In_ IObjectArray* monitors, _In_ IVirtualDesktop* pDesktop, _In_ int64_t oldIndex, _In_ int64_t newIndex) = 0; @@ -429,13 +422,18 @@ namespace Win11 { _In_ IApplicationView* pView) = 0; virtual HRESULT STDMETHODCALLTYPE CurrentVirtualDesktopChanged( - _In_ IObjectArray* monitors, _In_ IVirtualDesktop* pDesktopOld, _In_ IVirtualDesktop* pDesktopNew) = 0; virtual HRESULT STDMETHODCALLTYPE VirtualDesktopWallpaperChanged( _In_ IVirtualDesktop* pDesktop, _In_ HSTRING name) = 0; + + virtual HRESULT STDMETHODCALLTYPE VirtualDesktopSwitched( + _In_ IVirtualDesktop* pDesktop) = 0; + + virtual HRESULT STDMETHODCALLTYPE RemoteVirtualDesktopConnected( + _In_ IVirtualDesktop* pDesktop) = 0; }; const __declspec(selectany) IID& IID_IVirtualDesktopNotification = __uuidof(IVirtualDesktopNotification); @@ -454,50 +452,15 @@ namespace Win11 { } -template -inline HRESULT GetCurrentDesktop(VDMI* pDesktopManagerInternal, VD** desktop) -{ - return pDesktopManagerInternal->GetCurrentDesktop(desktop); -} - -template <> -inline HRESULT GetCurrentDesktop(Win11::IVirtualDesktopManagerInternal* pDesktopManagerInternal, Win11::IVirtualDesktop** desktop) -{ - return pDesktopManagerInternal->GetCurrentDesktop(NULL, desktop); -} - -template -inline HRESULT GetDesktops(VDMI* pDesktopManagerInternal, IObjectArray** ppDesktops) -{ - return pDesktopManagerInternal->GetDesktops(ppDesktops); -} - -template <> -inline HRESULT GetDesktops(Win11::IVirtualDesktopManagerInternal* pDesktopManagerInternal, IObjectArray** ppDesktops) -{ - return pDesktopManagerInternal->GetDesktops(NULL, ppDesktops); -} - -template -inline HRESULT SwitchDesktop(VDMI* pDesktopManagerInternal, VD* desktop) -{ - return pDesktopManagerInternal->SwitchDesktop(desktop); -} - -template <> -inline HRESULT SwitchDesktop(Win11::IVirtualDesktopManagerInternal* pDesktopManagerInternal, Win11::IVirtualDesktop* desktop) -{ - return pDesktopManagerInternal->SwitchDesktop(NULL, desktop); -} - -template -inline HRESULT CreateDesktop(VDMI* pDesktopManagerInternal, VD** desktop) +inline HRESULT SwitchDesktop(Win10::IVirtualDesktopManagerInternal* pDesktopManagerInternal, Win10::IVirtualDesktop* pDesktop, bool /*bWithAnimation*/) { - return pDesktopManagerInternal->CreateDesktop(desktop); + return pDesktopManagerInternal->SwitchDesktop(pDesktop); } -template <> -inline HRESULT CreateDesktop(Win11::IVirtualDesktopManagerInternal* pDesktopManagerInternal, Win11::IVirtualDesktop** desktop) +inline HRESULT SwitchDesktop(Win11::IVirtualDesktopManagerInternal* pDesktopManagerInternal, Win11::IVirtualDesktop* pDesktop, bool bWithAnimation) { - return pDesktopManagerInternal->CreateDesktop(NULL, desktop); + if (bWithAnimation) + return pDesktopManagerInternal->SwitchDesktopWithAnimation(pDesktop); + else + return pDesktopManagerInternal->SwitchDesktop(pDesktop); }