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) {
|
||||
showUserAgreement();
|
||||
SplashScreen.showSplashScreen();
|
||||
SplashScreen.showLater();
|
||||
this.monitor = new StatusReportingTaskMonitor();
|
||||
}
|
||||
|
||||
|
|
|
@ -320,10 +320,8 @@ public class DockingDialog extends JDialog implements HelpDescriptor {
|
|||
return;
|
||||
}
|
||||
|
||||
Rectangle r = getBounds();
|
||||
Point p = WindowUtilities.centerOnComponent(c, this);
|
||||
r.setLocation(p);
|
||||
setBounds(r);
|
||||
setLocation(p);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -53,7 +53,7 @@ public class DockingApplicationConfiguration extends ApplicationConfiguration {
|
|||
LookAndFeelUtils.performPlatformSpecificFixups();
|
||||
|
||||
if (showSplashScreen) {
|
||||
SplashScreen.showSplashScreen();
|
||||
SplashScreen.showLater();
|
||||
}
|
||||
|
||||
ApplicationKeyManagerFactory
|
||||
|
|
|
@ -32,6 +32,7 @@ import generic.theme.Gui;
|
|||
import generic.util.WindowUtilities;
|
||||
import ghidra.framework.Application;
|
||||
import ghidra.util.Msg;
|
||||
import ghidra.util.Swing;
|
||||
import utility.application.ApplicationLayout;
|
||||
|
||||
/**
|
||||
|
@ -42,7 +43,6 @@ import utility.application.ApplicationLayout;
|
|||
public class SplashScreen extends JWindow {
|
||||
|
||||
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";
|
||||
|
||||
|
@ -52,15 +52,42 @@ public class SplashScreen extends JWindow {
|
|||
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
|
||||
*/
|
||||
public static SplashScreen showSplashScreen() {
|
||||
public static SplashScreen showNow() {
|
||||
return Swing.runNow(() -> {
|
||||
if (splashWindow != null) {
|
||||
return splashWindow; // already showing
|
||||
}
|
||||
|
||||
final JFrame parentFrame = getParentFrame();
|
||||
JFrame parentFrame = getParentFrame();
|
||||
splashWindow = new SplashScreen(parentFrame);
|
||||
|
||||
initializeSplashWindowAndParent(parentFrame);
|
||||
|
@ -73,13 +100,13 @@ public class SplashScreen extends JWindow {
|
|||
// this call is needed for the splash screen to initially paint correctly on the Mac
|
||||
splashWindow.repaint();
|
||||
return splashWindow;
|
||||
});
|
||||
}
|
||||
|
||||
private static void initializeSplashWindowAndParent(final JFrame parentFrame) {
|
||||
|
||||
Dimension wd = splashWindow.getPreferredSize();
|
||||
Point point = WindowUtilities.centerOnScreen(wd);
|
||||
|
||||
splashWindow.setLocation(point);
|
||||
|
||||
// move us when the parent frame moves
|
||||
|
@ -288,7 +315,7 @@ public class SplashScreen extends JWindow {
|
|||
}
|
||||
|
||||
private static void updateStatus(String status) {
|
||||
statusLabel.setText(status);
|
||||
Swing.runIfSwingOrRunLater(() -> statusLabel.setText(status));
|
||||
}
|
||||
|
||||
private JPanel createMainPanel() {
|
||||
|
@ -330,7 +357,7 @@ public class SplashScreen extends JWindow {
|
|||
|
||||
config.setShowSplashScreen(false);
|
||||
Application.initializeApplication(layout, config);
|
||||
showSplashScreen();
|
||||
showLater();
|
||||
|
||||
// tests that modal dialogs popup on top of the splash screen
|
||||
// new Thread( new Runnable() {
|
||||
|
|
|
@ -159,7 +159,7 @@ public class SplashScreenTest extends AbstractDockingTest {
|
|||
private void showSplashScreen(final boolean makeVisible) {
|
||||
|
||||
if (makeVisible) {
|
||||
SplashScreen splash = runSwing(() -> SplashScreen.showSplashScreen());
|
||||
SplashScreen splash = SplashScreen.showNow();
|
||||
assertNotNull("Failed showing splash screen", splash);
|
||||
waitForSwing();
|
||||
return;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue