Skip to content

Commit 2a60e27

Browse files
author
reunion-maestro-bot
committed
Syncing content from committish 6e5ee01fe694bcc02764b566a989faf7e907b063
1 parent b91b3ce commit 2a60e27

File tree

17 files changed

+237
-19
lines changed

17 files changed

+237
-19
lines changed

controls/dev/Lights/MaterialHelper.cpp

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@
1111
#include "RevealHoverLight.h"
1212
#include "ResourceAccessor.h"
1313
#include "LifetimeHandler.h"
14+
#include <FrameworkUdk/Containment.h>
15+
16+
// Bug 50308952: [1.5 servicing] Add workaround to WinUI for UISettings RPC_E_WRONG_THREAD issue that is being hit by Photos app
17+
#define WINAPPSDK_CHANGEID_50308952 50308952
1418

1519
/* static */
1620
bool MaterialHelperBase::SimulateDisabledByPolicy()
@@ -422,7 +426,28 @@ void MaterialHelper::UpdatePolicyStatus(bool onUIThread)
422426
auto callback = [strongThis, this]() {
423427
const bool isEnergySaverMode = m_energySaverStatusChangedRevokerValid ? winrt::PowerManager::EnergySaverStatus() == winrt::EnergySaverStatus::On : true;
424428
const bool areEffectsFast = m_compositionCapabilities ? (m_compositionCapabilities.AreEffectsFast() || m_ignoreAreEffectsFast) : false;
425-
const bool advancedEffectsEnabled = m_uiSettings ? m_uiSettings.AdvancedEffectsEnabled() : true;
429+
430+
bool advancedEffectsEnabled = false;
431+
if (WinAppSdk::Containment::IsChangeEnabled<WINAPPSDK_CHANGEID_50308952>())
432+
{
433+
// We are hitting an issue in Photos where UISettings::AdvancedEffectsEnabled is returning RPC_E_WRONG_THREAD.
434+
// We work around this issue by;
435+
// 1. Use a fresh instance of UISettings instead of the cached m_uiSettings.
436+
// 2. Ignore RPC_E_WRONG_THREAD and use a fallback value.
437+
try
438+
{
439+
winrt::UISettings uiSettings;
440+
advancedEffectsEnabled = uiSettings.AdvancedEffectsEnabled();
441+
}
442+
catch (winrt::hresult_error e)
443+
{
444+
if (e.to_abi() != RPC_E_WRONG_THREAD) { throw; }
445+
}
446+
}
447+
else
448+
{
449+
advancedEffectsEnabled = m_uiSettings ? m_uiSettings.AdvancedEffectsEnabled() : true;
450+
}
426451

427452
bool isDisabledByPolicy = m_simulateDisabledByPolicy || (isEnergySaverMode || !areEffectsFast || !advancedEffectsEnabled);
428453

controls/dev/Repeater/ViewManager.cpp

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@
77
#include "ViewManager.h"
88
#include "ItemsRepeater.h"
99
#include "RepeaterTestHooks.h"
10+
#include <FrameworkUdk/Containment.h>
11+
12+
// Bug 50344748: [1.5 Servicing][WASDK] 1-up viewer opens behind Collections (looks like nothing's happened, but the viewer is actually hidden behind the Collections window)
13+
#define WINAPPSDK_CHANGEID_50344748 50344748
1014

1115
ViewManager::ViewManager(ItemsRepeater* owner) :
1216
m_owner(owner),
@@ -221,7 +225,16 @@ void ViewManager::MoveFocusFromClearedIndex(int clearedIndex)
221225

222226
// If the last focused element has focus, use its focus state, if not use programmatic.
223227
focusState = focusState == winrt::FocusState::Unfocused ? winrt::FocusState::Programmatic : focusState;
224-
focusCandidate.Focus(focusState);
228+
229+
if (WinAppSdk::Containment::IsChangeEnabled<WINAPPSDK_CHANGEID_50344748>())
230+
{
231+
// Since this focus change is due to the focused element getting recycled, don't activate the window.
232+
focusCandidate.as<winrt::IUIElementPrivate>().FocusNoActivate(focusState);
233+
}
234+
else
235+
{
236+
focusCandidate.Focus(focusState);
237+
}
225238

226239
m_lastFocusedElement.set(focusedChild);
227240
// Add pin to hold the focused element.

controls/dev/dll/Microsoft.UI.Xaml.Common.targets

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
<Enumclass>false</Enumclass>
3737
</Midl>
3838
<Link>
39-
<AdditionalDependencies>user32.lib;mincore.lib;dxguid.lib;dcomp.lib;%(AdditionalDependencies)</AdditionalDependencies>
39+
<AdditionalDependencies>user32.lib;mincore.lib;dxguid.lib;dcomp.lib;$(FrameworkUdkLibPath)\Microsoft.Internal.FrameworkUdk.lib;%(AdditionalDependencies)</AdditionalDependencies>
4040
<!-- Microsoft.winmd will contain the definition of both public, preview and private types. -->
4141
<WindowsMetadataFile>$(OutDir)$(ProjectWinMDName)</WindowsMetadataFile>
4242
<GenerateMapFile>true</GenerateMapFile>

dxaml/xcp/components/elements/UIElementLayout.cpp

Lines changed: 43 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@
1010
#include <uielementcollection.h>
1111
#include <LayoutManager.h>
1212
#include "LayoutCycleDebugSettings.h"
13+
#include <FrameworkUdk/Containment.h>
14+
15+
// Bug 50119529: [1.5 servicing] BreadcrumbBar ellipsis flyout doesn't render all items if the window is small
16+
#define WINAPPSDK_CHANGEID_50119529 50119529
1317

1418
void ComputeUnidimensionalEffectiveViewport(
1519
_In_ const std::vector<CUIElement::UnidimensionalViewportInformation>& viewports,
@@ -370,7 +374,7 @@ void CUIElement::InvalidateViewportInternal()
370374
__debugbreak();
371375
}
372376
}
373-
377+
374378
SetIsViewportDirty(TRUE);
375379
PropagateOnViewportDirtyPath();
376380
}
@@ -438,11 +442,23 @@ _Check_return_ HRESULT CUIElement::EffectiveViewportWalk(
438442
if (currentChild->GetIsViewportDirtyOrOnViewportDirtyPath()
439443
|| (newDirtyFound && currentChild->GetWantsViewportOrContributesToViewport()))
440444
{
441-
IFC_RETURN(currentChild->EffectiveViewportWalk(
442-
newDirtyFound,
443-
transformsToViewports,
444-
horizontalViewports,
445-
verticalViewports));
445+
if (WinAppSdk::Containment::IsChangeEnabled<WINAPPSDK_CHANGEID_50119529>())
446+
{
447+
IFC_RETURN(EffectiveViewportWalkToChild(
448+
currentChild,
449+
newDirtyFound,
450+
transformsToViewports,
451+
horizontalViewports,
452+
verticalViewports));
453+
}
454+
else
455+
{
456+
IFC_RETURN(currentChild->EffectiveViewportWalk(
457+
newDirtyFound,
458+
transformsToViewports,
459+
horizontalViewports,
460+
verticalViewports));
461+
}
446462
}
447463

448464
// If at least one of the children still has the viewport
@@ -457,11 +473,32 @@ _Check_return_ HRESULT CUIElement::EffectiveViewportWalk(
457473
// traversing the rest of the visual tree.
458474
if (addedViewports)
459475
{
476+
// This one is a little tricky. CXamlIslandRoot::EffectiveViewportWalkCore will push two viewports without
477+
// pushing a transform, so we technically can't blindly pop all three vectors. But given CXamlIslandRoot is
478+
// always the first element to push anything, the transform vector will be empty anyway when we get back up
479+
// to CXamlIslandRoot to pop things.
460480
transformsToViewports.pop_back();
481+
461482
horizontalViewports.pop_back();
462483
verticalViewports.pop_back();
463484
}
464485
}
465486

466487
return S_OK;
467488
}
489+
490+
_Check_return_ HRESULT CUIElement::EffectiveViewportWalkToChild(
491+
_In_ CUIElement* child,
492+
const bool dirtyFound,
493+
_In_ std::vector<TransformToPreviousViewport>& transformsToViewports,
494+
_In_ std::vector<UnidimensionalViewportInformation>& horizontalViewports,
495+
_In_ std::vector<UnidimensionalViewportInformation>& verticalViewports)
496+
{
497+
IFC_RETURN(child->EffectiveViewportWalk(
498+
dirtyFound,
499+
transformsToViewports,
500+
horizontalViewports,
501+
verticalViewports));
502+
503+
return S_OK;
504+
}

