Browse Source

Replaced deprecated Displays methods

tags/2021-05-28
ed 5 years ago
parent
commit
b7e28541ca
30 changed files with 51 additions and 51 deletions
  1. +2
    -2
      examples/GUI/WindowsDemo.h
  2. +1
    -1
      examples/Plugins/InterAppAudioEffectPluginDemo.h
  3. +1
    -1
      examples/Utilities/InAppPurchasesDemo.h
  4. +1
    -1
      examples/Utilities/PushNotificationsDemo.h
  5. +6
    -6
      extras/NetworkGraphicsDemo/Source/SlaveComponent.h
  6. +1
    -1
      extras/Projucer/Source/Application/jucer_MainWindow.cpp
  7. +1
    -1
      modules/juce_audio_plugin_client/VST/juce_VST_Wrapper.cpp
  8. +1
    -1
      modules/juce_audio_processors/format_types/juce_VSTPluginFormat.cpp
  9. +2
    -2
      modules/juce_gui_basics/components/juce_Component.cpp
  10. +1
    -1
      modules/juce_gui_basics/desktop/juce_Displays.h
  11. +1
    -1
      modules/juce_gui_basics/layout/juce_ComponentAnimator.cpp
  12. +1
    -1
      modules/juce_gui_basics/layout/juce_ComponentBoundsConstrainer.cpp
  13. +3
    -3
      modules/juce_gui_basics/menus/juce_PopupMenu.cpp
  14. +3
    -3
      modules/juce_gui_basics/native/juce_android_Windowing.cpp
  15. +1
    -1
      modules/juce_gui_basics/native/juce_ios_ContentSharer.cpp
  16. +1
    -1
      modules/juce_gui_basics/native/juce_ios_FileChooser.mm
  17. +3
    -3
      modules/juce_gui_basics/native/juce_ios_UIViewComponentPeer.mm
  18. +3
    -3
      modules/juce_gui_basics/native/juce_linux_Windowing.cpp
  19. +1
    -1
      modules/juce_gui_basics/native/juce_mac_NSViewComponentPeer.mm
  20. +2
    -2
      modules/juce_gui_basics/native/juce_win32_FileChooser.cpp
  21. +6
    -6
      modules/juce_gui_basics/native/juce_win32_Windowing.cpp
  22. +1
    -1
      modules/juce_gui_basics/windows/juce_CallOutBox.cpp
  23. +1
    -1
      modules/juce_gui_basics/windows/juce_ResizableWindow.cpp
  24. +1
    -1
      modules/juce_gui_basics/windows/juce_TooltipWindow.cpp
  25. +1
    -1
      modules/juce_gui_extra/misc/juce_SplashScreen.cpp
  26. +1
    -1
      modules/juce_gui_extra/native/juce_AndroidViewComponent.cpp
  27. +1
    -1
      modules/juce_gui_extra/native/juce_linux_XEmbedComponent.cpp
  28. +1
    -1
      modules/juce_opengl/native/juce_OpenGL_android.h
  29. +1
    -1
      modules/juce_opengl/native/juce_OpenGL_ios.h
  30. +1
    -1
      modules/juce_opengl/opengl/juce_OpenGLContext.cpp

+ 2
- 2
examples/GUI/WindowsDemo.h View File

@@ -334,7 +334,7 @@ private:
| RectanglePlacement::doNotResize); | RectanglePlacement::doNotResize);
auto result = placement.appliedTo (area, Desktop::getInstance().getDisplays() auto result = placement.appliedTo (area, Desktop::getInstance().getDisplays()
.getMainDisplay().userArea.reduced (20));
.getPrimaryDisplay()->userArea.reduced (20));
dw->setBounds (result); dw->setBounds (result);
dw->setResizable (true, ! native); dw->setResizable (true, ! native);
@@ -355,7 +355,7 @@ private:
| RectanglePlacement::doNotResize); | RectanglePlacement::doNotResize);
auto result = placement.appliedTo (area, Desktop::getInstance().getDisplays() auto result = placement.appliedTo (area, Desktop::getInstance().getDisplays()
.getMainDisplay().userArea.reduced (20));
.getPrimaryDisplay()->userArea.reduced (20));
balls->setBounds (result); balls->setBounds (result);
balls->setVisible (true); balls->setVisible (true);


+ 1
- 1
examples/Plugins/InterAppAudioEffectPluginDemo.h View File

@@ -349,7 +349,7 @@ private:
}; };
addChildComponent (switchToHostButton); addChildComponent (switchToHostButton);
auto screenSize = Desktop::getInstance().getDisplays().getMainDisplay().userArea;
auto screenSize = Desktop::getInstance().getDisplays().getPrimaryDisplay()->userArea;
setSize (screenSize.getWidth(), screenSize.getHeight()); setSize (screenSize.getWidth(), screenSize.getHeight());
resized(); resized();


+ 1
- 1
examples/Utilities/InAppPurchasesDemo.h View File

@@ -510,7 +510,7 @@ public:
soundNames = purchases.getVoiceNames(); soundNames = purchases.getVoiceNames();
#if JUCE_ANDROID || JUCE_IOS #if JUCE_ANDROID || JUCE_IOS
auto screenBounds = Desktop::getInstance().getDisplays().getMainDisplay().userArea;
auto screenBounds = Desktop::getInstance().getDisplays().getPrimaryDisplay()->userArea;
setSize (screenBounds.getWidth(), screenBounds.getHeight()); setSize (screenBounds.getWidth(), screenBounds.getHeight());
#else #else
setSize (800, 600); setSize (800, 600);


+ 1
- 1
examples/Utilities/PushNotificationsDemo.h View File

@@ -162,7 +162,7 @@ public:
mainTabs.addTab ("Local", colour, &localNotificationsTabs, false); mainTabs.addTab ("Local", colour, &localNotificationsTabs, false);
mainTabs.addTab ("Remote", colour, &remoteView, 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 #if JUCE_ANDROID || JUCE_IOS
setSize (userArea.getWidth(), userArea.getHeight()); setSize (userArea.getWidth(), userArea.getHeight());
#else #else


+ 6
- 6
extras/NetworkGraphicsDemo/Source/SlaveComponent.h View File

@@ -125,8 +125,8 @@ private:
//============================================================================== //==============================================================================
String getMachineInfoToDisplay() const 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() static String getOSName()
@@ -180,8 +180,8 @@ private:
if (auto client = canvas.findClient (clientName)) if (auto client = canvas.findClient (clientName))
{ {
auto screenBounds = getScreenBounds(); 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 {}; return {};
@@ -191,8 +191,8 @@ private:
{ {
if (auto client = canvas.findClient (clientName)) 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 {}; return {};


+ 1
- 1
extras/Projucer/Source/Application/jucer_MainWindow.cpp View File

@@ -800,7 +800,7 @@ void MainWindowList::checkWindowBounds (MainWindow& windowToCheck)
auto ensureWindowIsFullyOnscreen = [&] auto ensureWindowIsFullyOnscreen = [&]
{ {
auto windowBounds = windowToCheck.getScreenBounds(); 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()) if (auto* peer = windowToCheck.getPeer())
peer->getFrameSize().subtractFrom (screenLimits); peer->getFrameSize().subtractFrom (screenLimits);


+ 1
- 1
modules/juce_audio_plugin_client/VST/juce_VST_Wrapper.cpp View File

@@ -1096,7 +1096,7 @@ public:
{ {
auto screenBounds = peer->localToGlobal (peer->getBounds()); 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(); / Desktop::getInstance().getGlobalScaleFactor();
setContentScaleFactor ((float) scale); setContentScaleFactor ((float) scale);


+ 1
- 1
modules/juce_audio_processors/format_types/juce_VSTPluginFormat.cpp View File

@@ -3234,7 +3234,7 @@ private:
bool willCauseRecursiveResize (int w, int h) bool willCauseRecursiveResize (int w, int h)
{ {
auto newScreenBounds = Rectangle<int> (w, h).withPosition (getScreenPosition()); auto newScreenBounds = Rectangle<int> (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) bool isWindowSizeCorrectForPlugin (int w, int h)


+ 2
- 2
modules/juce_gui_basics/components/juce_Component.cpp View File

@@ -452,7 +452,7 @@ struct Component::ComponentHelpers
if (auto* p = comp.getParentComponent()) if (auto* p = comp.getParentComponent())
return p->getLocalBounds(); return p->getLocalBounds();
return Desktop::getInstance().getDisplays().getMainDisplay().userArea;
return Desktop::getInstance().getDisplays().getPrimaryDisplay()->userArea;
} }
static void releaseAllCachedImageResources (Component& c) static void releaseAllCachedImageResources (Component& c)
@@ -1059,7 +1059,7 @@ int Component::getParentHeight() const noexcept
Rectangle<int> Component::getParentMonitorArea() const Rectangle<int> Component::getParentMonitorArea() const
{ {
return Desktop::getInstance().getDisplays().findDisplayForRect (getScreenBounds()).userArea;
return Desktop::getInstance().getDisplays().getDisplayForRect (getScreenBounds())->userArea;
} }
int Component::getScreenX() const { return getScreenPosition().x; } int Component::getScreenX() const { return getScreenPosition().x; }


+ 1
- 1
modules/juce_gui_basics/desktop/juce_Displays.h View File

@@ -129,7 +129,7 @@ public:
void refresh(); void refresh();
/** @internal */ /** @internal */
~Displays() = default; ~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 // as they can deal with converting between logical and physical pixels
JUCE_DEPRECATED (const Display& getDisplayContaining (Point<int> position) const noexcept); JUCE_DEPRECATED (const Display& getDisplayContaining (Point<int> position) const noexcept);


+ 1
- 1
modules/juce_gui_basics/layout/juce_ComponentAnimator.cpp View File

@@ -163,7 +163,7 @@ public:
else else
jassertfalse; // seem to be trying to animate a component that's not visible.. 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); * Component::getApproximateScaleFactorForComponent (&c);
image = c.createComponentSnapshot (c.getLocalBounds(), false, scale); image = c.createComponentSnapshot (c.getLocalBounds(), false, scale);


+ 1
- 1
modules/juce_gui_basics/layout/juce_ComponentBoundsConstrainer.cpp View File

@@ -116,7 +116,7 @@ void ComponentBoundsConstrainer::setBoundsForComponent (Component* component,
if (auto* peer = component->getPeer()) if (auto* peer = component->getPeer())
border = peer->getFrameSize(); 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(); limits = component->getLocalArea (nullptr, screenBounds) + component->getPosition();
} }


+ 3
- 3
modules/juce_gui_basics/menus/juce_PopupMenu.cpp View File

@@ -649,11 +649,11 @@ struct MenuWindow : public Component
if (relativeTo != nullptr) if (relativeTo != nullptr)
targetPoint = relativeTo->localPointToGlobal (targetPoint); 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 #if JUCE_MAC || JUCE_ANDROID
.userArea;
->userArea;
#else #else
.totalArea; // on windows, don't stop the menu overlapping the taskbar
->totalArea; // on windows, don't stop the menu overlapping the taskbar
#endif #endif
if (parentComponent == nullptr) if (parentComponent == nullptr)


+ 3
- 3
modules/juce_gui_basics/native/juce_android_Windowing.cpp View File

@@ -258,7 +258,7 @@ public:
fullScreen (false), fullScreen (false),
navBarsHidden (false), navBarsHidden (false),
sizeAllocated (0), sizeAllocated (0),
scale ((float) Desktop::getInstance().getDisplays().getMainDisplay().scale)
scale ((float) Desktop::getInstance().getDisplays().getPrimaryDisplay()->scale)
{ {
auto* env = getEnv(); auto* env = getEnv();
@@ -546,7 +546,7 @@ public:
setNavBarsHidden (false); setNavBarsHidden (false);
} }
Rectangle<int> r (shouldBeFullScreen ? Desktop::getInstance().getDisplays().getMainDisplay().userArea
Rectangle<int> r (shouldBeFullScreen ? Desktop::getInstance().getDisplays().getPrimaryDisplay()->userArea
: lastNonFullscreenBounds); : lastNonFullscreenBounds);
if ((! shouldBeFullScreen) && r.isEmpty()) if ((! shouldBeFullScreen) && r.isEmpty())
@@ -1428,7 +1428,7 @@ public:
if (newBounds != oldBounds) if (newBounds != oldBounds)
{ {
auto& displays = Desktop::getInstance().getDisplays(); auto& displays = Desktop::getInstance().getDisplays();
auto& mainDisplay = displays.getMainDisplay();
auto& mainDisplay = *displays.getPrimaryDisplay();
Rectangle<int> userArea = newBounds / mainDisplay.scale; Rectangle<int> userArea = newBounds / mainDisplay.scale;


+ 1
- 1
modules/juce_gui_basics/native/juce_ios_ContentSharer.cpp View File

@@ -120,7 +120,7 @@ private:
controller.get().modalTransitionStyle = UIModalTransitionStyleCoverVertical; controller.get().modalTransitionStyle = UIModalTransitionStyleCoverVertical;
auto bounds = Desktop::getInstance().getDisplays().getMainDisplay().userArea;
auto bounds = Desktop::getInstance().getDisplays().getPrimaryDisplay()->userArea;
setBounds (bounds); setBounds (bounds);
setAlwaysOnTop (true); setAlwaysOnTop (true);


+ 1
- 1
modules/juce_gui_basics/native/juce_ios_FileChooser.mm View File

@@ -112,7 +112,7 @@ public:
return; return;
} }
auto chooserBounds = Desktop::getInstance().getDisplays().getMainDisplay().userArea;
auto chooserBounds = Desktop::getInstance().getDisplays().getPrimaryDisplay()->userArea;
setBounds (chooserBounds); setBounds (chooserBounds);
setAlwaysOnTop (true); setAlwaysOnTop (true);


+ 3
- 3
modules/juce_gui_basics/native/juce_ios_UIViewComponentPeer.mm View File

@@ -662,7 +662,7 @@ void UIViewComponentPeer::setFullScreen (bool shouldBeFullScreen)
{ {
if (! isSharedWindow) if (! isSharedWindow)
{ {
auto r = shouldBeFullScreen ? Desktop::getInstance().getDisplays().getMainDisplay().userArea
auto r = shouldBeFullScreen ? Desktop::getInstance().getDisplays().getPrimaryDisplay()->userArea
: lastNonFullscreenBounds; : lastNonFullscreenBounds;
if ((! shouldBeFullScreen) && r.isEmpty()) if ((! shouldBeFullScreen) && r.isEmpty())
@@ -681,7 +681,7 @@ void UIViewComponentPeer::updateScreenBounds()
auto& desktop = Desktop::getInstance(); auto& desktop = Desktop::getInstance();
auto oldArea = component.getBounds(); auto oldArea = component.getBounds();
auto oldDesktop = desktop.getDisplays().getMainDisplay().userArea;
auto oldDesktop = desktop.getDisplays().getPrimaryDisplay()->userArea;
const_cast<Displays&> (desktop.getDisplays()).refresh(); const_cast<Displays&> (desktop.getDisplays()).refresh();
@@ -696,7 +696,7 @@ void UIViewComponentPeer::updateScreenBounds()
auto centreRelX = oldArea.getCentreX() / (float) oldDesktop.getWidth(); auto centreRelX = oldArea.getCentreX() / (float) oldDesktop.getWidth();
auto centreRelY = oldArea.getCentreY() / (float) oldDesktop.getHeight(); 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 x = ((int) (newDesktop.getWidth() * centreRelX)) - (oldArea.getWidth() / 2);
auto y = ((int) (newDesktop.getHeight() * centreRelY)) - (oldArea.getHeight() / 2); auto y = ((int) (newDesktop.getHeight() * centreRelY)) - (oldArea.getHeight() / 2);


+ 3
- 3
modules/juce_gui_basics/native/juce_linux_Windowing.cpp View File

@@ -171,7 +171,7 @@ public:
if (fullScreen != shouldBeFullScreen) if (fullScreen != shouldBeFullScreen)
{ {
if (shouldBeFullScreen) if (shouldBeFullScreen)
r = Desktop::getInstance().getDisplays().getMainDisplay().userArea;
r = Desktop::getInstance().getDisplays().getPrimaryDisplay()->userArea;
if (! r.isEmpty()) if (! r.isEmpty())
setBounds (ScalingHelpers::scaledScreenPosToUnscaled (component, r), shouldBeFullScreen); setBounds (ScalingHelpers::scaledScreenPosToUnscaled (component, r), shouldBeFullScreen);
@@ -424,7 +424,7 @@ private:
Point<int> translation = (parentWindow != 0 ? getScreenPosition (isPhysical) : Point<int>()); Point<int> translation = (parentWindow != 0 ? getScreenPosition (isPhysical) : Point<int>());
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(); / Desktop::getInstance().getGlobalScaleFactor();
if (! approximatelyEqual (newScaleFactor, currentScaleFactor)) if (! approximatelyEqual (newScaleFactor, currentScaleFactor))
@@ -467,7 +467,7 @@ JUCE_API void JUCE_CALLTYPE Process::hide() {}
void Desktop::setKioskComponent (Component* comp, bool enableOrDisable, bool) void Desktop::setKioskComponent (Component* comp, bool enableOrDisable, bool)
{ {
if (enableOrDisable) if (enableOrDisable)
comp->setBounds (getDisplays().findDisplayForRect (comp->getScreenBounds()).totalArea);
comp->setBounds (getDisplays().getDisplayForRect (comp->getScreenBounds())->totalArea);
} }
void Displays::findDisplays (float masterScale) void Displays::findDisplays (float masterScale)


+ 1
- 1
modules/juce_gui_basics/native/juce_mac_NSViewComponentPeer.mm View File

@@ -2226,7 +2226,7 @@ void Desktop::setKioskComponent (Component* kioskComp, bool shouldBeEnabled, boo
[NSApp setPresentationOptions: (allowMenusAndBars ? (NSApplicationPresentationAutoHideDock | NSApplicationPresentationAutoHideMenuBar) [NSApp setPresentationOptions: (allowMenusAndBars ? (NSApplicationPresentationAutoHideDock | NSApplicationPresentationAutoHideMenuBar)
: (NSApplicationPresentationHideDock | NSApplicationPresentationHideMenuBar))]; : (NSApplicationPresentationHideDock | NSApplicationPresentationHideMenuBar))];
kioskComp->setBounds (getDisplays().findDisplayForRect (kioskComp->getScreenBounds()).totalArea);
kioskComp->setBounds (getDisplays().getDisplayForRect (kioskComp->getScreenBounds())->totalArea);
peer->becomeKeyWindow(); peer->becomeKeyWindow();
} }
else else


+ 2
- 2
modules/juce_gui_basics/native/juce_win32_FileChooser.cpp View File

@@ -547,7 +547,7 @@ private:
auto screenRectangle = Rectangle<int>::leftTopRightBottom (dialogScreenRect.left, dialogScreenRect.top, auto screenRectangle = Rectangle<int>::leftTopRightBottom (dialogScreenRect.left, dialogScreenRect.top,
dialogScreenRect.right, dialogScreenRect.bottom); 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); auto physicalComponentWidth = roundToInt (safeCustomComponent->getWidth() * scale);
SetWindowPos (hdlg, nullptr, screenRectangle.getX(), screenRectangle.getY(), SetWindowPos (hdlg, nullptr, screenRectangle.getX(), screenRectangle.getY(),
@@ -700,7 +700,7 @@ public:
nativeFileChooser (new Win32NativeFileChooser (this, flags, previewComp, fileChooser.startingFile, nativeFileChooser (new Win32NativeFileChooser (this, flags, previewComp, fileChooser.startingFile,
fileChooser.title, fileChooser.filters)) fileChooser.title, fileChooser.filters))
{ {
auto mainMon = Desktop::getInstance().getDisplays().getMainDisplay().userArea;
auto mainMon = Desktop::getInstance().getDisplays().getPrimaryDisplay()->userArea;
setBounds (mainMon.getX() + mainMon.getWidth() / 4, setBounds (mainMon.getX() + mainMon.getWidth() / 4,
mainMon.getY() + mainMon.getHeight() / 4, mainMon.getY() + mainMon.getHeight() / 4,


+ 6
- 6
modules/juce_gui_basics/native/juce_win32_Windowing.cpp View File

@@ -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 // 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... // divide the bounds by the scale factor as it will get multiplied for the virtualised paint callback...
if (isPerMonitorDPIAwareThread() && ! isPerMonitorDPIAwareWindow (hwnd)) if (isPerMonitorDPIAwareThread() && ! isPerMonitorDPIAwareWindow (hwnd))
scale = 1.0 / Desktop::getInstance().getDisplays().getMainDisplay().scale;
scale = 1.0 / Desktop::getInstance().getDisplays().getPrimaryDisplay()->scale;
#endif #endif
auto scaled = area.toDouble() * scale; auto scaled = area.toDouble() * scale;
@@ -2175,9 +2175,9 @@ private:
auto bounds = component.getBounds(); auto bounds = component.getBounds();
if (bounds.isEmpty()) if (bounds.isEmpty())
scaleFactor = Desktop::getInstance().getDisplays().getMainDisplay().scale;
scaleFactor = Desktop::getInstance().getDisplays().getPrimaryDisplay()->scale;
else else
scaleFactor = Desktop::getInstance().getDisplays().findDisplayForRect (bounds).scale;
scaleFactor = Desktop::getInstance().getDisplays().getDisplayForRect (bounds)->scale;
scaleFactor /= Desktop::getInstance().getGlobalScaleFactor(); scaleFactor /= Desktop::getInstance().getGlobalScaleFactor();
} }
@@ -3419,7 +3419,7 @@ private:
if (fullScreen && ! isMinimised()) if (fullScreen && ! isMinimised())
setWindowPos (hwnd, ScalingHelpers::scaledScreenPosToUnscaled (component, Desktop::getInstance().getDisplays() setWindowPos (hwnd, ScalingHelpers::scaledScreenPosToUnscaled (component, Desktop::getInstance().getDisplays()
.findDisplayForRect (component.getScreenBounds()).userArea),
.getDisplayForRect (component.getScreenBounds())->userArea),
SWP_NOACTIVATE | SWP_NOOWNERZORDER | SWP_NOZORDER | SWP_NOSENDCHANGING); SWP_NOACTIVATE | SWP_NOOWNERZORDER | SWP_NOZORDER | SWP_NOSENDCHANGING);
} }
@@ -4455,7 +4455,7 @@ void Desktop::setKioskComponent (Component* kioskModeComp, bool enableOrDisable,
tlw->setUsingNativeTitleBar (! enableOrDisable); tlw->setUsingNativeTitleBar (! enableOrDisable);
if (enableOrDisable) if (enableOrDisable)
kioskModeComp->setBounds (getDisplays().findDisplayForRect (kioskModeComp->getScreenBounds()).totalArea);
kioskModeComp->setBounds (getDisplays().getDisplayForRect (kioskModeComp->getScreenBounds())->totalArea);
} }
void Desktop::allowedOrientationsChanged() {} void Desktop::allowedOrientationsChanged() {}
@@ -4508,7 +4508,7 @@ static const Displays::Display* getCurrentDisplayFromScaleFactor (HWND hwnd)
return retVal; return retVal;
} }
return &Desktop::getInstance().getDisplays().getMainDisplay();
return Desktop::getInstance().getDisplays().getPrimaryDisplay();
} }
//============================================================================== //==============================================================================


+ 1
- 1
modules/juce_gui_basics/windows/juce_CallOutBox.cpp View File

@@ -40,7 +40,7 @@ CallOutBox::CallOutBox (Component& c, Rectangle<int> area, Component* const pare
else else
{ {
setAlwaysOnTop (juce_areThereAnyAlwaysOnTopWindows()); setAlwaysOnTop (juce_areThereAnyAlwaysOnTopWindows());
updatePosition (area, Desktop::getInstance().getDisplays().findDisplayForRect (area).userArea);
updatePosition (area, Desktop::getInstance().getDisplays().getDisplayForRect (area)->userArea);
addToDesktop (ComponentPeer::windowIsTemporary); addToDesktop (ComponentPeer::windowIsTemporary);
startTimer (100); startTimer (100);


+ 1
- 1
modules/juce_gui_basics/windows/juce_ResizableWindow.cpp View File

@@ -564,7 +564,7 @@ bool ResizableWindow::restoreWindowStateFromString (const String& s)
if (onScreenArea.getWidth() * onScreenArea.getHeight() < 32 * 32) 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()), newPos.setSize (jmin (newPos.getWidth(), screen.getWidth()),
jmin (newPos.getHeight(), screen.getHeight())); jmin (newPos.getHeight(), screen.getHeight()));


+ 1
- 1
modules/juce_gui_basics/windows/juce_TooltipWindow.cpp View File

@@ -91,7 +91,7 @@ void TooltipWindow::displayTip (Point<int> screenPos, const String& tip)
} }
else else
{ {
updatePosition (tip, screenPos, Desktop::getInstance().getDisplays().findDisplayForPoint (screenPos).userArea);
updatePosition (tip, screenPos, Desktop::getInstance().getDisplays().getDisplayForPoint (screenPos)->userArea);
addToDesktop (ComponentPeer::windowHasDropShadow addToDesktop (ComponentPeer::windowHasDropShadow
| ComponentPeer::windowIsTemporary | ComponentPeer::windowIsTemporary


+ 1
- 1
modules/juce_gui_extra/misc/juce_SplashScreen.cpp View File

@@ -57,7 +57,7 @@ void SplashScreen::makeVisible (int w, int h, bool useDropShadow, bool fullscree
clickCountToDelete = Desktop::getInstance().getMouseButtonClickCounter(); clickCountToDelete = Desktop::getInstance().getMouseButtonClickCounter();
creationTime = Time::getCurrentTime(); creationTime = Time::getCurrentTime();
const Rectangle<int> screenSize = Desktop::getInstance().getDisplays().getMainDisplay().userArea;
const Rectangle<int> screenSize = Desktop::getInstance().getDisplays().getPrimaryDisplay()->userArea;
const int width = (fullscreen ? screenSize.getWidth() : w); const int width = (fullscreen ? screenSize.getWidth() : w);
const int height = (fullscreen ? screenSize.getHeight() : h); const int height = (fullscreen ? screenSize.getHeight() : h);


+ 1
- 1
modules/juce_gui_extra/native/juce_AndroidViewComponent.cpp View File

@@ -52,7 +52,7 @@ public:
auto pos = topComp->getLocalPoint (&owner, Point<int>()); auto pos = topComp->getLocalPoint (&owner, Point<int>());
Rectangle<int> r (pos.x, pos.y, owner.getWidth(), owner.getHeight()); Rectangle<int> 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(), getEnv()->CallVoidMethod (view, AndroidView.layout, r.getX(), r.getY(),
r.getRight(), r.getBottom()); r.getRight(), r.getBottom());


+ 1
- 1
modules/juce_gui_extra/native/juce_linux_XEmbedComponent.cpp View File

@@ -438,7 +438,7 @@ private:
auto& displays = Desktop::getInstance().getDisplays(); auto& displays = Desktop::getInstance().getDisplays();
auto* peer = owner.getPeer(); auto* peer = owner.getPeer();
const double scale = (peer != nullptr ? peer->getPlatformScaleFactor() const double scale = (peer != nullptr ? peer->getPlatformScaleFactor()
: displays.getMainDisplay().scale);
: displays.getPrimaryDisplay()->scale);
Point<int> topLeftInPeer Point<int> topLeftInPeer
= (peer != nullptr ? peer->getComponent().getLocalPoint (&owner, Point<int> (0, 0)) = (peer != nullptr ? peer->getComponent().getLocalPoint (&owner, Point<int> (0, 0))


+ 1
- 1
modules/juce_opengl/native/juce_OpenGL_android.h View File

@@ -231,7 +231,7 @@ public:
auto env = getEnv(); auto env = getEnv();
lastBounds = bounds; lastBounds = bounds;
auto r = bounds * Desktop::getInstance().getDisplays().getMainDisplay().scale;
auto r = bounds * Desktop::getInstance().getDisplays().getPrimaryDisplay()->scale;
env->CallVoidMethod (surfaceView.get(), JuceOpenGLViewSurface.layout, env->CallVoidMethod (surfaceView.get(), JuceOpenGLViewSurface.layout,
(jint) r.getX(), (jint) r.getY(), (jint) r.getRight(), (jint) r.getBottom()); (jint) r.getX(), (jint) r.getY(), (jint) r.getRight(), (jint) r.getBottom());


+ 1
- 1
modules/juce_opengl/native/juce_OpenGL_ios.h View File

@@ -184,7 +184,7 @@ public:
void updateWindowPosition (Rectangle<int> bounds) void updateWindowPosition (Rectangle<int> bounds)
{ {
view.frame = convertToCGRect (bounds); view.frame = convertToCGRect (bounds);
glLayer.contentsScale = (CGFloat) (Desktop::getInstance().getDisplays().getMainDisplay().scale
glLayer.contentsScale = (CGFloat) (Desktop::getInstance().getDisplays().getPrimaryDisplay()->scale
/ component.getDesktopScaleFactor()); / component.getDesktopScaleFactor());
if (lastBounds != bounds) if (lastBounds != bounds)


+ 1
- 1
modules/juce_opengl/opengl/juce_OpenGLContext.cpp View File

@@ -286,7 +286,7 @@ public:
if (auto* peer = component.getPeer()) if (auto* peer = component.getPeer())
{ {
auto localBounds = component.getLocalBounds(); 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; auto newArea = peer->getComponent().getLocalArea (&component, localBounds).withZeroOrigin() * displayScale;


Loading…
Cancel
Save