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

[macos] AWT windows have incorrect main/key window behaviors

    XMLWordPrintable

    Details

    • Subcomponent:
    • Resolved In Build:
      b17
    • CPU:
      x86_64
    • OS:
      os_x

      Backports

        Description

        A DESCRIPTION OF THE REQUEST :
        A macOS application can have a main window and a key window. In most cases, the same window is both the main window and the key window. However, in some cases, a document window is the main window while a utility panel operating on the document is the key window. The key window is the focus owner. However, both the main and key windows are considered active, and controls in both are displayed in their active form. The key window has priority over menu items in the screen menu, including menu item shortcuts. However, if the key window does not implement a menu item, then the main window can implement it.

        An example would be TextEdit and NSColorPanel, the native color chooser. When the user opens a color panel on a TextEdit document, the document window remains the main window of the TextEdit application. However, the color panel becomes the key window. By clicking on the title bars, the user can choose which window is the key window. When the color panel is the key window, one of its text fields can be the focus owner, receiving key events. However, menu items and shortcuts not consumed by the text field or the color panel are delivered to TextEdit and implemented by the document window.

        The AWT window code does not support a separation between main and key windows. All AWT windows always become the key window as well as the main window when activated. The issue here is the incorrect behavior of AWT windows when an application with AWT windows also uses an NSColorPanel or other similar non-AWT window.

        Specifically, when a non-AWT window becomes the key window but not the main window, the AWT main window deactivates itself. The incorrect consequences: (1) controls in the AWT main window are rendered in their inactive state, (2) menu items are implemented by the AWT default menu bar, instead of by the AWT main window menu bar, (3) menu shortcuts are not processed.

        I believe these problems are easily fixed by changing a few lines of code.


        JUSTIFICATION :
        The developer of an application running on macOS might prefer to use the native color chooser. If the native color chooser is used, it should perform as it would in a native application.

        EXPECTED VERSUS ACTUAL BEHAVIOR :
        EXPECTED -
        When a native window is the key window and an AWT window is the main window:

        1. The AWT window should display controls in their active form.
        2. Screen menu items should be delivered to the AWT window menu bar.
        3. Screen menu item shortcuts should be delivered to the AWT window.
        ACTUAL -
        1. The AWT window displays controls in their inactive form.
        2. Screen menu items are delivered to the application default menu bar.
        3. Screen menu item shortcuts are not delivered to the Java application.

        ---------- BEGIN SOURCE ----------
        https://we.tl/YOH2sbMvrV

        This link is valid for 7 days.
        ---------- END SOURCE ----------

          Attachments

            Issue Links

              Activity

                People

                Assignee:
                serb Sergey Bylokhov
                Reporter:
                webbuggrp Webbug Group
                Votes:
                0 Vote for this issue
                Watchers:
                4 Start watching this issue

                  Dates

                  Created:
                  Updated:
                  Resolved: