diff --git a/examples/GUI/WindowsDemo.h b/examples/GUI/WindowsDemo.h index 7b4504bc5d..307f38662b 100644 --- a/examples/GUI/WindowsDemo.h +++ b/examples/GUI/WindowsDemo.h @@ -334,7 +334,7 @@ private: | RectanglePlacement::doNotResize); auto result = placement.appliedTo (area, Desktop::getInstance().getDisplays() - .getMainDisplay().userArea.reduced (20)); + .getPrimaryDisplay()->userArea.reduced (20)); dw->setBounds (result); dw->setResizable (true, ! native); @@ -355,7 +355,7 @@ private: | RectanglePlacement::doNotResize); auto result = placement.appliedTo (area, Desktop::getInstance().getDisplays() - .getMainDisplay().userArea.reduced (20)); + .getPrimaryDisplay()->userArea.reduced (20)); balls->setBounds (result); balls->setVisible (true); diff --git a/examples/Plugins/InterAppAudioEffectPluginDemo.h b/examples/Plugins/InterAppAudioEffectPluginDemo.h index a75980f05e..76f5fb4ef6 100644 --- a/examples/Plugins/InterAppAudioEffectPluginDemo.h +++ b/examples/Plugins/InterAppAudioEffectPluginDemo.h @@ -349,7 +349,7 @@ private: }; addChildComponent (switchToHostButton); - auto screenSize = Desktop::getInstance().getDisplays().getMainDisplay().userArea; + auto screenSize = Desktop::getInstance().getDisplays().getPrimaryDisplay()->userArea; setSize (screenSize.getWidth(), screenSize.getHeight()); resized(); diff --git a/examples/Utilities/InAppPurchasesDemo.h b/examples/Utilities/InAppPurchasesDemo.h index c70fbf9018..53fa863fe7 100644 --- a/examples/Utilities/InAppPurchasesDemo.h +++ b/examples/Utilities/InAppPurchasesDemo.h @@ -510,7 +510,7 @@ public: soundNames = purchases.getVoiceNames(); #if JUCE_ANDROID || JUCE_IOS - auto screenBounds = Desktop::getInstance().getDisplays().getMainDisplay().userArea; + auto screenBounds = Desktop::getInstance().getDisplays().getPrimaryDisplay()->userArea; setSize (screenBounds.getWidth(), screenBounds.getHeight()); #else setSize (800, 600); diff --git a/examples/Utilities/PushNotificationsDemo.h b/examples/Utilities/PushNotificationsDemo.h index ec8a4ae547..8d3445dc87 100644 --- a/examples/Utilities/PushNotificationsDemo.h +++ b/examples/Utilities/PushNotificationsDemo.h @@ -162,7 +162,7 @@ public: mainTabs.addTab ("Local", colour, &localNotificationsTabs, false); mainTabs.addTab ("Remote", colour, &remoteView, false); - auto userArea = Desktop::getInstance().getDisplays().getMainDisplay().userArea; + auto userArea = Desktop::getInstance().getDisplays().getPrimaryDisplay()->userArea; #if JUCE_ANDROID || JUCE_IOS setSize (userArea.getWidth(), userArea.getHeight()); #else diff --git a/extras/NetworkGraphicsDemo/Source/SlaveComponent.h b/extras/NetworkGraphicsDemo/Source/SlaveComponent.h index b50a6b6289..4d185215e5 100644 --- a/extras/NetworkGraphicsDemo/Source/SlaveComponent.h +++ b/extras/NetworkGraphicsDemo/Source/SlaveComponent.h @@ -125,8 +125,8 @@ private: //============================================================================== String getMachineInfoToDisplay() const { - auto display = Desktop::getInstance().getDisplays().findDisplayForPoint (getScreenBounds().getCentre()); - return getOSName() + " " + String (display.dpi) + " " + String (display.scale); + auto* display = Desktop::getInstance().getDisplays().getDisplayForPoint (getScreenBounds().getCentre()); + return getOSName() + " " + String (display->dpi) + " " + String (display->scale); } static String getOSName() @@ -180,8 +180,8 @@ private: if (auto client = canvas.findClient (clientName)) { auto screenBounds = getScreenBounds(); - auto display = Desktop::getInstance().getDisplays().findDisplayForPoint (screenBounds.getCentre()); - return ((screenBounds - display.userArea.getCentre()).toFloat() / (client->scaleFactor * display.dpi / display.scale)) + client->centre; + auto* display = Desktop::getInstance().getDisplays().getDisplayForPoint (screenBounds.getCentre()); + return ((screenBounds - display->userArea.getCentre()).toFloat() / (client->scaleFactor * display->dpi / display->scale)) + client->centre; } return {}; @@ -191,8 +191,8 @@ private: { if (auto client = canvas.findClient (clientName)) { - auto display = Desktop::getInstance().getDisplays().findDisplayForPoint (getScreenBounds().getCentre()); - return (display.userArea.toFloat() / (client->scaleFactor * display.dpi / display.scale)).withCentre (client->centre); + auto* display = Desktop::getInstance().getDisplays().getDisplayForPoint (getScreenBounds().getCentre()); + return (display->userArea.toFloat() / (client->scaleFactor * display->dpi / display->scale)).withCentre (client->centre); } return {}; diff --git a/extras/Projucer/Source/Application/jucer_MainWindow.cpp b/extras/Projucer/Source/Application/jucer_MainWindow.cpp index bedcde43d6..ecbd79523d 100644 --- a/extras/Projucer/Source/Application/jucer_MainWindow.cpp +++ b/extras/Projucer/Source/Application/jucer_MainWindow.cpp @@ -800,7 +800,7 @@ void MainWindowList::checkWindowBounds (MainWindow& windowToCheck) auto ensureWindowIsFullyOnscreen = [&] { auto windowBounds = windowToCheck.getScreenBounds(); - auto screenLimits = Desktop::getInstance().getDisplays().findDisplayForRect (windowBounds).userArea; + auto screenLimits = Desktop::getInstance().getDisplays().getDisplayForRect (windowBounds)->userArea; if (auto* peer = windowToCheck.getPeer()) peer->getFrameSize().subtractFrom (screenLimits); diff --git a/modules/juce_audio_plugin_client/VST/juce_VST_Wrapper.cpp b/modules/juce_audio_plugin_client/VST/juce_VST_Wrapper.cpp index b8a0905ef3..0f2bb9dc13 100644 --- a/modules/juce_audio_plugin_client/VST/juce_VST_Wrapper.cpp +++ b/modules/juce_audio_plugin_client/VST/juce_VST_Wrapper.cpp @@ -1096,7 +1096,7 @@ public: { auto screenBounds = peer->localToGlobal (peer->getBounds()); - auto scale = Desktop::getInstance().getDisplays().findDisplayForRect (screenBounds, false).scale + auto scale = Desktop::getInstance().getDisplays().getDisplayForRect (screenBounds, false)->scale / Desktop::getInstance().getGlobalScaleFactor(); setContentScaleFactor ((float) scale); diff --git a/modules/juce_audio_processors/format_types/juce_VSTPluginFormat.cpp b/modules/juce_audio_processors/format_types/juce_VSTPluginFormat.cpp index 5341351771..cc5053346b 100644 --- a/modules/juce_audio_processors/format_types/juce_VSTPluginFormat.cpp +++ b/modules/juce_audio_processors/format_types/juce_VSTPluginFormat.cpp @@ -3234,7 +3234,7 @@ private: bool willCauseRecursiveResize (int w, int h) { auto newScreenBounds = Rectangle (w, h).withPosition (getScreenPosition()); - return Desktop::getInstance().getDisplays().findDisplayForRect (newScreenBounds).scale != nativeScaleFactor; + return Desktop::getInstance().getDisplays().getDisplayForRect (newScreenBounds)->scale != nativeScaleFactor; } bool isWindowSizeCorrectForPlugin (int w, int h) diff --git a/modules/juce_gui_basics/components/juce_Component.cpp b/modules/juce_gui_basics/components/juce_Component.cpp index a30981e7bd..48f81603c9 100644 --- a/modules/juce_gui_basics/components/juce_Component.cpp +++ b/modules/juce_gui_basics/components/juce_Component.cpp @@ -452,7 +452,7 @@ struct Component::ComponentHelpers if (auto* p = comp.getParentComponent()) return p->getLocalBounds(); - return Desktop::getInstance().getDisplays().getMainDisplay().userArea; + return Desktop::getInstance().getDisplays().getPrimaryDisplay()->userArea; } static void releaseAllCachedImageResources (Component& c) @@ -1059,7 +1059,7 @@ int Component::getParentHeight() const noexcept Rectangle Component::getParentMonitorArea() const { - return Desktop::getInstance().getDisplays().findDisplayForRect (getScreenBounds()).userArea; + return Desktop::getInstance().getDisplays().getDisplayForRect (getScreenBounds())->userArea; } int Component::getScreenX() const { return getScreenPosition().x; } diff --git a/modules/juce_gui_basics/desktop/juce_Displays.h b/modules/juce_gui_basics/desktop/juce_Displays.h index ae843c4b9e..7e1281bbe2 100644 --- a/modules/juce_gui_basics/desktop/juce_Displays.h +++ b/modules/juce_gui_basics/desktop/juce_Displays.h @@ -129,7 +129,7 @@ public: void refresh(); /** @internal */ ~Displays() = default; - // This method has been deprecated - use the findDisplayForPoint() or findDisplayForRect() methods instead + // This method has been deprecated - use the getDisplayForPoint() or getDisplayForRect() methods instead // as they can deal with converting between logical and physical pixels JUCE_DEPRECATED (const Display& getDisplayContaining (Point position) const noexcept); diff --git a/modules/juce_gui_basics/layout/juce_ComponentAnimator.cpp b/modules/juce_gui_basics/layout/juce_ComponentAnimator.cpp index 84b18388ea..0660305805 100644 --- a/modules/juce_gui_basics/layout/juce_ComponentAnimator.cpp +++ b/modules/juce_gui_basics/layout/juce_ComponentAnimator.cpp @@ -163,7 +163,7 @@ public: else jassertfalse; // seem to be trying to animate a component that's not visible.. - auto scale = (float) Desktop::getInstance().getDisplays().findDisplayForRect (getScreenBounds()).scale + auto scale = (float) Desktop::getInstance().getDisplays().getDisplayForRect (getScreenBounds())->scale * Component::getApproximateScaleFactorForComponent (&c); image = c.createComponentSnapshot (c.getLocalBounds(), false, scale); diff --git a/modules/juce_gui_basics/layout/juce_ComponentBoundsConstrainer.cpp b/modules/juce_gui_basics/layout/juce_ComponentBoundsConstrainer.cpp index b2eb775e8f..9ea63b2151 100644 --- a/modules/juce_gui_basics/layout/juce_ComponentBoundsConstrainer.cpp +++ b/modules/juce_gui_basics/layout/juce_ComponentBoundsConstrainer.cpp @@ -116,7 +116,7 @@ void ComponentBoundsConstrainer::setBoundsForComponent (Component* component, if (auto* peer = component->getPeer()) border = peer->getFrameSize(); - auto screenBounds = Desktop::getInstance().getDisplays().findDisplayForPoint (targetBounds.getCentre()).userArea; + auto screenBounds = Desktop::getInstance().getDisplays().getDisplayForPoint (targetBounds.getCentre())->userArea; limits = component->getLocalArea (nullptr, screenBounds) + component->getPosition(); } diff --git a/modules/juce_gui_basics/menus/juce_PopupMenu.cpp b/modules/juce_gui_basics/menus/juce_PopupMenu.cpp index e9dd857dbe..833aa217e6 100644 --- a/modules/juce_gui_basics/menus/juce_PopupMenu.cpp +++ b/modules/juce_gui_basics/menus/juce_PopupMenu.cpp @@ -649,11 +649,11 @@ struct MenuWindow : public Component if (relativeTo != nullptr) targetPoint = relativeTo->localPointToGlobal (targetPoint); - auto parentArea = Desktop::getInstance().getDisplays().findDisplayForPoint (targetPoint * scaleFactor) + auto parentArea = Desktop::getInstance().getDisplays().getDisplayForPoint (targetPoint * scaleFactor) #if JUCE_MAC || JUCE_ANDROID - .userArea; + ->userArea; #else - .totalArea; // on windows, don't stop the menu overlapping the taskbar + ->totalArea; // on windows, don't stop the menu overlapping the taskbar #endif if (parentComponent == nullptr) diff --git a/modules/juce_gui_basics/native/juce_android_Windowing.cpp b/modules/juce_gui_basics/native/juce_android_Windowing.cpp index 923de3b63b..4cb678ad3b 100644 --- a/modules/juce_gui_basics/native/juce_android_Windowing.cpp +++ b/modules/juce_gui_basics/native/juce_android_Windowing.cpp @@ -258,7 +258,7 @@ public: fullScreen (false), navBarsHidden (false), sizeAllocated (0), - scale ((float) Desktop::getInstance().getDisplays().getMainDisplay().scale) + scale ((float) Desktop::getInstance().getDisplays().getPrimaryDisplay()->scale) { auto* env = getEnv(); @@ -546,7 +546,7 @@ public: setNavBarsHidden (false); } - Rectangle r (shouldBeFullScreen ? Desktop::getInstance().getDisplays().getMainDisplay().userArea + Rectangle r (shouldBeFullScreen ? Desktop::getInstance().getDisplays().getPrimaryDisplay()->userArea : lastNonFullscreenBounds); if ((! shouldBeFullScreen) && r.isEmpty()) @@ -1428,7 +1428,7 @@ public: if (newBounds != oldBounds) { auto& displays = Desktop::getInstance().getDisplays(); - auto& mainDisplay = displays.getMainDisplay(); + auto& mainDisplay = *displays.getPrimaryDisplay(); Rectangle userArea = newBounds / mainDisplay.scale; diff --git a/modules/juce_gui_basics/native/juce_ios_ContentSharer.cpp b/modules/juce_gui_basics/native/juce_ios_ContentSharer.cpp index 29a84e8dcf..8aa6603c6e 100644 --- a/modules/juce_gui_basics/native/juce_ios_ContentSharer.cpp +++ b/modules/juce_gui_basics/native/juce_ios_ContentSharer.cpp @@ -120,7 +120,7 @@ private: controller.get().modalTransitionStyle = UIModalTransitionStyleCoverVertical; - auto bounds = Desktop::getInstance().getDisplays().getMainDisplay().userArea; + auto bounds = Desktop::getInstance().getDisplays().getPrimaryDisplay()->userArea; setBounds (bounds); setAlwaysOnTop (true); diff --git a/modules/juce_gui_basics/native/juce_ios_FileChooser.mm b/modules/juce_gui_basics/native/juce_ios_FileChooser.mm index 8345251666..4164101e19 100644 --- a/modules/juce_gui_basics/native/juce_ios_FileChooser.mm +++ b/modules/juce_gui_basics/native/juce_ios_FileChooser.mm @@ -112,7 +112,7 @@ public: return; } - auto chooserBounds = Desktop::getInstance().getDisplays().getMainDisplay().userArea; + auto chooserBounds = Desktop::getInstance().getDisplays().getPrimaryDisplay()->userArea; setBounds (chooserBounds); setAlwaysOnTop (true); diff --git a/modules/juce_gui_basics/native/juce_ios_UIViewComponentPeer.mm b/modules/juce_gui_basics/native/juce_ios_UIViewComponentPeer.mm index 5af68b407c..9e735b455f 100644 --- a/modules/juce_gui_basics/native/juce_ios_UIViewComponentPeer.mm +++ b/modules/juce_gui_basics/native/juce_ios_UIViewComponentPeer.mm @@ -662,7 +662,7 @@ void UIViewComponentPeer::setFullScreen (bool shouldBeFullScreen) { if (! isSharedWindow) { - auto r = shouldBeFullScreen ? Desktop::getInstance().getDisplays().getMainDisplay().userArea + auto r = shouldBeFullScreen ? Desktop::getInstance().getDisplays().getPrimaryDisplay()->userArea : lastNonFullscreenBounds; if ((! shouldBeFullScreen) && r.isEmpty()) @@ -681,7 +681,7 @@ void UIViewComponentPeer::updateScreenBounds() auto& desktop = Desktop::getInstance(); auto oldArea = component.getBounds(); - auto oldDesktop = desktop.getDisplays().getMainDisplay().userArea; + auto oldDesktop = desktop.getDisplays().getPrimaryDisplay()->userArea; const_cast (desktop.getDisplays()).refresh(); @@ -696,7 +696,7 @@ void UIViewComponentPeer::updateScreenBounds() auto centreRelX = oldArea.getCentreX() / (float) oldDesktop.getWidth(); auto centreRelY = oldArea.getCentreY() / (float) oldDesktop.getHeight(); - auto newDesktop = desktop.getDisplays().getMainDisplay().userArea; + auto newDesktop = desktop.getDisplays().getPrimaryDisplay()->userArea; auto x = ((int) (newDesktop.getWidth() * centreRelX)) - (oldArea.getWidth() / 2); auto y = ((int) (newDesktop.getHeight() * centreRelY)) - (oldArea.getHeight() / 2); diff --git a/modules/juce_gui_basics/native/juce_linux_Windowing.cpp b/modules/juce_gui_basics/native/juce_linux_Windowing.cpp index df0748407f..d4da029581 100644 --- a/modules/juce_gui_basics/native/juce_linux_Windowing.cpp +++ b/modules/juce_gui_basics/native/juce_linux_Windowing.cpp @@ -171,7 +171,7 @@ public: if (fullScreen != shouldBeFullScreen) { if (shouldBeFullScreen) - r = Desktop::getInstance().getDisplays().getMainDisplay().userArea; + r = Desktop::getInstance().getDisplays().getPrimaryDisplay()->userArea; if (! r.isEmpty()) setBounds (ScalingHelpers::scaledScreenPosToUnscaled (component, r), shouldBeFullScreen); @@ -424,7 +424,7 @@ private: Point translation = (parentWindow != 0 ? getScreenPosition (isPhysical) : Point()); - auto newScaleFactor = Desktop::getInstance().getDisplays().findDisplayForRect (newBounds.translated (translation.x, translation.y), isPhysical).scale + auto newScaleFactor = Desktop::getInstance().getDisplays().getDisplayForRect (newBounds.translated (translation.x, translation.y), isPhysical)->scale / Desktop::getInstance().getGlobalScaleFactor(); if (! approximatelyEqual (newScaleFactor, currentScaleFactor)) @@ -467,7 +467,7 @@ JUCE_API void JUCE_CALLTYPE Process::hide() {} void Desktop::setKioskComponent (Component* comp, bool enableOrDisable, bool) { if (enableOrDisable) - comp->setBounds (getDisplays().findDisplayForRect (comp->getScreenBounds()).totalArea); + comp->setBounds (getDisplays().getDisplayForRect (comp->getScreenBounds())->totalArea); } void Displays::findDisplays (float masterScale) diff --git a/modules/juce_gui_basics/native/juce_mac_NSViewComponentPeer.mm b/modules/juce_gui_basics/native/juce_mac_NSViewComponentPeer.mm index 4971c5fec3..edadc97e1f 100644 --- a/modules/juce_gui_basics/native/juce_mac_NSViewComponentPeer.mm +++ b/modules/juce_gui_basics/native/juce_mac_NSViewComponentPeer.mm @@ -2226,7 +2226,7 @@ void Desktop::setKioskComponent (Component* kioskComp, bool shouldBeEnabled, boo [NSApp setPresentationOptions: (allowMenusAndBars ? (NSApplicationPresentationAutoHideDock | NSApplicationPresentationAutoHideMenuBar) : (NSApplicationPresentationHideDock | NSApplicationPresentationHideMenuBar))]; - kioskComp->setBounds (getDisplays().findDisplayForRect (kioskComp->getScreenBounds()).totalArea); + kioskComp->setBounds (getDisplays().getDisplayForRect (kioskComp->getScreenBounds())->totalArea); peer->becomeKeyWindow(); } else diff --git a/modules/juce_gui_basics/native/juce_win32_FileChooser.cpp b/modules/juce_gui_basics/native/juce_win32_FileChooser.cpp index 1977e00bce..8d3eafbd98 100644 --- a/modules/juce_gui_basics/native/juce_win32_FileChooser.cpp +++ b/modules/juce_gui_basics/native/juce_win32_FileChooser.cpp @@ -547,7 +547,7 @@ private: auto screenRectangle = Rectangle::leftTopRightBottom (dialogScreenRect.left, dialogScreenRect.top, dialogScreenRect.right, dialogScreenRect.bottom); - auto scale = Desktop::getInstance().getDisplays().findDisplayForRect (screenRectangle, true).scale; + auto scale = Desktop::getInstance().getDisplays().getDisplayForRect (screenRectangle, true)->scale; auto physicalComponentWidth = roundToInt (safeCustomComponent->getWidth() * scale); SetWindowPos (hdlg, nullptr, screenRectangle.getX(), screenRectangle.getY(), @@ -700,7 +700,7 @@ public: nativeFileChooser (new Win32NativeFileChooser (this, flags, previewComp, fileChooser.startingFile, fileChooser.title, fileChooser.filters)) { - auto mainMon = Desktop::getInstance().getDisplays().getMainDisplay().userArea; + auto mainMon = Desktop::getInstance().getDisplays().getPrimaryDisplay()->userArea; setBounds (mainMon.getX() + mainMon.getWidth() / 4, mainMon.getY() + mainMon.getHeight() / 4, diff --git a/modules/juce_gui_basics/native/juce_win32_Windowing.cpp b/modules/juce_gui_basics/native/juce_win32_Windowing.cpp index a3fd406b3b..6ae0d3dc37 100644 --- a/modules/juce_gui_basics/native/juce_win32_Windowing.cpp +++ b/modules/juce_gui_basics/native/juce_win32_Windowing.cpp @@ -1654,7 +1654,7 @@ public: // if the calling thread is DPI-aware but we are invalidating a non-DPI aware window RECT, we actually have to // divide the bounds by the scale factor as it will get multiplied for the virtualised paint callback... if (isPerMonitorDPIAwareThread() && ! isPerMonitorDPIAwareWindow (hwnd)) - scale = 1.0 / Desktop::getInstance().getDisplays().getMainDisplay().scale; + scale = 1.0 / Desktop::getInstance().getDisplays().getPrimaryDisplay()->scale; #endif auto scaled = area.toDouble() * scale; @@ -2175,9 +2175,9 @@ private: auto bounds = component.getBounds(); if (bounds.isEmpty()) - scaleFactor = Desktop::getInstance().getDisplays().getMainDisplay().scale; + scaleFactor = Desktop::getInstance().getDisplays().getPrimaryDisplay()->scale; else - scaleFactor = Desktop::getInstance().getDisplays().findDisplayForRect (bounds).scale; + scaleFactor = Desktop::getInstance().getDisplays().getDisplayForRect (bounds)->scale; scaleFactor /= Desktop::getInstance().getGlobalScaleFactor(); } @@ -3419,7 +3419,7 @@ private: if (fullScreen && ! isMinimised()) setWindowPos (hwnd, ScalingHelpers::scaledScreenPosToUnscaled (component, Desktop::getInstance().getDisplays() - .findDisplayForRect (component.getScreenBounds()).userArea), + .getDisplayForRect (component.getScreenBounds())->userArea), SWP_NOACTIVATE | SWP_NOOWNERZORDER | SWP_NOZORDER | SWP_NOSENDCHANGING); } @@ -4455,7 +4455,7 @@ void Desktop::setKioskComponent (Component* kioskModeComp, bool enableOrDisable, tlw->setUsingNativeTitleBar (! enableOrDisable); if (enableOrDisable) - kioskModeComp->setBounds (getDisplays().findDisplayForRect (kioskModeComp->getScreenBounds()).totalArea); + kioskModeComp->setBounds (getDisplays().getDisplayForRect (kioskModeComp->getScreenBounds())->totalArea); } void Desktop::allowedOrientationsChanged() {} @@ -4508,7 +4508,7 @@ static const Displays::Display* getCurrentDisplayFromScaleFactor (HWND hwnd) return retVal; } - return &Desktop::getInstance().getDisplays().getMainDisplay(); + return Desktop::getInstance().getDisplays().getPrimaryDisplay(); } //============================================================================== diff --git a/modules/juce_gui_basics/windows/juce_CallOutBox.cpp b/modules/juce_gui_basics/windows/juce_CallOutBox.cpp index 9cbd6035ea..bab4c69610 100644 --- a/modules/juce_gui_basics/windows/juce_CallOutBox.cpp +++ b/modules/juce_gui_basics/windows/juce_CallOutBox.cpp @@ -40,7 +40,7 @@ CallOutBox::CallOutBox (Component& c, Rectangle area, Component* const pare else { setAlwaysOnTop (juce_areThereAnyAlwaysOnTopWindows()); - updatePosition (area, Desktop::getInstance().getDisplays().findDisplayForRect (area).userArea); + updatePosition (area, Desktop::getInstance().getDisplays().getDisplayForRect (area)->userArea); addToDesktop (ComponentPeer::windowIsTemporary); startTimer (100); diff --git a/modules/juce_gui_basics/windows/juce_ResizableWindow.cpp b/modules/juce_gui_basics/windows/juce_ResizableWindow.cpp index dc3c7279af..d2360e5f4e 100644 --- a/modules/juce_gui_basics/windows/juce_ResizableWindow.cpp +++ b/modules/juce_gui_basics/windows/juce_ResizableWindow.cpp @@ -564,7 +564,7 @@ bool ResizableWindow::restoreWindowStateFromString (const String& s) if (onScreenArea.getWidth() * onScreenArea.getHeight() < 32 * 32) { - auto screen = desktop.getDisplays().findDisplayForRect (newPos).userArea; + auto screen = desktop.getDisplays().getDisplayForRect (newPos)->userArea; newPos.setSize (jmin (newPos.getWidth(), screen.getWidth()), jmin (newPos.getHeight(), screen.getHeight())); diff --git a/modules/juce_gui_basics/windows/juce_TooltipWindow.cpp b/modules/juce_gui_basics/windows/juce_TooltipWindow.cpp index f062378493..c893c8d9e9 100644 --- a/modules/juce_gui_basics/windows/juce_TooltipWindow.cpp +++ b/modules/juce_gui_basics/windows/juce_TooltipWindow.cpp @@ -91,7 +91,7 @@ void TooltipWindow::displayTip (Point screenPos, const String& tip) } else { - updatePosition (tip, screenPos, Desktop::getInstance().getDisplays().findDisplayForPoint (screenPos).userArea); + updatePosition (tip, screenPos, Desktop::getInstance().getDisplays().getDisplayForPoint (screenPos)->userArea); addToDesktop (ComponentPeer::windowHasDropShadow | ComponentPeer::windowIsTemporary diff --git a/modules/juce_gui_extra/misc/juce_SplashScreen.cpp b/modules/juce_gui_extra/misc/juce_SplashScreen.cpp index 04d3fbe16b..9169cfb1d8 100644 --- a/modules/juce_gui_extra/misc/juce_SplashScreen.cpp +++ b/modules/juce_gui_extra/misc/juce_SplashScreen.cpp @@ -57,7 +57,7 @@ void SplashScreen::makeVisible (int w, int h, bool useDropShadow, bool fullscree clickCountToDelete = Desktop::getInstance().getMouseButtonClickCounter(); creationTime = Time::getCurrentTime(); - const Rectangle screenSize = Desktop::getInstance().getDisplays().getMainDisplay().userArea; + const Rectangle screenSize = Desktop::getInstance().getDisplays().getPrimaryDisplay()->userArea; const int width = (fullscreen ? screenSize.getWidth() : w); const int height = (fullscreen ? screenSize.getHeight() : h); diff --git a/modules/juce_gui_extra/native/juce_AndroidViewComponent.cpp b/modules/juce_gui_extra/native/juce_AndroidViewComponent.cpp index 931a80dad8..8f80566a41 100644 --- a/modules/juce_gui_extra/native/juce_AndroidViewComponent.cpp +++ b/modules/juce_gui_extra/native/juce_AndroidViewComponent.cpp @@ -52,7 +52,7 @@ public: auto pos = topComp->getLocalPoint (&owner, Point()); Rectangle r (pos.x, pos.y, owner.getWidth(), owner.getHeight()); - r *= Desktop::getInstance().getDisplays().getMainDisplay().scale; + r *= Desktop::getInstance().getDisplays().getPrimaryDisplay()->scale; getEnv()->CallVoidMethod (view, AndroidView.layout, r.getX(), r.getY(), r.getRight(), r.getBottom()); diff --git a/modules/juce_gui_extra/native/juce_linux_XEmbedComponent.cpp b/modules/juce_gui_extra/native/juce_linux_XEmbedComponent.cpp index 2d97316768..3cc7a8e313 100644 --- a/modules/juce_gui_extra/native/juce_linux_XEmbedComponent.cpp +++ b/modules/juce_gui_extra/native/juce_linux_XEmbedComponent.cpp @@ -438,7 +438,7 @@ private: auto& displays = Desktop::getInstance().getDisplays(); auto* peer = owner.getPeer(); const double scale = (peer != nullptr ? peer->getPlatformScaleFactor() - : displays.getMainDisplay().scale); + : displays.getPrimaryDisplay()->scale); Point topLeftInPeer = (peer != nullptr ? peer->getComponent().getLocalPoint (&owner, Point (0, 0)) diff --git a/modules/juce_opengl/native/juce_OpenGL_android.h b/modules/juce_opengl/native/juce_OpenGL_android.h index 63a7d14a85..91e441118a 100644 --- a/modules/juce_opengl/native/juce_OpenGL_android.h +++ b/modules/juce_opengl/native/juce_OpenGL_android.h @@ -231,7 +231,7 @@ public: auto env = getEnv(); lastBounds = bounds; - auto r = bounds * Desktop::getInstance().getDisplays().getMainDisplay().scale; + auto r = bounds * Desktop::getInstance().getDisplays().getPrimaryDisplay()->scale; env->CallVoidMethod (surfaceView.get(), JuceOpenGLViewSurface.layout, (jint) r.getX(), (jint) r.getY(), (jint) r.getRight(), (jint) r.getBottom()); diff --git a/modules/juce_opengl/native/juce_OpenGL_ios.h b/modules/juce_opengl/native/juce_OpenGL_ios.h index 3ffac72ce9..ae58579bc1 100644 --- a/modules/juce_opengl/native/juce_OpenGL_ios.h +++ b/modules/juce_opengl/native/juce_OpenGL_ios.h @@ -184,7 +184,7 @@ public: void updateWindowPosition (Rectangle bounds) { view.frame = convertToCGRect (bounds); - glLayer.contentsScale = (CGFloat) (Desktop::getInstance().getDisplays().getMainDisplay().scale + glLayer.contentsScale = (CGFloat) (Desktop::getInstance().getDisplays().getPrimaryDisplay()->scale / component.getDesktopScaleFactor()); if (lastBounds != bounds) diff --git a/modules/juce_opengl/opengl/juce_OpenGLContext.cpp b/modules/juce_opengl/opengl/juce_OpenGLContext.cpp index 59910469b4..0cc2a6114a 100644 --- a/modules/juce_opengl/opengl/juce_OpenGLContext.cpp +++ b/modules/juce_opengl/opengl/juce_OpenGLContext.cpp @@ -286,7 +286,7 @@ public: if (auto* peer = component.getPeer()) { auto localBounds = component.getLocalBounds(); - auto displayScale = Desktop::getInstance().getDisplays().findDisplayForRect (component.getTopLevelComponent()->getScreenBounds()).scale; + auto displayScale = Desktop::getInstance().getDisplays().getDisplayForRect (component.getTopLevelComponent()->getScreenBounds())->scale; auto newArea = peer->getComponent().getLocalArea (&component, localBounds).withZeroOrigin() * displayScale;