mirror of
https://github.com/elasota/Aerofoil.git
synced 2025-12-14 03:59:36 +00:00
Fix display resolution desynchronizing with auto-position
This commit is contained in:
@@ -11,6 +11,7 @@
|
||||
#include "MenuManager.h"
|
||||
#include "IGpDisplayDriver.h"
|
||||
#include "IGpSystemServices.h"
|
||||
#include "Vec2i.h"
|
||||
#include "WindowManager.h"
|
||||
|
||||
#include "PLDrivers.h"
|
||||
@@ -420,11 +421,9 @@ void HandleDepthSwitching (void)
|
||||
|
||||
void GetDeviceRect(Rect *rect)
|
||||
{
|
||||
unsigned int width;
|
||||
unsigned int height;
|
||||
PLDrivers::GetDisplayDriver()->GetDisplayResolution(&width, &height);
|
||||
PortabilityLayer::Vec2i displayResolution = PortabilityLayer::WindowManager::GetInstance()->GetDisplayResolution();
|
||||
|
||||
SetRect(rect, 0, 0, static_cast<short>(width), static_cast<short>(height));
|
||||
SetRect(rect, 0, 0, static_cast<short>(displayResolution.m_x), static_cast<short>(displayResolution.m_y));
|
||||
}
|
||||
|
||||
Boolean AreWeColorOrGrayscale()
|
||||
|
||||
@@ -508,8 +508,7 @@ void MoveDialogToTopOfScreen(Dialog *dial)
|
||||
Window *window = dial->GetWindow();
|
||||
PortabilityLayer::Vec2i pos = window->GetPosition();
|
||||
|
||||
unsigned int height = 0;
|
||||
PLDrivers::GetDisplayDriver()->GetDisplayResolution(nullptr, &height);
|
||||
unsigned int height = PortabilityLayer::WindowManager::GetInstance()->GetDisplayResolution().m_y;
|
||||
|
||||
pos.m_y = (height - window->GetDrawSurface()->m_port.GetRect().Height()) / 8;
|
||||
|
||||
|
||||
@@ -169,8 +169,7 @@ static void DrawMainMenuControl(DrawSurface *surface, MainMenuUIState::ControlID
|
||||
|
||||
void StartScrollForPage()
|
||||
{
|
||||
unsigned int displayHeight = 0;
|
||||
PLDrivers::GetDisplayDriver()->GetDisplayResolution(nullptr, &displayHeight);
|
||||
unsigned int displayHeight = PortabilityLayer::WindowManager::GetInstance()->GetDisplayResolution().m_y;
|
||||
|
||||
DismissMainMenuUI();
|
||||
|
||||
@@ -263,8 +262,7 @@ void StartMainMenuUI()
|
||||
|
||||
static void DismissMainMenuUIPage()
|
||||
{
|
||||
unsigned int displayHeight = 0;
|
||||
PLDrivers::GetDisplayDriver()->GetDisplayResolution(nullptr, &displayHeight);
|
||||
unsigned int displayHeight = PortabilityLayer::WindowManager::GetInstance()->GetDisplayResolution().m_y;
|
||||
|
||||
PortabilityLayer::WindowManager *wm = PortabilityLayer::WindowManager::GetInstance();
|
||||
|
||||
@@ -293,8 +291,7 @@ void TickMainMenuUI()
|
||||
{
|
||||
PortabilityLayer::WindowManager *wm = PortabilityLayer::WindowManager::GetInstance();
|
||||
|
||||
unsigned int displayHeight = 0;
|
||||
PLDrivers::GetDisplayDriver()->GetDisplayResolution(nullptr, &displayHeight);
|
||||
unsigned int displayHeight = PortabilityLayer::WindowManager::GetInstance()->GetDisplayResolution().m_y;
|
||||
|
||||
mainMenu.m_scrollInStep -= MainMenuUIState::kControlScrollInDecay;
|
||||
mainMenu.m_scrollInOffset -= (mainMenu.m_scrollInStep >> MainMenuUIState::kControlScrollInDecayFalloffBits);
|
||||
@@ -328,8 +325,7 @@ void HandleMainMenuUIResolutionChange()
|
||||
{
|
||||
PortabilityLayer::WindowManager *wm = PortabilityLayer::WindowManager::GetInstance();
|
||||
|
||||
unsigned int displayHeight = 0;
|
||||
PLDrivers::GetDisplayDriver()->GetDisplayResolution(nullptr, &displayHeight);
|
||||
unsigned int displayHeight = PortabilityLayer::WindowManager::GetInstance()->GetDisplayResolution().m_y;
|
||||
|
||||
for (int i = 0; i < MainMenuUIState::Control_Count; i++)
|
||||
{
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#include "CombinedTimestamp.h"
|
||||
#include "DeflateCodec.h"
|
||||
#include "Environ.h"
|
||||
#include "FontFamily.h"
|
||||
#include "GpBuildVersion.h"
|
||||
#include "GpIOStream.h"
|
||||
#include "GpFileCreationDisposition.h"
|
||||
@@ -12,10 +13,10 @@
|
||||
#include "GpApplicationName.h"
|
||||
#include "GpRenderedFontMetrics.h"
|
||||
#include "ResolveCachingColor.h"
|
||||
#include "ZipFile.h"
|
||||
#include "Vec2i.h"
|
||||
#include "WindowDef.h"
|
||||
#include "WindowManager.h"
|
||||
#include "FontFamily.h"
|
||||
#include "ZipFile.h"
|
||||
|
||||
#include "PLCore.h"
|
||||
#include "PLDrivers.h"
|
||||
@@ -140,9 +141,9 @@ static void InitSourceExportWindow(SourceExportState *state)
|
||||
|
||||
// We have to use this instead of thisMac.fullScreen because the resolution may change during the sleep call, especially on Android displays where
|
||||
// the status bar dismissal causes a major change in the virtual resolution.
|
||||
unsigned int displayWidth = 0;
|
||||
unsigned int displayHeight = 0;
|
||||
PLDrivers::GetDisplayDriver()->GetDisplayResolution(&displayWidth, &displayHeight);
|
||||
PortabilityLayer::Vec2i displaySize = PortabilityLayer::WindowManager::GetInstance()->GetDisplayResolution();
|
||||
unsigned int displayWidth = displaySize.m_x;
|
||||
unsigned int displayHeight = displaySize.m_y;
|
||||
|
||||
int32_t lsX = (static_cast<int32_t>(displayWidth) - kLoadScreenWidth) / 2;
|
||||
int32_t lsY = (static_cast<int32_t>(displayHeight) - kLoadScreenHeight) / 2;
|
||||
|
||||
Reference in New Issue
Block a user