This commit is contained in:
Sakura 2023-01-27 13:12:31 -07:00 committed by GitHub
commit b5df8b11d7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 31 additions and 1 deletions

View file

@ -34,6 +34,7 @@ using namespace Windows::ApplicationModel::Core;
using namespace Windows::ApplicationModel::Activation;
using namespace Windows::Devices::Input;
using namespace Windows::Graphics::Display;
using namespace Windows::Graphics::Display::Core;
using namespace Windows::Foundation;
using namespace Windows::System;
using namespace Windows::UI::Core;
@ -120,7 +121,13 @@ static void WINRT_ProcessWindowSizeChange() // TODO: Pass an SDL_Window-identify
int y = WINRT_DIPS_TO_PHYSICAL_PIXELS(data->coreWindow->Bounds.Top);
int w = WINRT_DIPS_TO_PHYSICAL_PIXELS(data->coreWindow->Bounds.Width);
int h = WINRT_DIPS_TO_PHYSICAL_PIXELS(data->coreWindow->Bounds.Height);
if (SDL_WinRTGetDeviceFamily() == SDL_WINRT_DEVICEFAMILY_XBOX) {
HdmiDisplayInformation ^ hdi = HdmiDisplayInformation::GetForCurrentView();
if (hdi) {
w = hdi->GetCurrentDisplayMode()->ResolutionWidthInRawPixels;
h = hdi->GetCurrentDisplayMode()->ResolutionHeightInRawPixels;
}
}
#if (WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP) && (NTDDI_VERSION == NTDDI_WIN8)
/* WinPhone 8.0 always keeps its native window size in portrait,
regardless of orientation. This changes in WinPhone 8.1,

View file

@ -43,6 +43,7 @@ using namespace std;
using namespace Windows::ApplicationModel::Core;
using namespace Windows::Foundation;
using namespace Windows::Graphics::Display;
using namespace Windows::Graphics::Display::Core;
using namespace Windows::UI::Core;
using namespace Windows::UI::ViewManagement;
@ -417,6 +418,14 @@ static int WINRT_AddDisplaysForAdapter(_THIS, IDXGIFactory2 *dxgiFactory2, int a
#if (NTDDI_VERSION >= NTDDI_WIN10) || (SDL_WINRT_USE_APPLICATIONVIEW && WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP)
mode.w = WINRT_DIPS_TO_PHYSICAL_PIXELS(appView->VisibleBounds.Width);
mode.h = WINRT_DIPS_TO_PHYSICAL_PIXELS(appView->VisibleBounds.Height);
if (SDL_WinRTGetDeviceFamily() == SDL_WINRT_DEVICEFAMILY_XBOX) {
HdmiDisplayInformation ^ hdi = HdmiDisplayInformation::GetForCurrentView();
if (hdi) {
mode.w = hdi->GetCurrentDisplayMode()->ResolutionWidthInRawPixels;
mode.h = hdi->GetCurrentDisplayMode()->ResolutionHeightInRawPixels;
}
}
#else
/* On platform(s) that do not support VisibleBounds, such as Windows 8.1,
fall back to CoreWindow's Bounds property.
@ -510,6 +519,13 @@ WINRT_DetectWindowFlags(SDL_Window *window)
SDL_VideoDisplay *display = SDL_GetDisplayForWindow(window);
int w = WINRT_DIPS_TO_PHYSICAL_PIXELS(data->coreWindow->Bounds.Width);
int h = WINRT_DIPS_TO_PHYSICAL_PIXELS(data->coreWindow->Bounds.Height);
if (SDL_WinRTGetDeviceFamily() == SDL_WINRT_DEVICEFAMILY_XBOX) {
HdmiDisplayInformation ^ hdi = HdmiDisplayInformation::GetForCurrentView();
if (hdi) {
w = hdi->GetCurrentDisplayMode()->ResolutionWidthInRawPixels;
h = hdi->GetCurrentDisplayMode()->ResolutionHeightInRawPixels;
}
}
#if (WINAPI_FAMILY != WINAPI_FAMILY_PHONE_APP) || (NTDDI_VERSION > NTDDI_WIN8)
// On all WinRT platforms, except for WinPhone 8.0, rotate the
@ -723,6 +739,13 @@ int WINRT_CreateWindow(_THIS, SDL_Window *window)
*/
window->w = WINRT_DIPS_TO_PHYSICAL_PIXELS(data->coreWindow->Bounds.Width);
window->h = WINRT_DIPS_TO_PHYSICAL_PIXELS(data->coreWindow->Bounds.Height);
if (SDL_WinRTGetDeviceFamily() == SDL_WINRT_DEVICEFAMILY_XBOX) {
HdmiDisplayInformation ^ hdi = HdmiDisplayInformation::GetForCurrentView();
if (hdi) {
window->w = hdi->GetCurrentDisplayMode()->ResolutionWidthInRawPixels;
window->h = hdi->GetCurrentDisplayMode()->ResolutionHeightInRawPixels;
}
}
}
#endif