Skip to content

Ghidra is a software reverse engineering (SRE) framework

GP-2840 - Updated the tool windows to remember when they are fully maximized

dragonmacher252d4598f206
diff --git a/Ghidra/Framework/Docking/src/main/java/docking/RootNode.java b/Ghidra/Framework/Docking/src/main/java/docking/RootNode.java
index 422894f3e0..3c8c2ae52c 100644
--- a/Ghidra/Framework/Docking/src/main/java/docking/RootNode.java
+++ b/Ghidra/Framework/Docking/src/main/java/docking/RootNode.java
@@ -55,6 +55,8 @@ class RootNode extends WindowNode {
*
* @param mgr the DockingWindowsManager
* @param toolName the name of the tool to be displayed in all the top-level windows.
+ * @param images the frame icons
+ * @param isModal true if modal
* @param factory a factory for creating drop targets for this nodes windows; may be null
*/
RootNode(DockingWindowManager mgr, String toolName, List<Image> images, boolean isModal,
@@ -198,7 +200,10 @@ class RootNode extends WindowNode {
void setVisible(boolean state) {
Window mainWindow = getMainWindow();
mainWindow.setVisible(state);
- WindowUtilities.ensureOnScreen(mainWindow);
+
+ if (state) {
+ WindowUtilities.ensureOnScreen(mainWindow);
+ }
Iterator<DetachedWindowNode> it = detachedWindows.iterator();
while (it.hasNext()) {
@@ -232,11 +237,6 @@ class RootNode extends WindowNode {
notifyWindowAdded(windowNode);
}
- /**
- * Adds the component to the main window.
- *
- * @param info the component to be added.
- */
void add(ComponentPlaceholder info, WindowPosition initialPosition) {
if (initialPosition == WindowPosition.WINDOW) {
add(info);
@@ -373,9 +373,6 @@ class RootNode extends WindowNode {
node.parent = null;
}
- /**
- * Returns the main frame of the tool.
- */
public JFrame getFrame() {
return windowWrapper.getParentFrame();
}
@@ -398,10 +395,7 @@ class RootNode extends WindowNode {
return toolName;
}
- /**
- * Returns list of detached windows (WindowNode objects).
- */
- public List<DetachedWindowNode> getDetachedWindows() {
+ List<DetachedWindowNode> getDetachedWindows() {
return detachedWindows;
}
@@ -475,10 +469,12 @@ class RootNode extends WindowNode {
int y = Integer.parseInt(rootNodeElement.getAttributeValue("Y_POS"));
int width = Integer.parseInt(rootNodeElement.getAttributeValue("WIDTH"));
int height = Integer.parseInt(rootNodeElement.getAttributeValue("HEIGHT"));
+ int extendedState = Integer.parseInt(rootNodeElement.getAttributeValue("EX_STATE"));
JFrame frame = windowWrapper.getParentFrame();
Rectangle bounds = new Rectangle(x, y, width, height);
WindowUtilities.ensureOnScreen(frame, bounds);
frame.setBounds(bounds);
+ frame.setExtendedState(extendedState);
List<ComponentPlaceholder> restoredPlaceholders = new ArrayList<>();
Iterator<?> elementIterator = rootNodeElement.getChildren().iterator();
diff --git a/Ghidra/Framework/Generic/src/main/java/generic/util/WindowUtilities.java b/Ghidra/Framework/Generic/src/main/java/generic/util/WindowUtilities.java
index cf32fb7f16..254acf791f 100644
--- a/Ghidra/Framework/Generic/src/main/java/generic/util/WindowUtilities.java
+++ b/Ghidra/Framework/Generic/src/main/java/generic/util/WindowUtilities.java
@@ -23,7 +23,7 @@ import java.util.Objects;
import javax.swing.SwingUtilities;
-import ghidra.util.SystemUtilities;
+import ghidra.util.Swing;
/**
* A collection of window related utility methods
@@ -455,7 +455,7 @@ public class WindowUtilities {
// WindowListener.windowActivated() callback. During this callback, it is possible that
// the focus owner is not correct, as it will be changed to the window under activation.
// If we invoke later, the the call will happen when focus has been transitioned.
- SystemUtilities.runSwingLater(() -> doBringModalestDialogToFront(activeWindow));
+ Swing.runLater(() -> doBringModalestDialogToFront(activeWindow));
}
private static void doBringModalestDialogToFront(Window activeWindow) {
@@ -464,7 +464,7 @@ public class WindowUtilities {
return;
}
- SystemUtilities.runSwingLater(() -> modalestDialog.toFront());
+ Swing.runLater(modalestDialog::toFront);
}
/** Class that knows the screen bounds, insets and bounds without the insets */
@@ -483,14 +483,6 @@ public class WindowUtilities {
this.usableBounds = new Rectangle(x, y, width, height);
}
- /**
- * Gets the full size of this bounds object, including the insets
- * @return the full size of this bounds object, including the insets
- */
- Rectangle getFullBounds() {
- return fullBounds;
- }
-
/**
* Returns the size not including the insets
* @return the size not including the insets