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:
parent
af2a4a7e2a
commit
c23eab7126
2 changed files with 5 additions and 11 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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 {};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue