mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2025-10-06 03:50:02 +02:00
Merge remote-tracking branch 'origin/GP-1-dragonmacher-window-squash-fix'
This commit is contained in:
commit
481dc9adb1
5 changed files with 49 additions and 24 deletions
|
@ -49,7 +49,7 @@ public class GhidraApplicationConfiguration extends HeadlessGhidraApplicationCon
|
||||||
|
|
||||||
if (showSplashScreen) {
|
if (showSplashScreen) {
|
||||||
showUserAgreement();
|
showUserAgreement();
|
||||||
SplashScreen.showSplashScreen();
|
SplashScreen.showLater();
|
||||||
this.monitor = new StatusReportingTaskMonitor();
|
this.monitor = new StatusReportingTaskMonitor();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -320,10 +320,8 @@ public class DockingDialog extends JDialog implements HelpDescriptor {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Rectangle r = getBounds();
|
|
||||||
Point p = WindowUtilities.centerOnComponent(c, this);
|
Point p = WindowUtilities.centerOnComponent(c, this);
|
||||||
r.setLocation(p);
|
setLocation(p);
|
||||||
setBounds(r);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -53,7 +53,7 @@ public class DockingApplicationConfiguration extends ApplicationConfiguration {
|
||||||
LookAndFeelUtils.performPlatformSpecificFixups();
|
LookAndFeelUtils.performPlatformSpecificFixups();
|
||||||
|
|
||||||
if (showSplashScreen) {
|
if (showSplashScreen) {
|
||||||
SplashScreen.showSplashScreen();
|
SplashScreen.showLater();
|
||||||
}
|
}
|
||||||
|
|
||||||
ApplicationKeyManagerFactory
|
ApplicationKeyManagerFactory
|
||||||
|
|
|
@ -32,6 +32,7 @@ import generic.theme.Gui;
|
||||||
import generic.util.WindowUtilities;
|
import generic.util.WindowUtilities;
|
||||||
import ghidra.framework.Application;
|
import ghidra.framework.Application;
|
||||||
import ghidra.util.Msg;
|
import ghidra.util.Msg;
|
||||||
|
import ghidra.util.Swing;
|
||||||
import utility.application.ApplicationLayout;
|
import utility.application.ApplicationLayout;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -42,7 +43,6 @@ import utility.application.ApplicationLayout;
|
||||||
public class SplashScreen extends JWindow {
|
public class SplashScreen extends JWindow {
|
||||||
|
|
||||||
private static final Color BG_COLOR = new GColor("color.bg.splashscreen");
|
private static final Color BG_COLOR = new GColor("color.bg.splashscreen");
|
||||||
private static final Color FG_COLOR = new GColor("color.fg.splashscreen");
|
|
||||||
|
|
||||||
private static final String FONT_ID = "font.splash.status";
|
private static final String FONT_ID = "font.splash.status";
|
||||||
|
|
||||||
|
@ -52,34 +52,61 @@ public class SplashScreen extends JWindow {
|
||||||
private static Timer hideSplashWindowTimer;
|
private static Timer hideSplashWindowTimer;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Show the splash screen; displayed only when Ghidra is first coming up
|
* Show the splash screen on the Swing thread later.
|
||||||
|
*/
|
||||||
|
public static void showLater() {
|
||||||
|
|
||||||
|
Swing.runIfSwingOrRunLater(() -> {
|
||||||
|
|
||||||
|
if (splashWindow != null) {
|
||||||
|
return; // already showing
|
||||||
|
}
|
||||||
|
|
||||||
|
JFrame parentFrame = getParentFrame();
|
||||||
|
splashWindow = new SplashScreen(parentFrame);
|
||||||
|
|
||||||
|
initializeSplashWindowAndParent(parentFrame);
|
||||||
|
|
||||||
|
createSplashScreenCloseListeners(parentFrame);
|
||||||
|
|
||||||
|
parentFrame.setVisible(true);
|
||||||
|
splashWindow.setVisible(true);
|
||||||
|
|
||||||
|
// this call is needed for the splash screen to initially paint correctly on the Mac
|
||||||
|
splashWindow.repaint();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Show the splash screen on the Swing thread now. This will block.
|
||||||
* @return the new splash screen
|
* @return the new splash screen
|
||||||
*/
|
*/
|
||||||
public static SplashScreen showSplashScreen() {
|
public static SplashScreen showNow() {
|
||||||
if (splashWindow != null) {
|
return Swing.runNow(() -> {
|
||||||
return splashWindow; // already showing
|
if (splashWindow != null) {
|
||||||
}
|
return splashWindow; // already showing
|
||||||
|
}
|
||||||
|
|
||||||
final JFrame parentFrame = getParentFrame();
|
JFrame parentFrame = getParentFrame();
|
||||||
splashWindow = new SplashScreen(parentFrame);
|
splashWindow = new SplashScreen(parentFrame);
|
||||||
|
|
||||||
initializeSplashWindowAndParent(parentFrame);
|
initializeSplashWindowAndParent(parentFrame);
|
||||||
|
|
||||||
createSplashScreenCloseListeners(parentFrame);
|
createSplashScreenCloseListeners(parentFrame);
|
||||||
|
|
||||||
parentFrame.setVisible(true);
|
parentFrame.setVisible(true);
|
||||||
splashWindow.setVisible(true);
|
splashWindow.setVisible(true);
|
||||||
|
|
||||||
// this call is needed for the splash screen to initially paint correctly on the Mac
|
// this call is needed for the splash screen to initially paint correctly on the Mac
|
||||||
splashWindow.repaint();
|
splashWindow.repaint();
|
||||||
return splashWindow;
|
return splashWindow;
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void initializeSplashWindowAndParent(final JFrame parentFrame) {
|
private static void initializeSplashWindowAndParent(final JFrame parentFrame) {
|
||||||
|
|
||||||
Dimension wd = splashWindow.getPreferredSize();
|
Dimension wd = splashWindow.getPreferredSize();
|
||||||
Point point = WindowUtilities.centerOnScreen(wd);
|
Point point = WindowUtilities.centerOnScreen(wd);
|
||||||
|
|
||||||
splashWindow.setLocation(point);
|
splashWindow.setLocation(point);
|
||||||
|
|
||||||
// move us when the parent frame moves
|
// move us when the parent frame moves
|
||||||
|
@ -288,7 +315,7 @@ public class SplashScreen extends JWindow {
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void updateStatus(String status) {
|
private static void updateStatus(String status) {
|
||||||
statusLabel.setText(status);
|
Swing.runIfSwingOrRunLater(() -> statusLabel.setText(status));
|
||||||
}
|
}
|
||||||
|
|
||||||
private JPanel createMainPanel() {
|
private JPanel createMainPanel() {
|
||||||
|
@ -330,7 +357,7 @@ public class SplashScreen extends JWindow {
|
||||||
|
|
||||||
config.setShowSplashScreen(false);
|
config.setShowSplashScreen(false);
|
||||||
Application.initializeApplication(layout, config);
|
Application.initializeApplication(layout, config);
|
||||||
showSplashScreen();
|
showLater();
|
||||||
|
|
||||||
// tests that modal dialogs popup on top of the splash screen
|
// tests that modal dialogs popup on top of the splash screen
|
||||||
// new Thread( new Runnable() {
|
// new Thread( new Runnable() {
|
||||||
|
|
|
@ -159,7 +159,7 @@ public class SplashScreenTest extends AbstractDockingTest {
|
||||||
private void showSplashScreen(final boolean makeVisible) {
|
private void showSplashScreen(final boolean makeVisible) {
|
||||||
|
|
||||||
if (makeVisible) {
|
if (makeVisible) {
|
||||||
SplashScreen splash = runSwing(() -> SplashScreen.showSplashScreen());
|
SplashScreen splash = SplashScreen.showNow();
|
||||||
assertNotNull("Failed showing splash screen", splash);
|
assertNotNull("Failed showing splash screen", splash);
|
||||||
waitForSwing();
|
waitForSwing();
|
||||||
return;
|
return;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue