United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
JDK-6522374 : XEmbeddedFrame doesn't reconfigure itself on ConfigureNotify

Details
Type:
Bug
Submit Date:
2007-02-07
Status:
Closed
Updated Date:
2011-05-17
Project Name:
JDK
Resolved Date:
2011-05-17
Component:
client-libs
OS:
linux
Sub-Component:
java.awt
CPU:
x86
Priority:
P3
Resolution:
Fixed
Affected Versions:
6
Fixed Versions:

Related Reports
Backport:
Backport:
Relates:

Sub Tasks

Description
XEmbeddedFramePeer doen't correctly change it geometry on ConfigureNotify.
It just set x, y, width, and height fields, but it looks like we need to update
geometry of content window (and perhaps something else).

And this cause the following bug in AWT-SWT bridge

https://bugs.eclipse.org/bugs/show_bug.cgi?id=168043

                                    

Comments
SUGGESTED FIX

the core part of the fix is :
+++ XEmbeddedFramePeer.java        2007-02-13 18:25:17.000000000 +0300
@@ -5,23 +5,24 @@
  * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
  */
 
 package sun.awt.X11;
 
-import sun.awt.EmbeddedFrame;
-import sun.awt.X11.XEmbeddedFrame;
-import java.awt.peer.ComponentPeer;
 import java.awt.*;
-import java.awt.event.ComponentEvent;
-import java.util.logging.*;
-import java.awt.AWTKeyStroke;
+
 import java.util.LinkedList;
 import java.util.Iterator;
 
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import sun.awt.EmbeddedFrame;
+import sun.awt.SunToolkit;
+
 public class XEmbeddedFramePeer extends XFramePeer {
 
-    private static final Logger xembedLog = Logger.getLogger("sun.awt.X11.xembed");
+    private static final Logger xembedLog = Logger.getLogger("sun.awt.X11.xembed.XEmbeddedFramePeer");
 
     LinkedList<AWTKeyStroke> strokes;
 
     XEmbedClientHelper embedder; // Caution - can be null if XEmbed is not supported
     public XEmbeddedFramePeer(EmbeddedFrame target) {
@@ -109,37 +110,41 @@
         return super.isEventDisabled(e);
     }
 
     public void handleConfigureNotifyEvent(XEvent xev)
     {
+        assert (SunToolkit.isAWTLockHeldByCurrentThread());
+        XConfigureEvent xe = xev.get_xconfigure();
+        if (xembedLog.isLoggable(Level.FINE)) {
+            xembedLog.fine(xe.toString());
+        }
+        
         // fix for 5063031
         // if we use super.handleConfigureNotifyEvent() we would get wrong
-        //   size and position because embedded frame really is NOT a decorated one
-
-        XConfigureEvent xe = xev.get_xconfigure();
-
+        // size and position because embedded frame really is NOT a decorated one
         checkIfOnNewScreen(toGlobal(new Rectangle(xe.get_x(),
-                                                  xe.get_y(),  
-                                                  xe.get_width(),  
-                                                  xe.get_height())));
-
-
+                xe.get_y(),
+                xe.get_width(),
+                xe.get_height())));
+        
         Rectangle oldBounds = getBounds();
-
-        x = xe.get_x();
-        y = xe.get_y();
-        width = xe.get_width();
-        height = xe.get_height();
-
-        Rectangle bounds = getBounds();
-        if (!bounds.getSize().equals(oldBounds.getSize())) {
-            postEventToEventQueue(new ComponentEvent(getEventSource(), ComponentEvent.COMPONENT_RESIZED));
-        }
-        if (!bounds.getLocation().equals(oldBounds.getLocation())) {
-            postEventToEventQueue(new ComponentEvent(getEventSource(), ComponentEvent.COMPONENT_MOVED));
-        }  
-    }      
+        
+        synchronized (getStateLock()) {
+            x = xe.get_x();
+            y = xe.get_y();
+            width = xe.get_width();
+            height = xe.get_height();
+            
+            dimensions.setClientSize(width, height);
+            dimensions.setLocation(x, y);
+        }
+        
+        if (!getLocation().equals(oldBounds.getLocation())) {
+            handleMoved(dimensions);
+        }
+        reconfigureContentWindow(dimensions);
+    }
 
     protected void traverseOutForward() {
         if (embedder != null && embedder.isActive()) {
             if (embedder.isApplicationActive()) {  
                 xembedLog.fine("Traversing out Forward");

this could be used for backporting.
The full fix could be found at http://javaweb.sfbay/jcg/7/awt/6522374/ (and it is attached)
                                     
2007-02-14
EVALUATION

the problem is that we do not reconfigure embedded frame's content window.
                                     
2007-02-09
EVALUATION

to fix this I update dimentions of the embedded frame and call handleMoved() and
reconfigureContentWindow()
                                     
2007-02-09



Hardware and Software, Engineered to Work Together