6508505: JComboBox collapses immediately if it is placed to embedded frame
authordcherepanov
Mon, 31 Mar 2008 15:41:56 +0400
changeset 430 ff8a4a3ad82f
parent 429 575450f82165
child 431 6aea7c26a8dc
6508505: JComboBox collapses immediately if it is placed to embedded frame Summary: XWindowPeer should translate absolute coordinates to local Reviewed-by: son
jdk/src/solaris/classes/sun/awt/X11/XWindowPeer.java
--- a/jdk/src/solaris/classes/sun/awt/X11/XWindowPeer.java	Fri Mar 28 03:06:00 2008 -0700
+++ b/jdk/src/solaris/classes/sun/awt/X11/XWindowPeer.java	Mon Mar 31 15:41:56 2008 +0400
@@ -1974,8 +1974,9 @@
                 // So, I do not want to implement complicated logic for better retargeting.
                 target = pressTarget.isVisible() ? pressTarget : this;
                 xme.set_window(target.getWindow());
-                xme.set_x(xme.get_x_root() - target.getX());
-                xme.set_y(xme.get_y_root() - target.getY());
+                Point localCoord = target.toLocal(xme.get_x_root(), xme.get_y_root());
+                xme.set_x(localCoord.x);
+                xme.set_y(localCoord.y);
             }
             grabLog.log(Level.FINER, "  -  Grab event target {0}", new Object[] {target});
             if (target != null) {
@@ -2026,8 +2027,9 @@
                     // see 6390326 for more information.
                     target = pressTarget.isVisible() ? pressTarget : this;
                     xbe.set_window(target.getWindow());
-                    xbe.set_x(xbe.get_x_root() - target.getX());
-                    xbe.set_y(xbe.get_y_root() - target.getY());
+                    Point localCoord = target.toLocal(xbe.get_x_root(), xbe.get_y_root());
+                    xbe.set_x(localCoord.x);
+                    xbe.set_y(localCoord.y);
                     pressTarget = this;
                 }
                 if (target != null && target != getContentXWindow() && target != this) {