Java applets and ConfigureRequest

Koos Vriezen koos.vriezen at xs4all.nl
Sat Dec 6 16:48:43 GMT 2003


Hi,

Trying to find the cause of applets being wrongly embedded, I found that
the coordinates of the JFrame are totally wrong. To see this, do
- add '-Dkjas.debug=1' to 'Additional Java Arguments' setting
- start from the console eg
  konqueror 'http://developer.netscape.com/docs/examples/java/hitman.html
  press a few times F5 until a gray rectangle appears
- get the dimension via javascript, eg
  dcop konqueror-21639 html-widget1 evalJS '
  var a1=document.applets[1].getParent().getParent().getParent().getParent().getParent().getBounds()'
  (applets[1] means the second applet here)
- now either look at the console output or get it from 'a1' like
  a1.x/y/width/height eg.
   dcop konqueror-21639 html-widget1 evalJS 'a1.height'

(BTW, using a javax.swing.JFrame instead of java.awt.Frame makes no sense
to me, it saves some parents if using a java.awt.Frame)

Note, you probably need the latest java version because of a missing cast,
jvm will exit otherwise.

If I add in qxembed.cpp in QXEmbed::x11Event case ConfigureRequest

    unsigned int value_mask = e->xconfigurerequest.value_mask
                              |CWX|CWY|CWWidth|CWHeight|CWBorderWidth;
    XWindowChanges xwc = {
          0, 0, width(), height(),
          0, None, Above
    };
    XConfigureWindow (qt_xdisplay(), window, value_mask, &xwc);

instead of sending a ConfigureNotifyEvent (tried setting the x and y to
zero too, like Leon suggests, but that didn't help - shouldn't this be
fixed btw.), the dimensions are set correctly. However the borders are
still wrong (use getInsets() instead off getBounds() and fields
top/left/right/bottom). They should all be 0, no?
Another thing is that calling XConfigureWindow blocks jvm for a second or
two (XFlush didn't help).
So the question is, shouldn't qxembed configure the window if it receives
a ConfigureRequest (and any idea why it blocks the jvm for a while)?
And how to set the border dimensions correctly?
Or, of course, how come these values are messed up now and then?

Koos





More information about the kfm-devel mailing list