From 353b862fb7ba641e945bef6e1e0b3eff34458e01 Mon Sep 17 00:00:00 2001 From: Kirill Kalishev Date: Thu, 12 May 2011 13:17:56 +0400 Subject: [PATCH] [xena] deprecated constructor RelativePoint(screenCooridnates), fixed computing of preferred container [r=anna.kozlova] --- .../src/com/intellij/ui/awt/RelativePoint.java | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/platform/util/src/com/intellij/ui/awt/RelativePoint.java b/platform/util/src/com/intellij/ui/awt/RelativePoint.java index 0280e56408b1..dcc24baad4b5 100644 --- a/platform/util/src/com/intellij/ui/awt/RelativePoint.java +++ b/platform/util/src/com/intellij/ui/awt/RelativePoint.java @@ -40,9 +40,21 @@ public class RelativePoint { public RelativePoint(Point screenPoint) { Point p = new Point(screenPoint.x, screenPoint.y); - Frame c = JOptionPane.getRootFrame(); - SwingUtilities.convertPointFromScreen(p, c); - init(c, p); + Window[] windows = Frame.getWindows(); + Window targetWindow = null; + for (Window each : windows) { + if (each.isActive()) { + targetWindow = each; + break; + } + } + + if (targetWindow == null) { + targetWindow = JOptionPane.getRootFrame(); + } + + SwingUtilities.convertPointFromScreen(p, targetWindow); + init(targetWindow, p); } private void init(Component aComponent, Point aPointOnComponent) {