8223271: SplashScreen is still shown if defaulting to headless on MacOS

Reviewed-by: bpb, serb, kcr
This commit is contained in:
Phil Race 2019-05-30 11:52:23 -07:00
parent 10cac15976
commit 312d66471a
9 changed files with 52 additions and 17 deletions

View file

@ -1169,13 +1169,13 @@ SelectVersion(int argc, char **argv, char **main_class)
* Passing on splash screen info in environment variables
*/
if (splash_file_name && !headlessflag) {
char* splash_file_entry = JLI_MemAlloc(JLI_StrLen(SPLASH_FILE_ENV_ENTRY "=")+JLI_StrLen(splash_file_name)+1);
splash_file_entry = JLI_MemAlloc(JLI_StrLen(SPLASH_FILE_ENV_ENTRY "=")+JLI_StrLen(splash_file_name)+1);
JLI_StrCpy(splash_file_entry, SPLASH_FILE_ENV_ENTRY "=");
JLI_StrCat(splash_file_entry, splash_file_name);
putenv(splash_file_entry);
}
if (splash_jar_name && !headlessflag) {
char* splash_jar_entry = JLI_MemAlloc(JLI_StrLen(SPLASH_JAR_ENV_ENTRY "=")+JLI_StrLen(splash_jar_name)+1);
splash_jar_entry = JLI_MemAlloc(JLI_StrLen(SPLASH_JAR_ENV_ENTRY "=")+JLI_StrLen(splash_jar_name)+1);
JLI_StrCpy(splash_jar_entry, SPLASH_JAR_ENV_ENTRY "=");
JLI_StrCat(splash_jar_entry, splash_jar_name);
putenv(splash_jar_entry);
@ -2241,6 +2241,11 @@ ShowSplashScreen()
if (file_name == NULL){
return;
}
if (!DoSplashInit()) {
goto exit;
}
maxScaledImgNameLength = DoSplashGetScaledImgNameMaxPstfixLen(file_name);
scaled_splash_name = JLI_MemAlloc(
@ -2261,13 +2266,13 @@ ShowSplashScreen()
jar_name, file_name, &data_size);
}
if (image_data) {
DoSplashInit();
DoSplashSetScaleFactor(scale_factor);
DoSplashLoadMemory(image_data, data_size);
JLI_MemFree(image_data);
} else {
DoSplashClose();
}
} else {
DoSplashInit();
if (isImageScaled) {
DoSplashSetScaleFactor(scale_factor);
DoSplashLoadFile(scaled_splash_name);
@ -2279,6 +2284,7 @@ ShowSplashScreen()
DoSplashSetFileJarName(file_name, jar_name);
exit:
/*
* Done with all command line processing and potential re-execs so
* clean up the environment.

View file

@ -26,7 +26,7 @@
int DoSplashLoadMemory(void* pdata, int size); /* requires preloading the file */
int DoSplashLoadFile(const char* filename);
void DoSplashInit(void);
int DoSplashInit(void);
void DoSplashClose(void);
void DoSplashSetFileJarName(const char* fileName, const char* jarName);
void DoSplashSetScaleFactor(float scaleFactor);

View file

@ -33,7 +33,7 @@ extern void* SplashProcAddress(const char* name); /* in java_md.c */
*/
typedef int (*SplashLoadMemory_t)(void* pdata, int size);
typedef int (*SplashLoadFile_t)(const char* filename);
typedef void (*SplashInit_t)(void);
typedef int (*SplashInit_t)(void);
typedef void (*SplashClose_t)(void);
typedef void (*SplashSetFileJarName_t)(const char* fileName,
const char* jarName);
@ -71,8 +71,8 @@ int DoSplashLoadFile(const char* filename) {
INVOKE(SplashLoadFile, 0)(filename);
}
void DoSplashInit(void) {
INVOKEV(SplashInit)();
int DoSplashInit(void) {
INVOKE(SplashInit, 0)();
}
void DoSplashClose(void) {