mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-10 23:44:24 +00:00
Linux: Fixed an issue in LinuxComponentPeer::getScreenPosition() with embedded windows
This commit is contained in:
parent
388e42214c
commit
c07c9f89fe
1 changed files with 24 additions and 6 deletions
|
|
@ -1261,10 +1261,13 @@ public:
|
|||
|
||||
Point<int> getScreenPosition (bool physical) const
|
||||
{
|
||||
if (physical)
|
||||
return Desktop::getInstance().getDisplays().logicalToPhysical (bounds.getTopLeft());
|
||||
auto screenBounds = (parentWindow == 0 ? bounds
|
||||
: bounds.translated (parentScreenPosition.x, parentScreenPosition.y));
|
||||
|
||||
return bounds.getTopLeft();
|
||||
if (physical)
|
||||
return Desktop::getInstance().getDisplays().logicalToPhysical (screenBounds.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…
Add table
Add a link
Reference in a new issue