JDK-6507476 : XEmbeddedFrame gets focused when a modal dialog is shown
  • Type: Bug
  • Component: client-libs
  • Sub-Component: java.awt
  • Affected Version: 6
  • Priority: P2
  • Status: Closed
  • Resolution: Fixed
  • OS: linux
  • CPU: generic
  • Submitted: 2006-12-22
  • Updated: 2011-03-07
  • Resolved: 2011-03-07
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 6 JDK 7
6u2Fixed 7 b09Fixed
Description
Tonga test AWT_SWT/Automated//Modality fails with two error messages:

FAILURE: SWT button got selected inspite of modal dialog
FAILURE: AWT button gained focus inspite of modal dialog

The first is the common problem: there is no API for AWT embedded frame to notify its embedding container (SWT shell) that some modal dialog is shown. Thus, when user clicks on the SWT button, SWT shell successfully activated.

However, the second failure is related to AWT. AWT components shouldn't get focus when their top-level window (even if this window is embedded frame) is blocked by modal dialog.

Comments
EVALUATION When SWT shell is activated, it sends us the client message XEMBED_WINDOW_ACTIVATE. Then, when AWT button is clicked with the mouse, embedded frame sends XEMBED_REQUEST_FOCUS client message to the SWT shell and receives a reply as XEMBED_FOCUS_IN. However, if the embedded frame is blocked (or is unfocusable because of some another reason), it shouldn't request focus from embedder. Also, I haven't found any place in XEmbed specification that states that XEMBED_FOCUS_IN is only sent in reply to XEMBED_REQUEST_FOCUS. So we should not only prevent our embedded frames from requesting focus, but also filter all XEMBED_FOCUS_IN messages when the frame is unfocusable.
22-12-2006