dxaml/xcp/components/metadata/inc/Indexes.g.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3193,6 +3193,7 @@ enum class KnownMethodIndex: UINT16
31933193
UIElement_PopulatePropertyInfoOverride,
31943194
UIElement_InternalGetIsEnabled,
31953195
UIElement_InternalPutIsEnabled,
3196+
UIElement_FocusNoActivate,
31963197
VisualStateManager_GoToState,
31973198
VisualStateManager_GoToStateCore,
31983199
VisualStateManager_RaiseCurrentStateChanging,

dxaml/xcp/components/unittest-uielement.props

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,10 @@
1010

1111
<ItemDefinitionGroup>
1212
<Link>
13-
<AdditionalDependencies>%(AdditionalDependencies) dwmapi.lib;</AdditionalDependencies>
13+
<AdditionalDependencies>
14+
%(AdditionalDependencies) dwmapi.lib;
15+
$(FrameworkUdkLibPath)\Microsoft.Internal.FrameworkUdk.lib;
16+
</AdditionalDependencies>
1417
<AdditionalLibraryDirectories>%(AdditionalLibraryDirectories);$(VC_LibraryPath_VC_Desktop_CurrentPlatform_spectre);</AdditionalLibraryDirectories>
1518
</Link>
1619
</ItemDefinitionGroup>

