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

XAWT: Multiple problems setting WM_NORMAL_HINTS

    Details

    • Subcomponent:
    • CPU:
      generic
    • OS:
      generic

      Description

      Code responsible for setting WM_NORMAL_HINTS property has multiple problems and should be refactored.

      1. maximizedBounds is lost after toggling resizable state on several window managers

      ---Test1.java---
      import java.awt.*;
      import java.awt.event.*;

      public class Test1 {

          public static void main(String[] args) {
              final Frame f = new Frame("test frame");
              final Button b1 = new Button("Press me");
              f.add(b1);
              b1.addActionListener(new ActionListener() {
                      public void actionPerformed(ActionEvent e) {
                          f.setResizable(!f.isResizable());
                      }
                  });
              f.setMaximizedBounds(new Rectangle(0, 0, 400, 400));
              f.setBounds(100, 100, 200, 200);
              f.setVisible(true);
          }
              
      };
      ---Test1.java---
      1. Compile and run Test1.java
      2. Verify that frame is resizable and it's being maximixed to Dimensions (400, 400)
      3. Click 'Press me' button and verify that frame is not resizable
      4. Click 'Press me' button once again, frame becomes resizable
      5. If frame is maximizable to the whole screen, the bug is reproduced

      This bug is reproducible always with JDK6 b95 on Gnome & KDE, other builds & WMs were not tested.

      2. Non-resizable state is lost when setting maximized bounds on Gnome

      ---Test2.java---
      import java.awt.*;
      import java.awt.event.*;

      public class Test2 {

          public static void main(String[] args) {
              final Frame f = new Frame("test frame");
              final Button b1 = new Button("Press me");
              f.add(b1);
              b1.addActionListener(new ActionListener() {
                      public void actionPerformed(ActionEvent e) {
                          f.setMaximizedBounds(new Rectangle(0, 0, 400, 400));
                      }
                  });
              f.setBounds(100, 100, 200, 200);
              f.setResizable(false);
              f.setVisible(true);
          }
              
      };
      ---Test2.java---
      1. Compile and run Test2.java
      2. Verify that frame is not resizable
      3. Click 'Press me' button
      4. If frame becomes resizable, the bug is reproduced

      This bug is always reproducible with JDK6 b95 on Gnome, not reproducible on KDE.
      Other builds & WMs were not tested.

      3. There are several other problems in code that should also be fixed:
      - XlibWrapper.XSetMinMaxHints method should be removed, because it is not used for now,
      and its invocation can lead to unpredictable behaviour.
      - Setting correct combination of hints in different situations is not trivial task,
      becuase of complexity of interface and lack of documentation.
      - WM_NORMAL_HINTS property can be modified with severals means (XBaseWindow.setSizeHints,
      XWM.removeSizeHints, etc). This should be refactored into one or several compact and
      easy to use methods.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                vbaranovsunw Vyacheslav Baranov (Inactive)
              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Imported:
                  Indexed: