From 14364e6c301e881c5e2b6b9c39503343c66e53eb Mon Sep 17 00:00:00 2001 From: reunion-maestro-bot Date: Tue, 12 Nov 2024 21:37:45 +0000 Subject: [PATCH] Syncing content from committish f6b3531dce4818fb5bf5130a6cd96bca2d3de762 --- src/controls/dev/Collections/HashMap.h | 2 +- src/controls/dev/Collections/Vector.h | 2 +- src/controls/dev/Collections/VectorIterator.h | 2 +- src/dxaml/Xaml.NTLegacy.Cpp.targets | 3 - .../BuildSettings/LibraryCompile.props | 2 - src/dxaml/xcp/core/inc/UIDMContainer.h | 23 +- src/dxaml/xcp/core/inc/UIDMContainerHandler.h | 5 + .../optional/elements/touch/UIDMContainer.cpp | 484 ++++++++++++++---- .../elements/touch/UIDMContainerHandler.cpp | 339 +++++++++--- src/eng/Version.Details.xml | 20 +- 10 files changed, 684 insertions(+), 198 deletions(-) diff --git a/src/controls/dev/Collections/HashMap.h b/src/controls/dev/Collections/HashMap.h index b465a1d723..0509f2e6ff 100644 --- a/src/controls/dev/Collections/HashMap.h +++ b/src/controls/dev/Collections/HashMap.h @@ -7,7 +7,7 @@ template class HashMap : public ReferenceTracker< HashMap, - reference_tracker_implements_t>::type, + typename reference_tracker_implements_t>::type, winrt::IMapView, winrt::IIterable>> { diff --git a/src/controls/dev/Collections/Vector.h b/src/controls/dev/Collections/Vector.h index eddecb9b60..a5afafd397 100644 --- a/src/controls/dev/Collections/Vector.h +++ b/src/controls/dev/Collections/Vector.h @@ -650,7 +650,7 @@ template , - reference_tracker_implements_t::type, + typename reference_tracker_implements_t::type, typename Options::IterableType, std::conditional_t>, public Options::IVectorOwner diff --git a/src/controls/dev/Collections/VectorIterator.h b/src/controls/dev/Collections/VectorIterator.h index 7a4d1ce837..f82fe1a9b5 100644 --- a/src/controls/dev/Collections/VectorIterator.h +++ b/src/controls/dev/Collections/VectorIterator.h @@ -40,7 +40,7 @@ template , - reference_tracker_implements_t::type> + typename reference_tracker_implements_t::type> { public: VectorIterator(typename Traits::VectorType const& vector) diff --git a/src/dxaml/Xaml.NTLegacy.Cpp.targets b/src/dxaml/Xaml.NTLegacy.Cpp.targets index 96e8198d11..3dd69d916f 100644 --- a/src/dxaml/Xaml.NTLegacy.Cpp.targets +++ b/src/dxaml/Xaml.NTLegacy.Cpp.targets @@ -112,12 +112,9 @@ %(PreprocessorDefinitions);_HAS_MAGIC_STATICS=1; - - %(AdditionalOptions) /Qspectre -d1vc7dname -Zc:sizedDealloc- %(AdditionalOptions) /d2noftol3 - %(AdditionalOptions) /d2noftol3 /d2CoroOptsWorkaround diff --git a/src/dxaml/msbuild/BuildSettings/LibraryCompile.props b/src/dxaml/msbuild/BuildSettings/LibraryCompile.props index 6c649308e8..aa4e567e7e 100644 --- a/src/dxaml/msbuild/BuildSettings/LibraryCompile.props +++ b/src/dxaml/msbuild/BuildSettings/LibraryCompile.props @@ -131,7 +131,6 @@ %(ExtraOptions) /d1import_no_registry - /d1vc7dname /d2NoSmallFunctionOpt /d2CoroOptsWorkaround /d2AllowCompatibleILVersions @@ -166,7 +165,6 @@ /Brepro /d1import_no_registry /d1ReturnUdtEHInline - -d1vc7dname /d1ZWodr /d2AllowCompatibleILVersions /d2CoroOptsWorkaround diff --git a/src/dxaml/xcp/core/inc/UIDMContainer.h b/src/dxaml/xcp/core/inc/UIDMContainer.h index 80b9f8cab5..8e12306abc 100644 --- a/src/dxaml/xcp/core/inc/UIDMContainer.h +++ b/src/dxaml/xcp/core/inc/UIDMContainer.h @@ -16,6 +16,11 @@ class CUIElement; #include #include "DirectManipulationContainerHandler.h" #include "DirectManipulationContainer.h" +#include + +// Bug 54433864: WinAppSDK 1.7: Using WinUI ListView and/or ItemsRepeater causes a substantial increase in unmanaged memory usage +// Bug 54705344: WinAppSDK 1.6.2 Servicing: Using WinUI ListView and/or ItemsRepeater causes a substantial increase in unmanaged memory usage +#define WINAPPSDK_CHANGEID_54705344 54705344 class CUIDMContainer : public ctl::implements { @@ -169,7 +174,6 @@ class CUIDMContainer : public ctl::implements // Constructor CUIDMContainer(_In_ CCoreServices* pCoreServices, _In_ CUIElement* pUIElement) : m_pCoreServices(pCoreServices) - , m_pUIElement(pUIElement) , m_pDMContainerHandler(NULL) { #ifdef DMCNTNR_DBG @@ -181,7 +185,16 @@ class CUIDMContainer : public ctl::implements pCoreServices->AddRef(); ASSERT(pUIElement); - pUIElement->AddRef(); + + if (WinAppSdk::Containment::IsChangeEnabled()) + { + m_pUIElementWeakRef = xref::get_weakref(pUIElement); + } + else + { + m_pUIElement = pUIElement; + pUIElement->AddRef(); + } } protected: @@ -213,7 +226,13 @@ class CUIDMContainer : public ctl::implements private: CCoreServices* m_pCoreServices; + + // Used when WinAppSDK 1.6.2 fix for 54705344 is not applied: CUIElement* m_pUIElement; // CUIElement object associated to this implementation + + // Used when WinAppSDK 1.6.2 fix for 54705344 is applied: + xref::weakref_ptr m_pUIElementWeakRef; // CUIElement object associated to this implementation + IDirectManipulationContainerHandler* m_pDMContainerHandler; }; diff --git a/src/dxaml/xcp/core/inc/UIDMContainerHandler.h b/src/dxaml/xcp/core/inc/UIDMContainerHandler.h index 77b585b226..ee2375cb1e 100644 --- a/src/dxaml/xcp/core/inc/UIDMContainerHandler.h +++ b/src/dxaml/xcp/core/inc/UIDMContainerHandler.h @@ -159,6 +159,11 @@ class CUIDMContainerHandler final : public CXcpObjectBase m_pUIElementWeakRef; // CUIElement object associated to this IDirectManipulationContainerHandler implementation }; diff --git a/src/dxaml/xcp/core/optional/elements/touch/UIDMContainer.cpp b/src/dxaml/xcp/core/optional/elements/touch/UIDMContainer.cpp index e48ca0d626..f046016902 100644 --- a/src/dxaml/xcp/core/optional/elements/touch/UIDMContainer.cpp +++ b/src/dxaml/xcp/core/optional/elements/touch/UIDMContainer.cpp @@ -67,11 +67,25 @@ CUIDMContainer::SetManipulationHandler( m_pDMContainerHandler = pHandler; } - IFC_RETURN(FxCallbacks::UIElement_SetManipulationHandler( - m_pUIElement, - m_pDMContainerHandler)); + if (WinAppSdk::Containment::IsChangeEnabled()) + { + if (const auto pUIElement = m_pUIElementWeakRef.lock()) + { + IFC_RETURN(FxCallbacks::UIElement_SetManipulationHandler( + pUIElement, + m_pDMContainerHandler)); + + pUIElement->SetIsDirectManipulationContainer(m_pDMContainerHandler != nullptr); + } + } + else + { + IFC_RETURN(FxCallbacks::UIElement_SetManipulationHandler( + m_pUIElement, + m_pDMContainerHandler)); - m_pUIElement->SetIsDirectManipulationContainer(m_pDMContainerHandler != NULL); + m_pUIElement->SetIsDirectManipulationContainer(m_pDMContainerHandler != NULL); + } return S_OK; } @@ -95,10 +109,23 @@ CUIDMContainer::SetManipulationHandlerWantsNotifications( IFCEXPECT_ASSERT_RETURN(m_pCoreServices); - IFC_RETURN(FxCallbacks::UIElement_SetManipulationHandlerWantsNotifications( - m_pUIElement, - pManipulatedElement, - fWantsNotifications)); + if (WinAppSdk::Containment::IsChangeEnabled()) + { + if (const auto pUIElement = m_pUIElementWeakRef.lock()) + { + IFC_RETURN(FxCallbacks::UIElement_SetManipulationHandlerWantsNotifications( + pUIElement, + pManipulatedElement, + fWantsNotifications)); + } + } + else + { + IFC_RETURN(FxCallbacks::UIElement_SetManipulationHandlerWantsNotifications( + m_pUIElement, + pManipulatedElement, + fWantsNotifications)); + } return S_OK; } @@ -128,11 +155,25 @@ CUIDMContainer::GetCanManipulateElements( *pfCanManipulateElementsNonTouch = FALSE; *pfCanManipulateElementsWithBringIntoViewport = FALSE; - IFC_RETURN(FxCallbacks::UIElement_GetCanManipulateElements( - m_pUIElement, - pfCanManipulateElementsByTouch, - pfCanManipulateElementsNonTouch, - pfCanManipulateElementsWithBringIntoViewport)); + if (WinAppSdk::Containment::IsChangeEnabled()) + { + if (const auto pUIElement = m_pUIElementWeakRef.lock()) + { + IFC_RETURN(FxCallbacks::UIElement_GetCanManipulateElements( + pUIElement, + pfCanManipulateElementsByTouch, + pfCanManipulateElementsNonTouch, + pfCanManipulateElementsWithBringIntoViewport)); + } + } + else + { + IFC_RETURN(FxCallbacks::UIElement_GetCanManipulateElements( + m_pUIElement, + pfCanManipulateElementsByTouch, + pfCanManipulateElementsNonTouch, + pfCanManipulateElementsWithBringIntoViewport)); + } return S_OK; } @@ -152,9 +193,21 @@ CUIDMContainer::SetPointedElement( { IFCPTR_RETURN(pPointedElement); - IFC_RETURN(FxCallbacks::UIElement_SetPointedElement( - m_pUIElement, - pPointedElement)); + if (WinAppSdk::Containment::IsChangeEnabled()) + { + if (const auto pUIElement = m_pUIElementWeakRef.lock()) + { + IFC_RETURN(FxCallbacks::UIElement_SetPointedElement( + pUIElement, + pPointedElement)); + } + } + else + { + IFC_RETURN(FxCallbacks::UIElement_SetPointedElement( + m_pUIElement, + pPointedElement)); + } return S_OK; } @@ -182,11 +235,25 @@ CUIDMContainer::GetManipulatedElement( IFCPTR(ppManipulatedElement); *ppManipulatedElement = NULL; - IFC(FxCallbacks::UIElement_GetManipulatedElement( - m_pUIElement, - pPointedElement, - pChildElement, - &pManipulatedElement)); + if (WinAppSdk::Containment::IsChangeEnabled()) + { + if (const auto pUIElement = m_pUIElementWeakRef.lock()) + { + IFC(FxCallbacks::UIElement_GetManipulatedElement( + pUIElement, + pPointedElement, + pChildElement, + &pManipulatedElement)); + } + } + else + { + IFC(FxCallbacks::UIElement_GetManipulatedElement( + m_pUIElement, + pPointedElement, + pChildElement, + &pManipulatedElement)); + } AddRefInterface(pManipulatedElement); *ppManipulatedElement = pManipulatedElement; @@ -258,19 +325,41 @@ CUIDMContainer::GetManipulationViewport( *pVerticalOverpanMode = XcpDMOverpanModeDefault; } - IFC_RETURN(FxCallbacks::UIElement_GetManipulationViewport( - m_pUIElement, - pManipulatedElement, - pBounds, - pInputTransform, - reinterpret_cast(pTouchConfiguration), - reinterpret_cast(pNonTouchConfiguration), - reinterpret_cast(pBringIntoViewportConfiguration), - reinterpret_cast(pHorizontalOverpanMode), - reinterpret_cast(pVerticalOverpanMode), - pcConfigurations, - reinterpret_cast(ppConfigurations), - reinterpret_cast(pChainedMotionTypes))); + if (WinAppSdk::Containment::IsChangeEnabled()) + { + if (const auto pUIElement = m_pUIElementWeakRef.lock()) + { + IFC_RETURN(FxCallbacks::UIElement_GetManipulationViewport( + pUIElement, + pManipulatedElement, + pBounds, + pInputTransform, + reinterpret_cast(pTouchConfiguration), + reinterpret_cast(pNonTouchConfiguration), + reinterpret_cast(pBringIntoViewportConfiguration), + reinterpret_cast(pHorizontalOverpanMode), + reinterpret_cast(pVerticalOverpanMode), + pcConfigurations, + reinterpret_cast(ppConfigurations), + reinterpret_cast(pChainedMotionTypes))); + } + } + else + { + IFC_RETURN(FxCallbacks::UIElement_GetManipulationViewport( + m_pUIElement, + pManipulatedElement, + pBounds, + pInputTransform, + reinterpret_cast(pTouchConfiguration), + reinterpret_cast(pNonTouchConfiguration), + reinterpret_cast(pBringIntoViewportConfiguration), + reinterpret_cast(pHorizontalOverpanMode), + reinterpret_cast(pVerticalOverpanMode), + pcConfigurations, + reinterpret_cast(ppConfigurations), + reinterpret_cast(pChainedMotionTypes))); + } return S_OK; } @@ -335,18 +424,39 @@ CUIDMContainer::GetManipulationPrimaryContent( *pfIsLayoutRefreshed = FALSE; } - IFC_RETURN(FxCallbacks::UIElement_GetManipulationPrimaryContent( - m_pUIElement, - pManipulatedElement, - pOffsets, - pBounds, - reinterpret_cast(pHorizontalAligment), - reinterpret_cast(pVerticalAligment), - pMinZoomFactor, - pMaxZoomFactor, - pfIsHorizontalStretchAlignmentTreatedAsNear, - pfIsVerticalStretchAlignmentTreatedAsNear, - pfIsLayoutRefreshed)); + if (WinAppSdk::Containment::IsChangeEnabled()) + { + if (const auto pUIElement = m_pUIElementWeakRef.lock()) + { + IFC_RETURN(FxCallbacks::UIElement_GetManipulationPrimaryContent( + pUIElement, + pManipulatedElement, + pOffsets, + pBounds, + reinterpret_cast(pHorizontalAligment), + reinterpret_cast(pVerticalAligment), + pMinZoomFactor, + pMaxZoomFactor, + pfIsHorizontalStretchAlignmentTreatedAsNear, + pfIsVerticalStretchAlignmentTreatedAsNear, + pfIsLayoutRefreshed)); + } + } + else + { + IFC_RETURN(FxCallbacks::UIElement_GetManipulationPrimaryContent( + m_pUIElement, + pManipulatedElement, + pOffsets, + pBounds, + reinterpret_cast(pHorizontalAligment), + reinterpret_cast(pVerticalAligment), + pMinZoomFactor, + pMaxZoomFactor, + pfIsHorizontalStretchAlignmentTreatedAsNear, + pfIsVerticalStretchAlignmentTreatedAsNear, + pfIsLayoutRefreshed)); + } return S_OK; } @@ -369,10 +479,23 @@ CUIDMContainer::GetManipulationSecondaryContent( pOffsets->width = pOffsets->height = 0.0f; - IFC_RETURN(FxCallbacks::UIElement_GetManipulationSecondaryContent( - m_pUIElement, - pContentElement, - pOffsets)); + if (WinAppSdk::Containment::IsChangeEnabled()) + { + if (const auto pUIElement = m_pUIElementWeakRef.lock()) + { + IFC_RETURN(FxCallbacks::UIElement_GetManipulationSecondaryContent( + pUIElement, + pContentElement, + pOffsets)); + } + } + else + { + IFC_RETURN(FxCallbacks::UIElement_GetManipulationSecondaryContent( + m_pUIElement, + pContentElement, + pOffsets)); + } return S_OK; } @@ -411,15 +534,33 @@ CUIDMContainer::GetManipulationPrimaryContentTransform( *pZoomFactor = 0.0f; } - IFC_RETURN(FxCallbacks::UIElement_GetManipulationPrimaryContentTransform( - m_pUIElement, - pManipulatedElement, - fInManipulation, - fForInitialTransformationAdjustment, - fForMargins, - pTranslationX, - pTranslationY, - pZoomFactor)); + if (WinAppSdk::Containment::IsChangeEnabled()) + { + if (const auto pUIElement = m_pUIElementWeakRef.lock()) + { + IFC_RETURN(FxCallbacks::UIElement_GetManipulationPrimaryContentTransform( + pUIElement, + pManipulatedElement, + fInManipulation, + fForInitialTransformationAdjustment, + fForMargins, + pTranslationX, + pTranslationY, + pZoomFactor)); + } + } + else + { + IFC_RETURN(FxCallbacks::UIElement_GetManipulationPrimaryContentTransform( + m_pUIElement, + pManipulatedElement, + fInManipulation, + fForInitialTransformationAdjustment, + fForMargins, + pTranslationX, + pTranslationY, + pZoomFactor)); + } return S_OK; } @@ -447,12 +588,27 @@ CUIDMContainer::GetManipulationSecondaryContentTransform( IFCPTR_RETURN(pZoomFactor); *pZoomFactor = 1.0f; - IFC_RETURN(FxCallbacks::UIElement_GetManipulationSecondaryContentTransform( - m_pUIElement, - pContentElement, - pTranslationX, - pTranslationY, - pZoomFactor)); + if (WinAppSdk::Containment::IsChangeEnabled()) + { + if (const auto pUIElement = m_pUIElementWeakRef.lock()) + { + IFC_RETURN(FxCallbacks::UIElement_GetManipulationSecondaryContentTransform( + pUIElement, + pContentElement, + pTranslationX, + pTranslationY, + pZoomFactor)); + } + } + else + { + IFC_RETURN(FxCallbacks::UIElement_GetManipulationSecondaryContentTransform( + m_pUIElement, + pContentElement, + pTranslationX, + pTranslationY, + pZoomFactor)); + } return S_OK; } @@ -514,18 +670,39 @@ CUIDMContainer::GetManipulationSnapPoints( *pSnapCoordinate = (motionType == XcpDMMotionTypeZoom) ? XcpDMSnapCoordinateOrigin : XcpDMSnapCoordinateBoundary; } - IFC_RETURN(FxCallbacks::UIElement_GetManipulationSnapPoints( - m_pUIElement, - pManipulatedElement, - motionType, - pfAreSnapPointsOptional, - pfAreSnapPointsSingle, - pfAreSnapPointsRegular, - pRegularOffset, - pRegularInterval, - pcIrregularSnapPoints, - ppIrregularSnapPoints, - reinterpret_cast(pSnapCoordinate))); + if (WinAppSdk::Containment::IsChangeEnabled()) + { + if (const auto pUIElement = m_pUIElementWeakRef.lock()) + { + IFC_RETURN(FxCallbacks::UIElement_GetManipulationSnapPoints( + pUIElement, + pManipulatedElement, + motionType, + pfAreSnapPointsOptional, + pfAreSnapPointsSingle, + pfAreSnapPointsRegular, + pRegularOffset, + pRegularInterval, + pcIrregularSnapPoints, + ppIrregularSnapPoints, + reinterpret_cast(pSnapCoordinate))); + } + } + else + { + IFC_RETURN(FxCallbacks::UIElement_GetManipulationSnapPoints( + m_pUIElement, + pManipulatedElement, + motionType, + pfAreSnapPointsOptional, + pfAreSnapPointsSingle, + pfAreSnapPointsRegular, + pRegularOffset, + pRegularInterval, + pcIrregularSnapPoints, + ppIrregularSnapPoints, + reinterpret_cast(pSnapCoordinate))); + } return S_OK; } @@ -546,9 +723,21 @@ CUIDMContainer::NotifyManipulatabilityAffectingPropertyChanged( { IFCEXPECT_ASSERT_RETURN(m_pCoreServices); - IFC_RETURN(FxCallbacks::UIElement_NotifyManipulatabilityAffectingPropertyChanged( - m_pUIElement, - fIsInLiveTree)); + if (WinAppSdk::Containment::IsChangeEnabled()) + { + if (const auto pUIElement = m_pUIElementWeakRef.lock()) + { + IFC_RETURN(FxCallbacks::UIElement_NotifyManipulatabilityAffectingPropertyChanged( + pUIElement, + fIsInLiveTree)); + } + } + else + { + IFC_RETURN(FxCallbacks::UIElement_NotifyManipulatabilityAffectingPropertyChanged( + m_pUIElement, + fIsInLiveTree)); + } return S_OK; } @@ -574,12 +763,27 @@ CUIDMContainer::NotifyContentAlignmentAffectingPropertyChanged( IFCPTR_RETURN(pManipulatedElement); - IFC_RETURN(FxCallbacks::UIElement_NotifyContentAlignmentAffectingPropertyChanged( - m_pUIElement, - pManipulatedElement, - fIsForHorizontalAlignment, - fIsForStretchAlignment, - fIsStretchAlignmentTreatedAsNear)); + if (WinAppSdk::Containment::IsChangeEnabled()) + { + if (const auto pUIElement = m_pUIElementWeakRef.lock()) + { + IFC_RETURN(FxCallbacks::UIElement_NotifyContentAlignmentAffectingPropertyChanged( + pUIElement, + pManipulatedElement, + fIsForHorizontalAlignment, + fIsForStretchAlignment, + fIsStretchAlignmentTreatedAsNear)); + } + } + else + { + IFC_RETURN(FxCallbacks::UIElement_NotifyContentAlignmentAffectingPropertyChanged( + m_pUIElement, + pManipulatedElement, + fIsForHorizontalAlignment, + fIsForStretchAlignment, + fIsStretchAlignmentTreatedAsNear)); + } return S_OK; } @@ -614,22 +818,47 @@ CUIDMContainer::NotifyManipulationProgress( IFCPTR_RETURN(pManipulatedElement); - IFC_RETURN(FxCallbacks::UIElement_NotifyManipulationProgress( - m_pUIElement, - pManipulatedElement, - static_cast(state), - xCumulativeTranslation, - yCumulativeTranslation, - zCumulativeFactor, - xInertiaEndTranslation, - yInertiaEndTranslation, - zInertiaEndFactor, - xCenter, - yCenter, - fIsInertiaEndTransformValid, - fIsInertial, - fIsTouchConfigurationActivated, - fIsBringIntoViewportConfigurationActivated)); + if (WinAppSdk::Containment::IsChangeEnabled()) + { + if (const auto pUIElement = m_pUIElementWeakRef.lock()) + { + IFC_RETURN(FxCallbacks::UIElement_NotifyManipulationProgress( + pUIElement, + pManipulatedElement, + static_cast(state), + xCumulativeTranslation, + yCumulativeTranslation, + zCumulativeFactor, + xInertiaEndTranslation, + yInertiaEndTranslation, + zInertiaEndFactor, + xCenter, + yCenter, + fIsInertiaEndTransformValid, + fIsInertial, + fIsTouchConfigurationActivated, + fIsBringIntoViewportConfigurationActivated)); + } + } + else + { + IFC_RETURN(FxCallbacks::UIElement_NotifyManipulationProgress( + m_pUIElement, + pManipulatedElement, + static_cast(state), + xCumulativeTranslation, + yCumulativeTranslation, + zCumulativeFactor, + xInertiaEndTranslation, + yInertiaEndTranslation, + zInertiaEndFactor, + xCenter, + yCenter, + fIsInertiaEndTransformValid, + fIsInertial, + fIsTouchConfigurationActivated, + fIsBringIntoViewportConfigurationActivated)); + } return S_OK; } @@ -640,9 +869,21 @@ CUIDMContainer::NotifyManipulationStateChanged( { IFCEXPECT_ASSERT_RETURN(m_pCoreServices); - IFC_RETURN(FxCallbacks::UIElement_NotifyManipulationStateChanged( - m_pUIElement, - static_cast(state))); + if (WinAppSdk::Containment::IsChangeEnabled()) + { + if (const auto pUIElement = m_pUIElementWeakRef.lock()) + { + IFC_RETURN(FxCallbacks::UIElement_NotifyManipulationStateChanged( + pUIElement, + static_cast(state))); + } + } + else + { + IFC_RETURN(FxCallbacks::UIElement_NotifyManipulationStateChanged( + m_pUIElement, + static_cast(state))); + } return S_OK; } @@ -674,14 +915,31 @@ CUIDMContainer::NotifyBringIntoViewportNeeded( IFCPTR_RETURN(pManipulatedElement); - IFC_RETURN(FxCallbacks::UIElement_NotifyBringIntoViewportNeeded( - m_pUIElement, - pManipulatedElement, - translationX, - translationY, - zoomFactor, - fTransformIsValid, - fTransformIsInertiaEnd)); + if (WinAppSdk::Containment::IsChangeEnabled()) + { + if (const auto pUIElement = m_pUIElementWeakRef.lock()) + { + IFC_RETURN(FxCallbacks::UIElement_NotifyBringIntoViewportNeeded( + pUIElement, + pManipulatedElement, + translationX, + translationY, + zoomFactor, + fTransformIsValid, + fTransformIsInertiaEnd)); + } + } + else + { + IFC_RETURN(FxCallbacks::UIElement_NotifyBringIntoViewportNeeded( + m_pUIElement, + pManipulatedElement, + translationX, + translationY, + zoomFactor, + fTransformIsValid, + fTransformIsInertiaEnd)); + } return S_OK; } diff --git a/src/dxaml/xcp/core/optional/elements/touch/UIDMContainerHandler.cpp b/src/dxaml/xcp/core/optional/elements/touch/UIDMContainerHandler.cpp index 11478569dc..d1d5da15b3 100644 --- a/src/dxaml/xcp/core/optional/elements/touch/UIDMContainerHandler.cpp +++ b/src/dxaml/xcp/core/optional/elements/touch/UIDMContainerHandler.cpp @@ -21,7 +21,6 @@ //------------------------------------------------------------------------ CUIDMContainerHandler::CUIDMContainerHandler(_In_ CInputServices* inputServices, _In_ CUIElement* pUIElement) : m_inputServices(inputServices) - , m_pUIElement(pUIElement) { #ifdef DMCH_DBG IGNOREHR(gps->DebugOutputSzNoEndl(L"DMCH[0x%p]: CUIDMContainerHandler - constructor.\r\n", this)); @@ -31,7 +30,16 @@ CUIDMContainerHandler::CUIDMContainerHandler(_In_ CInputServices* inputServices, inputServices->AddRef(); ASSERT(pUIElement); - pUIElement->AddRef(); + + if (WinAppSdk::Containment::IsChangeEnabled()) + { + m_pUIElementWeakRef = xref::get_weakref(pUIElement); + } + else + { + m_pUIElement = pUIElement; + pUIElement->AddRef(); + } } //------------------------------------------------------------------------ @@ -50,7 +58,17 @@ CUIDMContainerHandler::~CUIDMContainerHandler() if (m_inputServices) { - VERIFYHR(m_inputServices->NotifyReleaseManipulationContainer(m_pUIElement)); + if (WinAppSdk::Containment::IsChangeEnabled()) + { + if (const auto pUIElement = m_pUIElementWeakRef.lock()) + { + VERIFYHR(m_inputServices->NotifyReleaseManipulationContainer(pUIElement)); + } + } + else + { + VERIFYHR(m_inputServices->NotifyReleaseManipulationContainer(m_pUIElement)); + } m_inputServices->Release(); m_inputServices = NULL; @@ -110,10 +128,23 @@ CUIDMContainerHandler::NotifyCanManipulateElements( _In_ bool fCanManipulateElementsWithBringIntoViewport) { IFCEXPECT_ASSERT_RETURN(m_inputServices); - IFCEXPECT_ASSERT_RETURN(m_pUIElement); + + if (WinAppSdk::Containment::IsChangeEnabled()) + { + const auto pUIElement = m_pUIElementWeakRef.lock(); - IFC_RETURN(m_inputServices->NotifyCanManipulateElements( - m_pUIElement, fCanManipulateElementsByTouch, fCanManipulateElementsNonTouch, fCanManipulateElementsWithBringIntoViewport)); + IFCEXPECT_ASSERT_RETURN(pUIElement); + + IFC_RETURN(m_inputServices->NotifyCanManipulateElements( + pUIElement, fCanManipulateElementsByTouch, fCanManipulateElementsNonTouch, fCanManipulateElementsWithBringIntoViewport)); + } + else + { + IFCEXPECT_ASSERT_RETURN(m_pUIElement); + + IFC_RETURN(m_inputServices->NotifyCanManipulateElements( + m_pUIElement, fCanManipulateElementsByTouch, fCanManipulateElementsNonTouch, fCanManipulateElementsWithBringIntoViewport)); + } return S_OK; } @@ -137,10 +168,23 @@ CUIDMContainerHandler::NotifyManipulatableElementChanged( _In_opt_ CUIElement* pNewManipulatableElement) { IFCEXPECT_ASSERT_RETURN(m_inputServices); - IFCEXPECT_ASSERT_RETURN(m_pUIElement); - IFC_RETURN(m_inputServices->NotifyManipulatableElementChanged( - m_pUIElement, pOldManipulatableElement, pNewManipulatableElement)); + if (WinAppSdk::Containment::IsChangeEnabled()) + { + const auto pUIElement = m_pUIElementWeakRef.lock(); + + IFCEXPECT_ASSERT_RETURN(pUIElement); + + IFC_RETURN(m_inputServices->NotifyManipulatableElementChanged( + pUIElement, pOldManipulatableElement, pNewManipulatableElement)); + } + else + { + IFCEXPECT_ASSERT_RETURN(m_pUIElement); + + IFC_RETURN(m_inputServices->NotifyManipulatableElementChanged( + m_pUIElement, pOldManipulatableElement, pNewManipulatableElement)); + } return S_OK; } @@ -161,10 +205,23 @@ CUIDMContainerHandler::NotifySecondaryContentAdded( _In_ XDMContentType contentType) { IFCEXPECT_ASSERT_RETURN(m_inputServices); - IFCEXPECT_ASSERT_RETURN(m_pUIElement); - IFC_RETURN(m_inputServices->NotifySecondaryContentAdded( - m_pUIElement, pManipulatableElement, pContentElement, contentType)); + if (WinAppSdk::Containment::IsChangeEnabled()) + { + const auto pUIElement = m_pUIElementWeakRef.lock(); + + IFCEXPECT_ASSERT_RETURN(pUIElement); + + IFC_RETURN(m_inputServices->NotifySecondaryContentAdded( + pUIElement, pManipulatableElement, pContentElement, contentType)); + } + else + { + IFCEXPECT_ASSERT_RETURN(m_pUIElement); + + IFC_RETURN(m_inputServices->NotifySecondaryContentAdded( + m_pUIElement, pManipulatableElement, pContentElement, contentType)); + } return S_OK; } @@ -184,10 +241,23 @@ CUIDMContainerHandler::NotifySecondaryContentRemoved( _In_ CUIElement* pContentElement) { IFCEXPECT_ASSERT_RETURN(m_inputServices); - IFCEXPECT_ASSERT_RETURN(m_pUIElement); - IFC_RETURN(m_inputServices->NotifySecondaryContentRemoved( - m_pUIElement, pManipulatableElement, pContentElement)); + if (WinAppSdk::Containment::IsChangeEnabled()) + { + const auto pUIElement = m_pUIElementWeakRef.lock(); + + IFCEXPECT_ASSERT_RETURN(pUIElement); + + IFC_RETURN(m_inputServices->NotifySecondaryContentRemoved( + pUIElement, pManipulatableElement, pContentElement)); + } + else + { + IFCEXPECT_ASSERT_RETURN(m_pUIElement); + + IFC_RETURN(m_inputServices->NotifySecondaryContentRemoved( + m_pUIElement, pManipulatableElement, pContentElement)); + } return S_OK; } @@ -214,23 +284,49 @@ CUIDMContainerHandler::NotifyViewportChanged( _Out_ bool* pfConfigurationsUpdated) { IFCEXPECT_ASSERT_RETURN(m_inputServices); - IFCEXPECT_ASSERT_RETURN(m_pUIElement); - - IFCPTR_RETURN(pfConfigurationsUpdated); - *pfConfigurationsUpdated = FALSE; - - IFC_RETURN(m_inputServices->NotifyViewportChanged( - m_pUIElement, - pManipulatedElement, - fInManipulation, - fBoundsChanged, - fTouchConfigurationChanged, - fNonTouchConfigurationChanged, - fConfigurationsChanged, - fChainedMotionTypesChanged, - fHorizontalOverpanModeChanged, - fVerticalOverpanModeChanged, - pfConfigurationsUpdated)); + + if (WinAppSdk::Containment::IsChangeEnabled()) + { + const auto pUIElement = m_pUIElementWeakRef.lock(); + + IFCEXPECT_ASSERT_RETURN(pUIElement); + + IFCPTR_RETURN(pfConfigurationsUpdated); + *pfConfigurationsUpdated = FALSE; + + IFC_RETURN(m_inputServices->NotifyViewportChanged( + pUIElement, + pManipulatedElement, + fInManipulation, + fBoundsChanged, + fTouchConfigurationChanged, + fNonTouchConfigurationChanged, + fConfigurationsChanged, + fChainedMotionTypesChanged, + fHorizontalOverpanModeChanged, + fVerticalOverpanModeChanged, + pfConfigurationsUpdated)); + } + else + { + IFCEXPECT_ASSERT_RETURN(m_pUIElement); + + IFCPTR_RETURN(pfConfigurationsUpdated); + *pfConfigurationsUpdated = FALSE; + + IFC_RETURN(m_inputServices->NotifyViewportChanged( + m_pUIElement, + pManipulatedElement, + fInManipulation, + fBoundsChanged, + fTouchConfigurationChanged, + fNonTouchConfigurationChanged, + fConfigurationsChanged, + fChainedMotionTypesChanged, + fHorizontalOverpanModeChanged, + fVerticalOverpanModeChanged, + pfConfigurationsUpdated)); + } return S_OK; } @@ -254,17 +350,37 @@ CUIDMContainerHandler::NotifyPrimaryContentChanged( _In_ bool fZoomFactorBoundaryChanged) { IFCEXPECT_ASSERT_RETURN(m_inputServices); - IFCEXPECT_ASSERT_RETURN(m_pUIElement); - - IFC_RETURN(m_inputServices->NotifyPrimaryContentChanged( - m_pUIElement, - pManipulatedElement, - fInManipulation, - fLayoutRefreshed, - fBoundsChanged, - fHorizontalChanged, - fVerticalChanged, - fZoomFactorBoundaryChanged)); + + if (WinAppSdk::Containment::IsChangeEnabled()) + { + const auto pUIElement = m_pUIElementWeakRef.lock(); + + IFCEXPECT_ASSERT_RETURN(pUIElement); + + IFC_RETURN(m_inputServices->NotifyPrimaryContentChanged( + pUIElement, + pManipulatedElement, + fInManipulation, + fLayoutRefreshed, + fBoundsChanged, + fHorizontalChanged, + fVerticalChanged, + fZoomFactorBoundaryChanged)); + } + else + { + IFCEXPECT_ASSERT_RETURN(m_pUIElement); + + IFC_RETURN(m_inputServices->NotifyPrimaryContentChanged( + m_pUIElement, + pManipulatedElement, + fInManipulation, + fLayoutRefreshed, + fBoundsChanged, + fHorizontalChanged, + fVerticalChanged, + fZoomFactorBoundaryChanged)); + } return S_OK; } @@ -287,10 +403,23 @@ CUIDMContainerHandler::NotifyPrimaryContentTransformChanged( _In_ bool fZoomFactorChanged) { IFCEXPECT_ASSERT_RETURN(m_inputServices); - IFCEXPECT_ASSERT_RETURN(m_pUIElement); - IFC_RETURN(m_inputServices->NotifyPrimaryContentTransformChanged( - m_pUIElement, pManipulatedElement, fInManipulation, fTranslationXChanged, fTranslationYChanged, fZoomFactorChanged)); + if (WinAppSdk::Containment::IsChangeEnabled()) + { + const auto pUIElement = m_pUIElementWeakRef.lock(); + + IFCEXPECT_ASSERT_RETURN(pUIElement); + + IFC_RETURN(m_inputServices->NotifyPrimaryContentTransformChanged( + pUIElement, pManipulatedElement, fInManipulation, fTranslationXChanged, fTranslationYChanged, fZoomFactorChanged)); + } + else + { + IFCEXPECT_ASSERT_RETURN(m_pUIElement); + + IFC_RETURN(m_inputServices->NotifyPrimaryContentTransformChanged( + m_pUIElement, pManipulatedElement, fInManipulation, fTranslationXChanged, fTranslationYChanged, fZoomFactorChanged)); + } return S_OK; } @@ -309,10 +438,23 @@ CUIDMContainerHandler::NotifySnapPointsChanged( _In_ XDMMotionTypes motionType) { IFCEXPECT_ASSERT_RETURN(m_inputServices); - IFCEXPECT_ASSERT_RETURN(m_pUIElement); - IFC_RETURN(m_inputServices->NotifySnapPointsChanged( - m_pUIElement, pManipulatedElement, motionType)); + if (WinAppSdk::Containment::IsChangeEnabled()) + { + const auto pUIElement = m_pUIElementWeakRef.lock(); + + IFCEXPECT_ASSERT_RETURN(pUIElement); + + IFC_RETURN(m_inputServices->NotifySnapPointsChanged( + pUIElement, pManipulatedElement, motionType)); + } + else + { + IFCEXPECT_ASSERT_RETURN(m_pUIElement); + + IFC_RETURN(m_inputServices->NotifySnapPointsChanged( + m_pUIElement, pManipulatedElement, motionType)); + } return S_OK; } @@ -337,10 +479,23 @@ CUIDMContainerHandler::GetPrimaryContentTransform( _Out_ XFLOAT& zoomFactorY) { IFCEXPECT_ASSERT_RETURN(m_inputServices); - IFCEXPECT_ASSERT_RETURN(m_pUIElement); - IFC_RETURN(m_inputServices->GetPrimaryContentTransform( - m_pUIElement, pManipulatedElement, fForBringIntoViewport, translationX, translationY, uncompressedZoomFactor, zoomFactorX, zoomFactorY)); + if (WinAppSdk::Containment::IsChangeEnabled()) + { + const auto pUIElement = m_pUIElementWeakRef.lock(); + + IFCEXPECT_ASSERT_RETURN(pUIElement); + + IFC_RETURN(m_inputServices->GetPrimaryContentTransform( + pUIElement, pManipulatedElement, fForBringIntoViewport, translationX, translationY, uncompressedZoomFactor, zoomFactorX, zoomFactorY)); + } + else + { + IFCEXPECT_ASSERT_RETURN(m_pUIElement); + + IFC_RETURN(m_inputServices->GetPrimaryContentTransform( + m_pUIElement, pManipulatedElement, fForBringIntoViewport, translationX, translationY, uncompressedZoomFactor, zoomFactorX, zoomFactorY)); + } return S_OK; } @@ -380,10 +535,23 @@ CUIDMContainerHandler::BringIntoViewport( _Out_ bool* pfHandled) { IFCEXPECT_ASSERT_RETURN(m_inputServices); - IFCEXPECT_ASSERT_RETURN(m_pUIElement); - IFC_RETURN(m_inputServices->BringIntoViewport( - m_pUIElement, pManipulatedElement, bounds, translateX, translateY, zoomFactor, fTransformIsValid, fSkipDuringTouchContact, fSkipAnimationWhileRunning, fAnimate, fApplyAsManip, fIsForMakeVisible, pfHandled)); + if (WinAppSdk::Containment::IsChangeEnabled()) + { + const auto pUIElement = m_pUIElementWeakRef.lock(); + + IFCEXPECT_ASSERT_RETURN(pUIElement); + + IFC_RETURN(m_inputServices->BringIntoViewport( + pUIElement, pManipulatedElement, bounds, translateX, translateY, zoomFactor, fTransformIsValid, fSkipDuringTouchContact, fSkipAnimationWhileRunning, fAnimate, fApplyAsManip, fIsForMakeVisible, pfHandled)); + } + else + { + IFCEXPECT_ASSERT_RETURN(m_pUIElement); + + IFC_RETURN(m_inputServices->BringIntoViewport( + m_pUIElement, pManipulatedElement, bounds, translateX, translateY, zoomFactor, fTransformIsValid, fSkipDuringTouchContact, fSkipAnimationWhileRunning, fAnimate, fApplyAsManip, fIsForMakeVisible, pfHandled)); + } return S_OK; } @@ -403,10 +571,23 @@ CUIDMContainerHandler::SetConstantVelocities( _In_ XFLOAT panYVelocity) { IFCEXPECT_ASSERT_RETURN(m_inputServices); - IFCEXPECT_ASSERT_RETURN(m_pUIElement); - IFC_RETURN(m_inputServices->SetConstantVelocities( - m_pUIElement, pManipulatedElement, panXVelocity, panYVelocity)); + if (WinAppSdk::Containment::IsChangeEnabled()) + { + const auto pUIElement = m_pUIElementWeakRef.lock(); + + IFCEXPECT_ASSERT_RETURN(pUIElement); + + IFC_RETURN(m_inputServices->SetConstantVelocities( + pUIElement, pManipulatedElement, panXVelocity, panYVelocity)); + } + else + { + IFCEXPECT_ASSERT_RETURN(m_pUIElement); + + IFC_RETURN(m_inputServices->SetConstantVelocities( + m_pUIElement, pManipulatedElement, panXVelocity, panYVelocity)); + } return S_OK; } @@ -428,12 +609,27 @@ CUIDMContainerHandler::ProcessInputMessage( _Out_ bool& fHandled) { IFCEXPECT_ASSERT_RETURN(m_inputServices); - IFCEXPECT_ASSERT_RETURN(m_pUIElement); - CContentRoot* contentRoot = VisualTree::GetContentRootForElement(m_pUIElement); + if (WinAppSdk::Containment::IsChangeEnabled()) + { + const auto pUIElement = m_pUIElementWeakRef.lock(); + + IFCEXPECT_ASSERT_RETURN(pUIElement); - IFC_RETURN(m_inputServices->ProcessInputMessageWithDirectManipulation( - m_pUIElement, pManipulatedElement, ignoreFlowDirection, contentRoot, fHandled)); + CContentRoot* contentRoot = VisualTree::GetContentRootForElement(pUIElement); + + IFC_RETURN(m_inputServices->ProcessInputMessageWithDirectManipulation( + pUIElement, pManipulatedElement, ignoreFlowDirection, contentRoot, fHandled)); + } + else + { + IFCEXPECT_ASSERT_RETURN(m_pUIElement); + + CContentRoot* contentRoot = VisualTree::GetContentRootForElement(m_pUIElement); + + IFC_RETURN(m_inputServices->ProcessInputMessageWithDirectManipulation( + m_pUIElement, pManipulatedElement, ignoreFlowDirection, contentRoot, fHandled)); + } return S_OK; } @@ -446,10 +642,23 @@ CUIDMContainerHandler::StopInertialViewport( _Out_ bool* pHandled) { ASSERT(m_inputServices); - ASSERT(m_pUIElement); - IFC_RETURN(m_inputServices->StopInertialViewport( - m_pUIElement, pManipulatedElement, pHandled)); + if (WinAppSdk::Containment::IsChangeEnabled()) + { + const auto pUIElement = m_pUIElementWeakRef.lock(); + + ASSERT(pUIElement); + + IFC_RETURN(m_inputServices->StopInertialViewport( + pUIElement, pManipulatedElement, pHandled)); + } + else + { + ASSERT(m_pUIElement); + + IFC_RETURN(m_inputServices->StopInertialViewport( + m_pUIElement, pManipulatedElement, pHandled)); + } return S_OK; } diff --git a/src/eng/Version.Details.xml b/src/eng/Version.Details.xml index a36df7cf3c..476c38037d 100644 --- a/src/eng/Version.Details.xml +++ b/src/eng/Version.Details.xml @@ -2,27 +2,27 @@ - + https://dev.azure.com/microsoft/ProjectReunion/_git/WindowsAppSDK - 6b2791467236dc1325d58c7f44fccbabd1c90189 + 5f333edbf2a7c8c72c431c7b5a1d6d7cab6375aa - + https://dev.azure.com/microsoft/LiftedIXP/_git/DCPP - 943a920dac1612ac395a09f42af287a08e6eddac + 7eafc2f38b361a0476b8d3336ca34b6811f00920 - + https://dev.azure.com/microsoft/LiftedIXP/_git/DCPP - 943a920dac1612ac395a09f42af287a08e6eddac + 7eafc2f38b361a0476b8d3336ca34b6811f00920 - + https://dev.azure.com/microsoft/ProjectReunion/_git/WindowsAppSDKClosed - f46219627990ea87389c046b665854f6e794bc49 + b52174b1bb7916451fee250ccec1cd2bfb3e86e1 - + https://dev.azure.com/microsoft/ProjectReunion/_git/WindowsAppSDKClosed - f46219627990ea87389c046b665854f6e794bc49 + b52174b1bb7916451fee250ccec1cd2bfb3e86e1