tdf#90794 Fix the Linux HiDPI start screen
Change-Id: I2553cf69d6968865dc6011c73a0d2c0e7519b7a8 Reviewed-on: https://gerrit.libreoffice.org/32018 Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
This commit is contained in:
committed by
Caolán McNamara
parent
8cc747ad51
commit
f424c8f053
@@ -531,6 +531,32 @@ static rtl_String* ustr_to_str( rtl_uString* pStr )
|
|||||||
return pOut;
|
return pOut;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static sal_Bool getScreenSize(int* display_width, int* display_height)
|
||||||
|
{
|
||||||
|
Display* bDisplay = NULL;
|
||||||
|
Screen* bScreen = NULL;
|
||||||
|
|
||||||
|
bDisplay = XOpenDisplay( NULL );
|
||||||
|
if ( !bDisplay )
|
||||||
|
{
|
||||||
|
fprintf( stderr, "Failed to open default display.\n" );
|
||||||
|
return sal_False;
|
||||||
|
}
|
||||||
|
|
||||||
|
bScreen = DefaultScreenOfDisplay( bDisplay );
|
||||||
|
if ( !bScreen )
|
||||||
|
{
|
||||||
|
fprintf( stderr, "Failed to obtain the default screen of given display.\n" );
|
||||||
|
return sal_False;
|
||||||
|
}
|
||||||
|
|
||||||
|
*display_width = bScreen->width;
|
||||||
|
*display_height = bScreen->height;
|
||||||
|
|
||||||
|
XCloseDisplay( bDisplay );
|
||||||
|
return sal_True;
|
||||||
|
}
|
||||||
|
|
||||||
#define IMG_SUFFIX ".png"
|
#define IMG_SUFFIX ".png"
|
||||||
|
|
||||||
static void splash_load_image( struct splash* splash, rtl_uString* pUAppPath )
|
static void splash_load_image( struct splash* splash, rtl_uString* pUAppPath )
|
||||||
@@ -540,7 +566,7 @@ static void splash_load_image( struct splash* splash, rtl_uString* pUAppPath )
|
|||||||
* now the splash screen will have to get along with language-territory. */
|
* now the splash screen will have to get along with language-territory. */
|
||||||
|
|
||||||
char *pBuffer, *pSuffix, *pLocale;
|
char *pBuffer, *pSuffix, *pLocale;
|
||||||
int nLocSize;
|
int nLocSize, display_width, display_height;
|
||||||
rtl_Locale *pLoc = NULL;
|
rtl_Locale *pLoc = NULL;
|
||||||
rtl_String *pLang, *pCountry, *pAppPath;
|
rtl_String *pLang, *pCountry, *pAppPath;
|
||||||
|
|
||||||
@@ -570,9 +596,24 @@ static void splash_load_image( struct splash* splash, rtl_uString* pUAppPath )
|
|||||||
if ( splash_load_bmp( splash, pBuffer ) )
|
if ( splash_load_bmp( splash, pBuffer ) )
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
strcpy (pSuffix, "intro" IMG_SUFFIX);
|
if ( getScreenSize( &display_width, &display_height ) == sal_True )
|
||||||
if ( splash_load_bmp( splash, pBuffer ) )
|
{
|
||||||
goto cleanup;
|
//load high resolution splash image
|
||||||
|
if ( display_width > 1920 && display_height > 1024 ) // suggest better display size limits?
|
||||||
|
{
|
||||||
|
//TODO- change progress bar parameters after getting size of intro-highres.png
|
||||||
|
strcpy (pSuffix, "intro-highres" IMG_SUFFIX);
|
||||||
|
if ( splash_load_bmp( splash, pBuffer ) )
|
||||||
|
goto cleanup;
|
||||||
|
}
|
||||||
|
//load low resolution splash image
|
||||||
|
else
|
||||||
|
{
|
||||||
|
strcpy (pSuffix, "intro" IMG_SUFFIX);
|
||||||
|
if ( splash_load_bmp( splash, pBuffer ) )
|
||||||
|
goto cleanup;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
fprintf (stderr, "Failed to find intro image\n");
|
fprintf (stderr, "Failed to find intro image\n");
|
||||||
|
|
||||||
|
@@ -9,7 +9,6 @@
|
|||||||
#ifndef INCLUDED_DESKTOP_UNX_SOURCE_SPLASHX_H
|
#ifndef INCLUDED_DESKTOP_UNX_SOURCE_SPLASHX_H
|
||||||
#define INCLUDED_DESKTOP_UNX_SOURCE_SPLASHX_H
|
#define INCLUDED_DESKTOP_UNX_SOURCE_SPLASHX_H
|
||||||
|
|
||||||
|
|
||||||
#include <rtl/ustring.h>
|
#include <rtl/ustring.h>
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
Reference in New Issue
Block a user