Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8140525

AwtFrame::WmShowWindow() may steal focus

    Details

    • Subcomponent:
    • Resolved In Build:
      b150
    • CPU:
      x86
    • OS:
      windows_8

      Backports

        Description

        FULL PRODUCT VERSION :
        java version "1.8.0_60"
        Java(TM) SE Runtime Environment (build 1.8.0_60-b27)
        Java HotSpot(TM) 64-Bit Server VM (build 25.60-b23, mixed mode)

        ADDITIONAL OS VERSION INFORMATION :
        Windows 8.1

        A DESCRIPTION OF THE PROBLEM :
        In AwtFrame::WmShowWindow(), as the fix for 6492970, a window is set foreground under some circumstances, including show==true and another process's window is being foreground at the moment. However, it's possible that an AWT frame received WM_SHOWWINDOW with show==true when the frame was already showing on screen. In this case the frame is set foreground and this unexpectedly steals focus from another app's window.

        For instance, with is reproducible with Dragon NaturallySpeaking application, when the latter shows Dictation Box (a dialog with a text field to receive text recognized from speech, or simply typed). When the Dictation Box dialog is activated (either way), the AWT (or Swing) frame receives WM_SHOWWINDOW (I don't clearly understand why), nevertheless it's already showing. The frame then steals focus preventing the Dictation Box to receive any input.

        I suppose the visibility of the frame should be taken into account. When the frame is visible it is not expected to become foreground on receiving WM_SHOWWINDOW.

        STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
        Install Dragon NaturallySpeaking (well, theoretically). Run any AWT/Swing application with a text field (e.g. SwingSet2). Activate the Dragon. Focus the AWT/Swing text field. Start dictating or simply, from the Dragon Bar, open Tools -> Dictation Box. A dialog will appear atop of the AWT/Swing frame. Try to do anything with it. It's irresponsible due to inability to get focus (additionally it blocks mouse events, but this is an expected behavior of it).

        EXPECTED VERSUS ACTUAL BEHAVIOR :
        EXPECTED -
        Everything you speak (or type) should go into Dictation Box. Then you're able to transfer the text to the AWT/Swing frame.
        ACTUAL -
        DictationBox is irresponsible due to inability to get focus. Additionally it blocks mouse events, but this is an expected behavior of it, yet it can't be closed.

        REPRODUCIBILITY :
        This bug can be reproduced always.

        CUSTOMER SUBMITTED WORKAROUND :
        It hardly ever can be worked around.

          Attachments

            Issue Links

              Activity

                People

                • Assignee:
                  ant Anton Tarasov
                  Reporter:
                  webbuggrp Webbug Group
                • Votes:
                  0 Vote for this issue
                  Watchers:
                  6 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved: