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

Focus is not regained sometimes when alt-tabbing between applications

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P4 P4
    • 1.4.1
    • 1.4.0
    • client-libs
    • None
    • hopper
    • sparc
    • solaris_7
    • Verified

      This is an offshoot of bugid 4503980. This description is taken from the
      Evaluation of that bug.

      Use the Split-Pane demo in Swingset2. I assume this is all in
      point-to-focus mode.

      1. Click in one of the textfields in the demo.
      2. Click on an external window (another app) to change focus.
      3. Alt-tab to give focus back to the Swingset

      The textfield will not have focus.
      However, you can give focus to the textfield by clicking in it.


      Below is the evaluation for Merlin by ###@###.###, tested with Merlin b78

      In native code we listen only for one kind of Focus event - one with mode == NotifyNormal. When one uses special key sequences handled by WM which make windows focused/unfocused WM sends different kinds of Focus events (for example on my IceWM I receive FocusOut NotifyGrab, then NotifyWhileGrabbed when I switch out of application, then FocusIn NotifyWhileGrabbed, NotifyUngrab when I switch back). We skip all this events in awt_MToolit.c:processOneEvent.

      If you have Java windows focused and click with mouse to another window on desktop then Java receives FocusOut NotifyNormal which we process and CLEAR focus. Therefor when you switch back using key sequence, and we doestn't receive any Focus events we listen to, we doesn't restore focus and frame looks active and not having focus. To restore focus you can just click on the component you want to make it focused.

      Workaround: ###@###.###
      Don't mix mouse and keyboard application switch, if you switched out of Java by mouse return back also by mouse. If you switched out of Java by keyboard, you can switch back either by keyboard or mouse.

            dmikhalksunw Denis Mikhalkin (Inactive)
            ehawkessunw Eric Hawkes (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: