mirror of
https://github.com/elasota/Aerofoil.git
synced 2025-09-23 14:53:52 +00:00
Fix display resolution desynchronizing with auto-position
This commit is contained in:
@@ -171,6 +171,8 @@ namespace PortabilityLayer
|
||||
WindowManagerImpl();
|
||||
~WindowManagerImpl();
|
||||
|
||||
void Init() override;
|
||||
|
||||
Window *CreateWindow(const WindowDef &windowDef) override;
|
||||
void ResizeWindow(Window *window, int width, int height) override;
|
||||
void MoveWindow(Window *window, int x, int y) override;
|
||||
@@ -198,6 +200,8 @@ namespace PortabilityLayer
|
||||
|
||||
void HandleScreenResolutionChange(uint32_t prevWidth, uint32_t prevHeight, uint32_t newWidth, uint32_t newHeight) override;
|
||||
|
||||
Vec2i GetDisplayResolution() const override;
|
||||
|
||||
void SetBackgroundColor(uint8_t r, uint8_t g, uint8_t b) override;
|
||||
|
||||
Window *GetPutInFrontSentinel() const override;
|
||||
@@ -229,6 +233,8 @@ namespace PortabilityLayer
|
||||
DrawSurface m_resizeInProgressVerticalBar;
|
||||
bool m_isResizeInProgress;
|
||||
|
||||
Vec2i m_displayResolution;
|
||||
|
||||
static WindowManagerImpl ms_instance;
|
||||
|
||||
static uint8_t ms_putInFrontSentinel;
|
||||
@@ -1011,8 +1017,6 @@ namespace PortabilityLayer
|
||||
return m_effects;
|
||||
}
|
||||
|
||||
|
||||
|
||||
WindowManagerImpl::WindowManagerImpl()
|
||||
: m_windowStackTop(nullptr)
|
||||
, m_windowStackBottom(nullptr)
|
||||
@@ -1025,6 +1029,7 @@ namespace PortabilityLayer
|
||||
, m_flickerZoneSize(0)
|
||||
, m_flickerBasisCoordinateDistance(0)
|
||||
, m_flickerChromeDistanceOffset(0)
|
||||
, m_displayResolution(0, 0)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -1032,6 +1037,14 @@ namespace PortabilityLayer
|
||||
{
|
||||
}
|
||||
|
||||
void WindowManagerImpl::Init()
|
||||
{
|
||||
unsigned int displayWidth, displayHeight;
|
||||
PLDrivers::GetDisplayDriver()->GetInitialDisplayResolution(&displayWidth, &displayHeight);
|
||||
|
||||
m_displayResolution = Vec2i(displayWidth, displayHeight);
|
||||
}
|
||||
|
||||
Window *WindowManagerImpl::CreateWindow(const WindowDef &windowDef)
|
||||
{
|
||||
void *windowMem = MemoryManager::GetInstance()->Alloc(sizeof(WindowImpl));
|
||||
@@ -1528,6 +1541,11 @@ namespace PortabilityLayer
|
||||
}
|
||||
}
|
||||
|
||||
Vec2i WindowManagerImpl::GetDisplayResolution() const
|
||||
{
|
||||
return m_displayResolution;
|
||||
}
|
||||
|
||||
void WindowManagerImpl::SetBackgroundColor(uint8_t r, uint8_t g, uint8_t b)
|
||||
{
|
||||
PLDrivers::GetDisplayDriver()->SetBackgroundColor(r, g, b, 255);
|
||||
|
Reference in New Issue
Block a user