Skip to content

Ghidra is a software reverse engineering (SRE) framework

GP-6975 - Added a window minimum size to prevent losing really small windows

dragonmacherbbfd8d93f88a
diff --git a/Ghidra/Framework/Docking/src/main/java/docking/DockingDialog.java b/Ghidra/Framework/Docking/src/main/java/docking/DockingDialog.java
index c503320bc1..6974381763 100644
--- a/Ghidra/Framework/Docking/src/main/java/docking/DockingDialog.java
+++ b/Ghidra/Framework/Docking/src/main/java/docking/DockingDialog.java
@@ -35,8 +35,12 @@ import help.HelpDescriptor;
// activated and is scheduled to get focus at a later time. This variable is static so that only
// one component at a time is ever scheduled to request focus. This prevents a possible bug where
// two or more dialogs rapidly and continuously swap activation back and forth.
-
public class DockingDialog extends JDialog implements HelpDescriptor {
+
+ // fairly arbitrary values
+ private static final int MIN_WIDTH = 100;
+ private static final int MIN_HEIGHT = 100;
+
private static Component focusComponent; // allow only one scheduled focus component. See above.
private static Map<String, BoundsInfo> dialogBoundsMap =
@@ -129,6 +133,9 @@ public class DockingDialog extends JDialog implements HelpDescriptor {
private void initializeLocationAndSize(Component centeredOnComponent) {
+ // Set a minimum size to prevent losing windows made too small under error conditions
+ setMinimumSize(new Dimension(MIN_WIDTH, MIN_HEIGHT));
+
String key = getKey();
BoundsInfo boundsInfo = dialogBoundsMap.get(key);
Rectangle lastBounds = boundsInfo.getEndBounds();
diff --git a/Ghidra/Framework/Docking/src/main/java/docking/DockingFrame.java b/Ghidra/Framework/Docking/src/main/java/docking/DockingFrame.java
index 5370f9431c..f7f6c11137 100644
--- a/Ghidra/Framework/Docking/src/main/java/docking/DockingFrame.java
+++ b/Ghidra/Framework/Docking/src/main/java/docking/DockingFrame.java
@@ -4,9 +4,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -15,6 +15,8 @@
*/
package docking;
+import java.awt.Dimension;
+
import javax.swing.JFrame;
import ghidra.util.bean.GGlassPane;
@@ -24,6 +26,10 @@ import ghidra.util.bean.GGlassPane;
*/
public class DockingFrame extends JFrame {
+ // fairly arbitrary values
+ private static final int MIN_WIDTH = 200;
+ private static final int MIN_HEIGHT = 200;
+
private boolean isTransient;
public DockingFrame(String name) {
@@ -32,17 +38,20 @@ public class DockingFrame extends JFrame {
GGlassPane ghidraGlassPane = new GGlassPane();
setGlassPane(ghidraGlassPane);
ghidraGlassPane.setVisible(true);
+
+ // Set a minimum size to prevent losing windows made too small under error conditions
+ setMinimumSize(new Dimension(MIN_WIDTH, MIN_HEIGHT));
}
/**
- * Marks this frame as transient. A transient frame is one that is show temporarily.
+ * Marks this frame as transient. A transient frame is one that is shown temporarily.
*/
public void setTransient() {
this.isTransient = true;
}
/**
- * REturns whether this frame is transient. A transient frame is one that is show temporarily.
+ * Returns whether this frame is transient. A transient frame is one that is shown temporarily.
* @return true if transient
*/
public boolean isTransient() {