Browse Source

Linux: Fixed an issue in LinuxComponentPeer::getScreenPosition() with embedded windows

tags/2021-05-28
ed 6 years ago
parent
commit
c07c9f89fe
1 changed files with 23 additions and 5 deletions
  1. +23
    -5
      modules/juce_gui_basics/native/juce_linux_X11_Windowing.cpp

+ 23
- 5
modules/juce_gui_basics/native/juce_linux_X11_Windowing.cpp View File

@@ -1261,10 +1261,13 @@ public:
Point<int> getScreenPosition (bool physical) const
{
auto screenBounds = (parentWindow == 0 ? bounds
: bounds.translated (parentScreenPosition.x, parentScreenPosition.y));
if (physical)
return Desktop::getInstance().getDisplays().logicalToPhysical (bounds.getTopLeft());
return Desktop::getInstance().getDisplays().logicalToPhysical (screenBounds.getTopLeft());
return bounds.getTopLeft();
return screenBounds.getTopLeft();
}
Rectangle<int> getBounds() const override { return bounds; }
@@ -2399,6 +2402,7 @@ private:
friend class LinuxRepaintManager;
Window windowH = {}, parentWindow = {}, keyProxy = {};
Rectangle<int> bounds;
Point<int> parentScreenPosition;
Image taskbarImage;
bool fullScreen = false, mapped = false, focused = false;
Visual* visual = {};
@@ -2855,9 +2859,23 @@ private:
ScopedXLock xlock (display);
if (XGetGeometry (display, (::Drawable) windowH, &root, &wx, &wy, &ww, &wh, &bw, &bitDepth) && parentWindow == 0)
if (! XTranslateCoordinates (display, windowH, root, 0, 0, &wx, &wy, &child))
wx = wy = 0;
if (XGetGeometry (display, (::Drawable) windowH, &root, &wx, &wy, &ww, &wh, &bw, &bitDepth))
{
int rootX = 0, rootY = 0;
if (! XTranslateCoordinates (display, windowH, root, 0, 0, &rootX, &rootY, &child))
rootX = rootY = 0;
if (parentWindow == 0)
{
wx = rootX;
wy = rootY;
}
else
{
parentScreenPosition = Desktop::getInstance().getDisplays().physicalToLogical (Point<int> (rootX, rootY));
}
}
Rectangle<int> physicalBounds (wx, wy, (int) ww, (int) wh);


Loading…
Cancel
Save