Skip to content

Commit

Permalink
Merge branch 'window_clamp' into 'master'
Browse files Browse the repository at this point in the history
Do not take in account UI scaling factor twice

See merge request OpenMW/openmw!4046
  • Loading branch information
psi29a committed Apr 23, 2024
2 parents 02cdeb6 + d10b0d5 commit 6d0df9f
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions apps/openmw/mwgui/windowbase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
#include "../mwbase/environment.hpp"
#include "../mwbase/windowmanager.hpp"

#include <components/settings/values.hpp>
#include <components/widgets/imagebutton.hpp>

#include "draganddrop.hpp"
Expand Down Expand Up @@ -80,12 +79,12 @@ void WindowBase::center()

void WindowBase::clampWindowCoordinates(MyGUI::Window* window)
{
auto minSize = window->getMinSize();
minSize.height = static_cast<int>(minSize.height * Settings::gui().mScalingFactor);
minSize.width = static_cast<int>(minSize.width * Settings::gui().mScalingFactor);
MyGUI::IntSize viewSize = MyGUI::RenderManager::getInstance().getViewSize();
if (window->getLayer())
viewSize = window->getLayer()->getSize();

// Window's minimum size is larger than the screen size, can not clamp coordinates
MyGUI::IntSize viewSize = MyGUI::RenderManager::getInstance().getViewSize();
auto minSize = window->getMinSize();
if (minSize.width > viewSize.width || minSize.height > viewSize.height)
return;

Expand Down

0 comments on commit 6d0df9f

Please sign in to comment.