United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
Bug ID: JDK-6500814 XEmbed focus traversal problems, inside GTK socket
JDK-6500814 : XEmbed focus traversal problems, inside GTK socket

Details
Type:
Bug
Submit Date:
2006-12-05
Status:
Closed
Updated Date:
2011-03-07
Project Name:
JDK
Resolved Date:
2011-03-07
Component:
client-libs
OS:
linux
Sub-Component:
java.awt
CPU:
generic
Priority:
P4
Resolution:
Fixed
Affected Versions:
6
Fixed Versions:

Related Reports
Backport:

Sub Tasks

Description
Run the attached test:

make
./helloworld2 | java JavaClient

The test creates a GTK-based application and then embeds a Java embedded frame into it. However, there are some problems with focus traversal in the test, when you press TAB or Shift+TAB on the GTK buttons and Java components. Behaviour differs for different versions of JDK 6.0:

1. With JDK 6.0b38 focus can be transferred from GTK container to Java eframe and back.
2. With JDK 6.0b51 focus can be transferred from GTK container to Java eframe and then can be traversed inside the Java eframe only. When focus reaches the last component in Java eframe, it then comes to the first Java component.
3. With JDK 6.0b58 and later builds, and with 6.0b01 focus can be transferred from GTK container to Java frame and then stays inside it. When focus reaches the last cojmponent in Java eframe, it stays on it and can only be traversed back with Shift+TAB to the first Java component.

                                    

Comments
EVALUATION

I suspect the problem is just a timings shift between all these JDK versions. The source of the bug is that sometimes our embedded frame doesn't receive XEMBED_EMBEDDED_NOTIFY client message, so XEmbed is not started properly.

After some investigation I have found that this notification is always sent to us by GTK socket, but sometimes it comes too early, before embedded frame X events dispatcher is installed. The fix may be to install it earlier, or create an embedded frame without any parent, install dispatcher and then reparent it into the XEmbed server control.
                                     
2006-12-05
EVALUATION

I have also tried to perform an opposite embedding, when GTK widget is embedded into Java XEmbed server. Here another problem was found with focus: at the moment of embedding Java XEmbedCanvasPeer (XEmbed server) may be the focus owner. If later user clicks with mouse on the GTK component, it sends XEMBED_REQUEST_FOCUS to Java, which is translated into the call to requestFocusInWindow(). Then we wait for the focusGainded event, but it is never sent as XEmbedCanvasPeer is already focused. That's why XEmbed client can't get focus.

To solve this problem I add an additional check when starting XEmbed. If XEmbedCanvasPeer is the focus owner, it sends XEMBED_FOCUS_IN to the client after XEMBED_ACTIVATE_WINDOW.
                                     
2007-01-24



Hardware and Software, Engineered to Work Together