! Please note that this is a snapshot of our old Bugzilla server, which is read only since May 29, 2020. Please go to gitlab.xfce.org for our new server !
xfwm4 does not properly handle z-order of dialogs for Sun Java version 1.6


Description Brian Merrill 2006-11-01 01:36:34 CET
User-Agent:       Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.1) Gecko/20061025 Firefox/2.0
Build Identifier: 

Sun's Java JDK version 1.6 is approaching it's final version and xfwm4 does not appear to correctly place Swing-based JDialog frames above it's parent JFrame when multiple Java Frames are open.  Sun JDK 1.6 JDialog z-order behavior appears to work correctly on other window manager including metacity, fluxbox, and Beryl.  Please see the attached jar file which contains a simple Java test application which demonstrates the behavior described above.

Reproducible: Always

Steps to Reproduce:
1.Install the latest Sun JDK 1.6 binary from http://download.java.net/jdk6/binaries/
2.Execute the java test jar from a terminal by typing "java -jar xfwm4-jdk6-test.jar" without the quotes
3.Upon executing xfwm4-jdk6-test.jar, click on the "Open MDI Frames" button which will open 9 MDI type JFrames.
4. Each MDI JFrame contains a button named "Show Dialog".  Clicking on any of the Show Dialog buttons will open up a JDialog which will be hidden behind the JFrames.
5. One Alt-Tab will display the JDialog, but upon trying to click on the JDialog, focus will switch to the parent JFrame and the JDialog will be hidden again.

Actual Results:  
The JDialog is hidden behind it's parent frame.

Expected Results:  
The JDialog should be shown above it's parent frame and have focus.
Comment 1 Brian Merrill 2006-11-01 01:38:23 CET
Created attachment 847 

Jar contains the java source.
Execute by running "java -jar xfwm4-jdk6-test.jar" with Sun Java JDK 1.6
Comment 2 Olivier Fourdan editbugs 2006-11-01 08:55:05 CET
It clearly triggers a bug, indeed.
Comment 3 Olivier Fourdan editbugs 2006-11-01 10:12:53 CET
Humm, I dunno what java 1.6 is doing, but it's really odd, just like if it was trying to restack windows by itself. It misbehave, somehow, with all WM I tried (kwin, icewm) but metacity... Odd.
Comment 4 Olivier Fourdan editbugs 2006-11-01 10:32:09 CET
OK, I think I understand what Java 1.6 is doing here...  When the pop-up is shown, it builds a list of "transient_for" properties between all the existing mdi windows opened, in the z-order, and update their properties accordingly.

It's clearly hacky IMHO, I guess they do that for the legacy WM that did not properly handled transient_for == root which means is supposed to mean transient for all windows of thesame group (which is what they are trying to achieve anyway).

I could be wrong, though, it's just rough guesses.
Comment 5 Olivier Fourdan editbugs 2006-11-01 11:02:35 CET
Created attachment 848 
Disable raising of client on WM_TRANSIENT_FOR property change

Well, I think this is exactly what I describe. Here is the scenario:

Java updates the WM_TRANSIENT_FOR property of its windows, by settings every window transient for the one that's just below it, in order to maintain the z-order, as most WM maintains transients above their parents (note that there is no obligation of doing so, it's just a common behavior between WM).

When xfwm4 receives a WM_TRANSIENT_FOR property change, it raises the window above the parent to ensure that transients stays above parents.

That causes a raise condition as the WM is updating the Z-order of the windows while Java is using the Z-order to update the transient for properties.

I do think that what Java does here is not a good idea, ie change the TRANSIENT_FOR property on-the-fly for that purpose.

Disabling the raise of transient on WM_TRANSIENT_FOR property change in xfwm4 fixes the issue with Java 1.6. But it's like "degrading" xfwm4 to make Java 1.6 happy :(

See attached patch against current SVN trunk.
Comment 6 Olivier Fourdan editbugs 2006-11-01 12:31:09 CET
I've committed the patch to SVN trunk and xfce 4.2 branch.
Comment 7 Brian Merrill 2006-11-01 17:09:46 CET
I tested the patch and can confirm it resolves the issue for me as well and has made working with Java on xfce much more pleasant.  Thank you for the great explanation and swift response.
Comment 8 Vincent Torri 2011-09-13 07:19:47 CEST
maybe you should report a bug to java devs:


Bug #2483

Reported by:
Brian Merrill
Reported on: 2006-11-01
Last modified on: 2011-09-13


Olivier Fourdan
CC List:
1 user



xfwm4-jdk6-test.jar (14.42 KB, application/x-jar)
2006-11-01 01:38 CET , Brian Merrill
no flags
Disable raising of client on WM_TRANSIENT_FOR property change (1.22 KB, patch)
2006-11-01 11:02 CET , Olivier Fourdan
no flags

Additional information