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

iOS: Refactor get primary display

This commit is contained in:
Anthony Nicholls 2023-03-07 18:21:38 +00:00
parent af2a4a7e2a
commit c23eab7126
2 changed files with 5 additions and 11 deletions

View file

@ -26,15 +26,6 @@
namespace juce
{
template <typename This>
auto* getPrimaryDisplayImpl (This& t)
{
JUCE_ASSERT_MESSAGE_MANAGER_IS_LOCKED
const auto iter = std::find_if (t.displays.begin(), t.displays.end(), [] (auto& d) { return d.isMain; });
return iter != t.displays.end() ? std::addressof (*iter) : nullptr;
}
Displays::Displays (Desktop& desktop)
{
init (desktop);
@ -171,7 +162,10 @@ Point<ValueType> Displays::logicalToPhysical (Point<ValueType> point, const Disp
const Displays::Display* Displays::getPrimaryDisplay() const noexcept
{
return getPrimaryDisplayImpl (*this);
JUCE_ASSERT_MESSAGE_MANAGER_IS_LOCKED
const auto iter = std::find_if (displays.begin(), displays.end(), [] (auto& d) { return d.isMain; });
return iter != displays.end() ? iter : nullptr;
}
RectangleList<int> Displays::getRectangleList (bool userAreasOnly) const

View file

@ -700,7 +700,7 @@ void Displays::findDisplays (float masterScale)
if (value == nullptr)
return {};
auto* display = getPrimaryDisplayImpl (Desktop::getInstance().getDisplays());
auto* display = Desktop::getInstance().getDisplays().getPrimaryDisplay();
if (display == nullptr)
return {};