<AWT Dev> <Awt Dev> [9] Review Request for 8025815: Child FileDialog of modal dialog does not get focus on Gnome

Semyon Sadetsky semyon.sadetsky at oracle.com
Mon Jul 13 13:59:29 UTC 2015


Hello,

Please review fix for JDK9:

bug: https://bugs.openjdk.java.net/browse/JDK-8025815
wbrev: http://cr.openjdk.java.net/~ssadetsky/8025815/webrev.00/

The root cause is a mixing of GTK and XLib windows. Normally Java uses 
XLib windows and manage focus transitivity on its side. But for the file 
chooser we use a native GTK widget if it is available and this widget is 
crated without parent window because we don't have any other GTK 
windows. This breaks the focus transitivity chain on Java side because 
focus is managed by the WM for GTK dialog. Without parent window the GTK 
file dialog is managed by the WM as a detached standalone window. So 
modality and focus transitivity with Java windows do not work correctly: 
the dialog can be overlapped by other java windows and focus can be 
transferred to them.
The proposed solution obtains XID of the GTK dialog window and pass it 
to the java side to take into account in the focus transitivity chain by 
sending messages to the WM.

Yet another issue I found in the GTK file chooser code is a dispose 
concurrency issue. The GTK dialog widget is being created in a separate 
thread upon the setVisible(true) call but it can be hidden or disposed 
without any synchronization with this thread. It can prevent the VM from 
stopping if the dialog is hidden or disposed right after its creation. 
This also was fixed in the proposed solution.

--Semyon


More information about the awt-dev mailing list