@@ -49,42 +49,39 @@ DisplayRegionHelperInfo DisplayRegionHelper::GetRegionInfo()
49
49
}
50
50
}
51
51
#ifdef USE_INSIDER_SDK
52
- else if (SharedHelpers::IsDisplayRegionGetForCurrentViewAvailable ())
52
+ else if (SharedHelpers::IsApplicationViewGetDisplayRegionsAvailable ())
53
53
{
54
- // TODO: remove try/catch after bug 14084372 is fixed. These APIs currently throw on failure .
55
- winrt::WindowingEnvironment environment { nullptr };
54
+ // ApplicationView::GetForCurrentView throws on failure; in that case we just won't do anything .
55
+ winrt::ApplicationView view { nullptr };
56
56
try
57
57
{
58
- environment = winrt::Windows::UI::ViewManagement:: ApplicationView::GetForCurrentView (). WindowingEnvironment ();
58
+ view = winrt::ApplicationView::GetForCurrentView ();
59
59
} catch (...) {}
60
60
61
61
// Verify that the window is Tiled
62
- if (environment )
62
+ if (view )
63
63
{
64
- if (environment.Kind () == winrt::WindowingEnvironmentKind::Tiled)
64
+ auto regions = view.GetDisplayRegions ();
65
+ info.RegionCount = std::min (regions.Size (), c_maxRegions);
66
+
67
+ // More than one region
68
+ if (info.RegionCount == 2 )
65
69
{
66
- winrt::IVectorView<winrt::Windows::UI::WindowManagement::DisplayRegion> regions = winrt::Windows::UI::ViewManagement::ApplicationView::GetForCurrentView ().GetDisplayRegions ();
67
- info.RegionCount = std::min (regions.Size (), c_maxRegions);
70
+ winrt::Rect windowRect = WindowRect ();
68
71
69
- // More than one region
70
- if (info.RegionCount == 2 )
72
+ if (windowRect.Width > windowRect.Height )
73
+ {
74
+ info.Mode = winrt::TwoPaneViewMode::Wide;
75
+ float width = windowRect.Width / 2 ;
76
+ info.Regions [0 ] = { 0 , 0 , width, windowRect.Height };
77
+ info.Regions [1 ] = { width, 0 , width, windowRect.Height };
78
+ }
79
+ else
71
80
{
72
- winrt::Rect windowRect = WindowRect ();
73
-
74
- if (windowRect.Width > windowRect.Height )
75
- {
76
- info.Mode = winrt::TwoPaneViewMode::Wide;
77
- float width = windowRect.Width / 2 ;
78
- info.Regions [0 ] = { 0 , 0 , width, windowRect.Height };
79
- info.Regions [1 ] = { width, 0 , width, windowRect.Height };
80
- }
81
- else
82
- {
83
- info.Mode = winrt::TwoPaneViewMode::Tall;
84
- float height = windowRect.Height / 2 ;
85
- info.Regions [0 ] = { 0 , 0 , windowRect.Width , height };
86
- info.Regions [1 ] = { 0 , height, windowRect.Width , height };
87
- }
81
+ info.Mode = winrt::TwoPaneViewMode::Tall;
82
+ float height = windowRect.Height / 2 ;
83
+ info.Regions [0 ] = { 0 , 0 , windowRect.Width , height };
84
+ info.Regions [1 ] = { 0 , height, windowRect.Width , height };
88
85
}
89
86
}
90
87
}
0 commit comments