mirror of
https://github.com/elasota/Aerofoil.git
synced 2025-09-23 23:00:42 +00:00
Log Window Manager automatic repositions
This commit is contained in:
@@ -2,8 +2,10 @@
|
|||||||
|
|
||||||
#include "DisplayDeviceManager.h"
|
#include "DisplayDeviceManager.h"
|
||||||
#include "HostDisplayDriver.h"
|
#include "HostDisplayDriver.h"
|
||||||
|
#include "HostLogDriver.h"
|
||||||
#include "IGpDisplayDriver.h"
|
#include "IGpDisplayDriver.h"
|
||||||
#include "IGpDisplayDriverSurface.h"
|
#include "IGpDisplayDriverSurface.h"
|
||||||
|
#include "IGpLogDriver.h"
|
||||||
#include "PLCore.h"
|
#include "PLCore.h"
|
||||||
#include "PLEventQueue.h"
|
#include "PLEventQueue.h"
|
||||||
#include "PLStandardColors.h"
|
#include "PLStandardColors.h"
|
||||||
@@ -1434,6 +1436,11 @@ namespace PortabilityLayer
|
|||||||
|
|
||||||
void WindowManagerImpl::HandleScreenResolutionChange(uint32_t prevWidth, uint32_t prevHeight, uint32_t newWidth, uint32_t newHeight)
|
void WindowManagerImpl::HandleScreenResolutionChange(uint32_t prevWidth, uint32_t prevHeight, uint32_t newWidth, uint32_t newHeight)
|
||||||
{
|
{
|
||||||
|
IGpLogDriver *logger = PortabilityLayer::HostLogDriver::GetInstance();
|
||||||
|
|
||||||
|
if (logger)
|
||||||
|
logger->Printf(IGpLogDriver::Category_Information, "WindowManagerImpl: Resizing from %ix%i to %ix%i", static_cast<int>(prevWidth), static_cast<int>(prevHeight), static_cast<int>(newWidth), static_cast<int>(newHeight));
|
||||||
|
|
||||||
const uint32_t menuBarHeight = PortabilityLayer::MenuManager::GetInstance()->GetMenuBarHeight();
|
const uint32_t menuBarHeight = PortabilityLayer::MenuManager::GetInstance()->GetMenuBarHeight();
|
||||||
const bool menuIsTouchScreen = PortabilityLayer::MenuManager::GetInstance()->IsMenuTouchScreenStyle();
|
const bool menuIsTouchScreen = PortabilityLayer::MenuManager::GetInstance()->IsMenuTouchScreenStyle();
|
||||||
|
|
||||||
@@ -1444,6 +1451,9 @@ namespace PortabilityLayer
|
|||||||
|
|
||||||
const Rect surfaceRect = window->GetDrawSurface()->m_port.GetRect();
|
const Rect surfaceRect = window->GetDrawSurface()->m_port.GetRect();
|
||||||
|
|
||||||
|
if (logger)
|
||||||
|
logger->Printf(IGpLogDriver::Category_Information, "Auto window reposition: Pos: %i,%i Size %i,%i", static_cast<int>(window->GetPosition().m_x), static_cast<int>(window->GetPosition().m_y), static_cast<int>(surfaceRect.Width()), static_cast<int>(surfaceRect.Height()));
|
||||||
|
|
||||||
uint32_t paddedWidth = surfaceRect.Width() + chromePadding[WindowChromeSides::kLeft] + chromePadding[WindowChromeSides::kRight];
|
uint32_t paddedWidth = surfaceRect.Width() + chromePadding[WindowChromeSides::kLeft] + chromePadding[WindowChromeSides::kRight];
|
||||||
uint32_t paddedHeight = surfaceRect.Height() + chromePadding[WindowChromeSides::kTop] + chromePadding[WindowChromeSides::kBottom];
|
uint32_t paddedHeight = surfaceRect.Height() + chromePadding[WindowChromeSides::kTop] + chromePadding[WindowChromeSides::kBottom];
|
||||||
|
|
||||||
@@ -1478,7 +1488,7 @@ namespace PortabilityLayer
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
uint32_t heightWithoutMenu = surfaceRect.Height() - menuBarHeight;
|
uint32_t heightWithoutMenu = surfaceRect.Height() - menuBarHeight;
|
||||||
if (currentY + static_cast<int32_t>(paddedHeight) >= heightWithoutMenu)
|
if (currentY + static_cast<int32_t>(paddedHeight) >= static_cast<int32_t>(heightWithoutMenu))
|
||||||
newY = currentY;
|
newY = currentY;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -1496,6 +1506,9 @@ namespace PortabilityLayer
|
|||||||
newX = std::max<int64_t>(0, std::min<int64_t>(newX, newWidth - 1));
|
newX = std::max<int64_t>(0, std::min<int64_t>(newX, newWidth - 1));
|
||||||
newY = std::max<int64_t>(0, std::min<int64_t>(newY, newHeight - 1));
|
newY = std::max<int64_t>(0, std::min<int64_t>(newY, newHeight - 1));
|
||||||
|
|
||||||
|
if (logger)
|
||||||
|
logger->Printf(IGpLogDriver::Category_Information, "New position: %i,%i", static_cast<int>(newX), static_cast<int>(newY));
|
||||||
|
|
||||||
window->SetPosition(Vec2i(newX, newY));
|
window->SetPosition(Vec2i(newX, newY));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user