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

Frame.setExtendedState(int state) may work incorrect with misleading WM's

XMLWordPrintable

    • 05
    • sparc
    • solaris_2.6
    • Verified

        Name: acR10002 Date: 02/02/2004



        Specification excerpt:
        ======================
        --------- J2SE API spec v.1.5 ---------
        java.awt.Frame:
        ...
        public void setExtendedState(int state)

        Sets the state of this frame. The state is represented as a bitwise mask.
                NORMAL Indicates that no state bits are set.
                ICONIFIED
                MAXIMIZED_HORIZ
                MAXIMIZED_VERT
                MAXIMIZED_BOTH Concatenates MAXIMIZED_HORIZ and MAXIMIZED_VERT.

        Note that if the state is not supported on a given platform, nothing will
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        happen. The application may determine if a specific state is available via
        ^^^^^^
        the java.awt.Toolkit#isFrameStateSupported(int state) method.

        ...
        ---------- end-of-excerpt ---------------

        Problem description
        ===================

        The problem was found during running the JCK interactive test
        api/java/awt/interactive/FrameState/FrameStateTests with metacity WM.
        The metacity WM reports that it can't handle single direction maximization,
        like MAXIMIZED_HORIZ or MAXIMIZED_VERT states. However, if asked to do
        maximization along with a single direction, it does maximization in both
        directions resulting into the MAXIMIZED_BOTH frame.

        Currently, the JDK code doesn't handle such misleading WM behavior,
        just forwarding the setExtendedState() call to the underlying platform
        (in this case - metacity WM). This makes the JDK inconsistent with
        J2SE API spec when run against metacity WM. According to the spec,
        no size change should happen to Frame in case certain state is not
        supported.

        Please find below the excerpt from licensee question:

        >>With the code change, we correctly now identify that we are using the
        >>Metacity wm. The JCK test first questions the window manager to
        >>establish whether it can maximise in the horizontal and vertical
        >>directions. The code now correctly returns false for this as Metacity
        >>cannot do single direction maximisation. However, the JCK test then
        >>attempts to maximise in single directions but expects the result of the
        >>window to remain unchanged. This is because the Metacity says it cannot
        >>do single direction. But, rather than remain unchanged, Metacity will
        >>maximise in both directions if given a single direction maximise
        >>command.

        The JDK code could workaround misleading WM's and just don't forward
        calls to WM in case WM reports it doesn't support a feature.


        ======================================================================

              yan Yuri Nesterenko
              aycsunw Ayc Ayc (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: