Skip to content

Commit

Permalink
Changes for WIN11 23H2
Browse files Browse the repository at this point in the history
  • Loading branch information
RadAd committed Nov 9, 2023
1 parent 502079b commit dd32ebe
Show file tree
Hide file tree
Showing 5 changed files with 83 additions and 111 deletions.
27 changes: 16 additions & 11 deletions src/VDNotification.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand All @@ -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;
}
18 changes: 11 additions & 7 deletions src/VDNotification.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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;
};
28 changes: 14 additions & 14 deletions src/VDUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -112,10 +112,10 @@ CComPtr<VD> GetDesktop(LogF* pLog, void* logdata, VDMI* pDesktopManagerInternal,
if (d == -1)
{
CComPtr<VD> 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<VD> pDesktop;
LogHR(pLog, logdata, pDesktopArray->GetAt(d - 1, IID_PPV_ARGS(&pDesktop)), E_INVALIDARG, L"IObjectArray GetAt");
Expand All @@ -130,7 +130,7 @@ void SwitchDesktop(LogF* pLog, void* logdata, VDMI* pDesktopManagerInternal, int
{
CComPtr<VD> pDesktop = GetDesktop<VD>(pLog, logdata, pDesktopManagerInternal, d);
if (pDesktop)
LogHR(pLog, logdata, SwitchDesktop(pDesktopManagerInternal, static_cast<VD*>(pDesktop)), L"SwitchDesktop");
LogHR(pLog, logdata, SwitchDesktop(pDesktopManagerInternal, static_cast<VD*>(pDesktop), false), L"SwitchDesktop");
}

void SwitchDesktop(LogF* pLog, void* logdata, int d)
Expand All @@ -149,11 +149,11 @@ template<class VD, class VDMI>
void SwitchDesktop(LogF* pLog, void* logdata, VDMI* pDesktopManagerInternal, enum AdjacentDesktop direction)
{
CComPtr<VD> pCurrentDesktop;
LogHR(pLog, logdata, GetCurrentDesktop(pDesktopManagerInternal, &pCurrentDesktop), L"GetCurrentDesktop");
LogHR(pLog, logdata, pDesktopManagerInternal->GetCurrentDesktop(&pCurrentDesktop), L"GetCurrentDesktop");
CComPtr<VD> pDesktop;
LogHR(pLog, logdata, pDesktopManagerInternal->GetAdjacentDesktop(pCurrentDesktop, direction, &pDesktop), TYPE_E_OUTOFBOUNDS, L"GetAdjacentDesktop");
if (pDesktop)
LogHR(pLog, logdata, SwitchDesktop(pDesktopManagerInternal, static_cast<VD*>(pDesktop)), L"SwitchDesktop");
LogHR(pLog, logdata, SwitchDesktop(pDesktopManagerInternal, static_cast<VD*>(pDesktop), false), L"SwitchDesktop");
}

void SwitchDesktop(LogF* pLog, void* logdata, enum AdjacentDesktop direction)
Expand All @@ -172,7 +172,7 @@ template <class VDMI>
int GetDesktopCount(LogF* pLog, void* logdata, VDMI* pDesktopManagerInternal)
{
CComPtr<IObjectArray> pDesktopArray;
if (SUCCEEDED(GetDesktops(pDesktopManagerInternal, &pDesktopArray)))
if (SUCCEEDED(pDesktopManagerInternal->GetDesktops(&pDesktopArray)))
{
UINT count;
if (!LogHR(pLog, logdata, pDesktopArray->GetCount(&count), L"GetDesktopCount"))
Expand Down Expand Up @@ -204,7 +204,7 @@ int GetDesktopNumber(VDMI* pDesktopManagerInternal, VD* pFindDesktop)
{
int dn = 0;
CComPtr<IObjectArray> pDesktopArray;
if (pDesktopManagerInternal && SUCCEEDED(GetDesktops(pDesktopManagerInternal, &pDesktopArray)))
if (pDesktopManagerInternal && SUCCEEDED(pDesktopManagerInternal->GetDesktops(&pDesktopArray)))
{
for (CComPtr<VD> pDesktop : ObjectArrayRange<VD>(pDesktopArray))
{
Expand All @@ -222,7 +222,7 @@ template <class VD, class VDMI>
int GetCurrentDesktopNumber(LogF* pLog, void* logdata, VDMI* pDesktopManagerInternal)
{
CComPtr<VD> pCurrentDesktop;
LogHR(pLog, logdata, GetCurrentDesktop(pDesktopManagerInternal, &pCurrentDesktop), L"GetCurrentDesktop");
LogHR(pLog, logdata, pDesktopManagerInternal->GetCurrentDesktop(&pCurrentDesktop), L"GetCurrentDesktop");
return GetDesktopNumber(pDesktopManagerInternal, static_cast<VD*>(pCurrentDesktop));
}

Expand Down Expand Up @@ -309,7 +309,7 @@ void SetDesktopName(LogF* pLog, void* logdata, VDMI* pDesktopManagerInternal, in
{
HSTRING s = NULL;
LogHR(pLog, logdata, WindowsCreateString(name, static_cast<UINT32>(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);
}
}
Expand Down Expand Up @@ -384,7 +384,7 @@ void SetDesktopWallpaper(LogF* pLog, void* logdata, VDMI* pDesktopManagerInterna
{
HSTRING s = NULL;
LogHR(pLog, logdata, WindowsCreateString(wallpaper, static_cast<UINT32>(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);
}
}
Expand All @@ -410,9 +410,9 @@ template <class VD, class VDMI>
void CreateDesktop(LogF* pLog, void* logdata, VDMI* pDesktopManagerInternal)
{
CComPtr<VD> 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<VD*>(pDesktop)), L"SwitchDesktop");
LogHR(pLog, logdata, SwitchDesktop(pDesktopManagerInternal, static_cast<VD*>(pDesktop), false), L"SwitchDesktop");
}

void CreateDesktop(LogF* pLog, void* logdata)
Expand All @@ -431,7 +431,7 @@ template <class VD, class VDMI>
void RemoveDesktop(LogF* pLog, void* logdata, VDMI* pDesktopManagerInternal, int d)
{
CComPtr<VD> pCurrentDesktop;
LogHR(pLog, logdata, GetCurrentDesktop(pDesktopManagerInternal, &pCurrentDesktop), L"GetCurrentDesktop");
LogHR(pLog, logdata, pDesktopManagerInternal->GetCurrentDesktop(&pCurrentDesktop), L"GetCurrentDesktop");
CComPtr<VD> pDesktop = d == -1 ? pCurrentDesktop : GetDesktop<VD>(pLog, logdata, pDesktopManagerInternal, d);
CComPtr<VD> pFallbackDesktop = pCurrentDesktop;
if (!pFallbackDesktop || pFallbackDesktop.IsEqualObject(pDesktop))
Expand Down Expand Up @@ -469,6 +469,6 @@ bool IsCurrentDesktop(LogF* pLog, void* logdata, Win11::IVirtualDesktop* pDeskto
{
const CComPtr<Win11::IVirtualDesktopManagerInternal>& pDesktopManagerInternal11 = GetDesktopManagerInternal<Win11::IVirtualDesktopManagerInternal>(pLog, logdata);
CComPtr<Win11::IVirtualDesktop> pCurrentDesktop;
LogHR(pLog, logdata, pDesktopManagerInternal11->GetCurrentDesktop(NULL, &pCurrentDesktop), L"GetCurrentDesktop");
LogHR(pLog, logdata, pDesktopManagerInternal11->GetCurrentDesktop(&pCurrentDesktop), L"GetCurrentDesktop");
return pCurrentDesktop.IsEqualObject(pDesktop);
}
4 changes: 2 additions & 2 deletions src/VirtualDesktop.rc
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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!
Expand Down
Loading

0 comments on commit dd32ebe

Please sign in to comment.