-
Bug
-
Resolution: Unresolved
-
P3
-
7
-
generic
-
generic
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.
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.
- relates to
-
JDK-4325115 Solaris: multiple problems with Frame.setResizable()
- Open
-
JDK-4980119 setting maximized bounds to a frame does not work on Solaris - GNOME
- Open
-
JDK-6234296 Setting maximized bounds and maximizing the frame moves the frame to a diff loc, XToolkit
- Open
-
JDK-6200438 Frame's size must be validated against maximized bounds when resizing, win32
- Closed