dxaml/xcp/core/core/elements/Popup.cpp

Lines changed: 70 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5282,8 +5282,7 @@ _Check_return_ HRESULT CPopupRoot::GetTopmostPopupInLightDismissChain(_Out_ CDep
52825282

52835283
//static
52845284
// If the element is an open popup, return that popup
5285-
_Check_return_ HRESULT
5286-
CPopupRoot::GetOpenPopupForElement(
5285+
_Check_return_ HRESULT CPopupRoot::GetOpenPopupForElement(
52875286
_In_ CUIElement *pElement,
52885287
_Outptr_result_maybenull_ CPopup **ppPopup)
52895288
{
@@ -5440,3 +5439,72 @@ bool CPopupRoot::ComputeDepthInOpenPopups()
54405439

54415440
return false;
54425441
}
5442+
5443+
_Check_return_ HRESULT CPopupRoot::EffectiveViewportWalkToChild(
5444+
_In_ CUIElement* child,
5445+
const bool dirtyFound,
5446+
_In_ std::vector<TransformToPreviousViewport>& transformsToViewports,
5447+
_In_ std::vector<UnidimensionalViewportInformation>& horizontalViewports,
5448+
_In_ std::vector<UnidimensionalViewportInformation>& verticalViewports)
5449+
{
5450+
// We expect the popup root at the tree, so there should be at most one viewport (from the main Xaml island) that we've discovered so far.
5451+
ASSERT(horizontalViewports.size() == verticalViewports.size());
5452+
ASSERT(transformsToViewports.size() <= 1);
5453+
ASSERT(horizontalViewports.size() <= 1);
5454+
5455+
bool poppedViewport = false;
5456+
UnidimensionalViewportInformation poppedHorizontalViewport(0, 0);
5457+
UnidimensionalViewportInformation poppedVerticalViewport(0, 0);
5458+
5459+
bool poppedTransform = false;
5460+
TransformToPreviousViewport poppedTransformToViewport(nullptr, nullptr);
5461+
5462+
//
5463+
// Windowed popups aren't limited to the bounds of the main Xaml island. If we walk through a windowed popup during
5464+
// the viewport walk, make sure we clear out the implicit viewport from the main Xaml island bounds.
5465+
//
5466+
xref_ptr<CPopup> popup;
5467+
IFC_RETURN(GetOpenPopupForElement(child, popup.ReleaseAndGetAddressOf()));
5468+
if (popup & popup->IsWindowed())
5469+
{
5470+
if (horizontalViewports.size() == 1)
5471+
{
5472+
poppedHorizontalViewport = horizontalViewports[0];
5473+
horizontalViewports.pop_back();
5474+
5475+
poppedVerticalViewport = verticalViewports[0];
5476+
verticalViewports.pop_back();
5477+
5478+
poppedViewport = true;
5479+
}
5480+
5481+
if (transformsToViewports.size() == 1)
5482+
{
5483+
poppedTransformToViewport = transformsToViewports[0];
5484+
transformsToViewports.pop_back();
5485+
5486+
poppedTransform = true;
5487+
}
5488+
}
5489+
5490+
IFC_RETURN(child->EffectiveViewportWalk(
5491+
dirtyFound,
5492+
transformsToViewports,
5493+
horizontalViewports,
5494+
verticalViewports));
5495+
5496+
if (poppedViewport)
5497+
{
5498+
ASSERT(horizontalViewports.size() == 0);
5499+
horizontalViewports.push_back(poppedHorizontalViewport);
5500+
verticalViewports.push_back(poppedVerticalViewport);
5501+
}
5502+
5503+
if (poppedTransform)
5504+
{
5505+
ASSERT(transformsToViewports.size() == 0);
5506+
transformsToViewports.push_back(poppedTransformToViewport);
5507+
}
5508+
5509+
return S_OK;
5510+
}

dxaml/xcp/core/inc/Popup.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -719,6 +719,13 @@ class CPopupRoot final : public CPanel
719719
_In_ const D2DRenderParams& printParams
720720
) override;
721721

722+
_Check_return_ HRESULT EffectiveViewportWalkToChild(
723+
_In_ CUIElement* child,
724+
const bool dirtyFound,
725+
_In_ std::vector<TransformToPreviousViewport>& transformsToViewports,
726+
_In_ std::vector<UnidimensionalViewportInformation>& horizontalViewports,
727+
_In_ std::vector<UnidimensionalViewportInformation>& verticalViewports) override;
728+
722729
public:
723730

724731
KnownTypeIndex GetTypeIndex() const override

dxaml/xcp/core/inc/uielement.h

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1670,6 +1670,13 @@ class CUIElement : public CDependencyObject
16701670
_In_ std::vector<UnidimensionalViewportInformation>& verticalViewports,
16711671
_Out_ bool& addedViewports);
16721672

1673+
virtual _Check_return_ HRESULT EffectiveViewportWalkToChild(
1674+
_In_ CUIElement* child,
1675+
const bool dirtyFound,
1676+
_In_ std::vector<TransformToPreviousViewport>& transformsToViewports,
1677+
_In_ std::vector<UnidimensionalViewportInformation>& horizontalViewports,
1678+
_In_ std::vector<UnidimensionalViewportInformation>& verticalViewports);
1679+
16731680
private:
16741681
typedef XINT32 (&RoundCeilOrFloorFn)(_In_ XDOUBLE x);
16751682
float LayoutRoundHelper(const float value, _In_ RoundCeilOrFloorFn operationFn);
@@ -2419,7 +2426,7 @@ class CUIElement : public CDependencyObject
24192426

24202427
_Check_return_ HRESULT GetContentInnerBounds(
24212428
_Out_ XRECTF_RB* pBounds
2422-
);
2429+
);
24232430

24242431
_Check_return_ HRESULT GetOuterBounds(
24252432
_In_opt_ HitTestParams *hitTestParams,

dxaml/xcp/dxaml/idl/winrt/main/microsoft.ui.xaml.private.idl

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -273,6 +273,13 @@ namespace Microsoft.UI.Xaml
273273
String XbfHash;
274274
};
275275

276+
[contract(Microsoft.UI.Xaml.PrivateApiContract, 1)]
277+
[webhosthidden]
278+
interface IUIElementPrivate
279+
{
280+
Boolean FocusNoActivate(Microsoft.UI.Xaml.FocusState value);
281+
};
282+
276283
[contract(Microsoft.UI.Xaml.PrivateApiContract, 1)]
277284
[webhosthidden]
278285
interface IUIElementStaticsPrivate

0 commit comments

Comments
 (0)