1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-10 23:44:24 +00:00

Linux: Adjust natively reported border size by the current scale factor

This commit is contained in:
attila 2022-05-17 15:42:39 +02:00
parent 338c045719
commit 6f3fb5a29f
2 changed files with 17 additions and 1 deletions

View file

@ -145,6 +145,16 @@ public:
other.right + right };
}
/** Multiplies each member of the border by a scalar. */
template <typename ScalarType>
BorderSize<ValueType> multipliedBy (ScalarType scalar) const noexcept
{
return { static_cast<ValueType> (scalar * top),
static_cast<ValueType> (scalar * left),
static_cast<ValueType> (scalar * bottom),
static_cast<ValueType> (scalar * right) };
}
//==============================================================================
bool operator== (const BorderSize& other) const noexcept { return tie() == other.tie(); }
bool operator!= (const BorderSize& other) const noexcept { return tie() != other.tie(); }

View file

@ -380,7 +380,13 @@ public:
else if (! windowBorder
|| ((*windowBorder).getTopAndBottom() == 0 && (*windowBorder).getLeftAndRight() == 0))
{
windowBorder = XWindowSystem::getInstance()->getBorderSize (windowH);
windowBorder = [&]()
{
if (auto unscaledBorderSize = XWindowSystem::getInstance()->getBorderSize (windowH))
return OptionalBorderSize { (*unscaledBorderSize).multipliedBy (1.0 / currentScaleFactor) };
return OptionalBorderSize {};
}();
}
}