diff --git a/modules/juce_gui_basics/native/juce_win32_Windowing.cpp b/modules/juce_gui_basics/native/juce_win32_Windowing.cpp index ddea196e7d..47963d00ec 100644 --- a/modules/juce_gui_basics/native/juce_win32_Windowing.cpp +++ b/modules/juce_gui_basics/native/juce_win32_Windowing.cpp @@ -1404,12 +1404,13 @@ private: static BOOL CALLBACK clipChildWindowCallback (HWND hwnd, LPARAM context) { - RECT childPos, parentPos; + RECT childPos; GetWindowRect (hwnd, &childPos); - GetWindowRect (GetParent (hwnd), &parentPos); + POINT pos = { childPos.left, childPos.top }; + ScreenToClient (GetParent (hwnd), &pos); - ((RectangleList*) context)->subtract (Rectangle (childPos.left - parentPos.left, - childPos.top - parentPos.top, + ((RectangleList*) context)->subtract (Rectangle (pos.x, + pos.y, childPos.right - childPos.left, childPos.bottom - childPos.top)); return TRUE; diff --git a/modules/juce_opengl/opengl/juce_OpenGLContext.cpp b/modules/juce_opengl/opengl/juce_OpenGLContext.cpp index 88800fe3b5..c1d63d83d4 100644 --- a/modules/juce_opengl/opengl/juce_OpenGLContext.cpp +++ b/modules/juce_opengl/opengl/juce_OpenGLContext.cpp @@ -185,18 +185,21 @@ public: void updateViewportSize (bool canTriggerUpdate) { - const double newScale = Desktop::getInstance().getDisplays() - .getDisplayContaining (component.getScreenBounds().getCentre()).scale; - - Rectangle newArea (component.getLocalBounds() * newScale); - - if (scale != newScale || viewportArea != newArea) + if (ComponentPeer* peer = component.getPeer()) { - scale = newScale; - viewportArea = newArea; + Rectangle newArea (peer->getAreaCoveredBy (component).withPosition (0, 0)); - if (canTriggerUpdate) - invalidateAll(); + const double newScale = Desktop::getInstance().getDisplays() + .getDisplayContaining (component.getScreenBounds().getCentre()).scale; + + if (scale != newScale || viewportArea != newArea) + { + scale = newScale; + viewportArea = newArea; + + if (canTriggerUpdate) + invalidateAll(); + } } }