Keep level editor windows in screen bounds

This commit is contained in:
elasota
2020-04-05 22:31:22 -04:00
parent f46ae55d62
commit ffd9d9cc1f
6 changed files with 47 additions and 1 deletions

View File

@@ -14,6 +14,7 @@
#include "QDManager.h"
#include "QDPixMap.h"
#include "PLTimeTaggedVOSEvent.h"
#include "Rect2i.h"
#include "Vec2i.h"
#include "WindowDef.h"
@@ -129,6 +130,7 @@ namespace PortabilityLayer
void DestroyWindow(Window *window) override;
void DragWindow(Window *window, const Point &startPoint, const Rect &constraintRect) override;
void SetWindowTitle(Window *window, const PLPasStr &title) override;
Rect2i GetWindowFullRect(Window *window) const override;
void RenderFrame(IGpDisplayDriver *displayDriver) override;
@@ -797,6 +799,18 @@ namespace PortabilityLayer
static_cast<WindowImpl*>(window)->SetTitle(title);
}
Rect2i WindowManagerImpl::GetWindowFullRect(Window *window) const
{
WindowImpl *windowImpl = static_cast<WindowImpl*>(window);
uint16_t padding[WindowChromeSides::kCount];
windowImpl->GetChromePadding(padding);
const Rect portRect = windowImpl->m_surface.m_port.GetRect();
return Rect2i(window->m_wmY - padding[WindowChromeSides::kTop], window->m_wmX - padding[WindowChromeSides::kLeft], window->m_wmY + portRect.Height() + padding[WindowChromeSides::kBottom], window->m_wmX + portRect.Width() + padding[WindowChromeSides::kRight]);
}
void WindowManagerImpl::RenderFrame(IGpDisplayDriver *displayDriver)
{
PortabilityLayer::DisplayDeviceManager *dd = PortabilityLayer::DisplayDeviceManager::GetInstance();