mirror of
https://github.com/xiaoyifang/goldendict-ng.git
synced 2024-11-27 19:24:08 +00:00
Mac-specific: Fix for retina display
This commit is contained in:
parent
9cf51acc89
commit
62d380a1d9
|
@ -15,6 +15,9 @@ public:
|
||||||
* Adds fullscreen button to window for Lion.
|
* Adds fullscreen button to window for Lion.
|
||||||
*/
|
*/
|
||||||
static void addFullscreen(MainWindow *window);
|
static void addFullscreen(MainWindow *window);
|
||||||
|
|
||||||
|
//Check for retina display
|
||||||
|
static bool isRetinaDisplay();
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // LIONSUPPORT_H
|
#endif // LIONSUPPORT_H
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
#include <AppKit/NSWindow.h>
|
#include <AppKit/NSWindow.h>
|
||||||
|
#include <AppKit/NSScreen.h>
|
||||||
#include "lionsupport.h"
|
#include "lionsupport.h"
|
||||||
|
|
||||||
bool LionSupport::isLion()
|
bool LionSupport::isLion()
|
||||||
|
@ -21,3 +22,13 @@ void LionSupport::addFullscreen(MainWindow *window)
|
||||||
#warning No fullscreen support will be included in this build
|
#warning No fullscreen support will be included in this build
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool LionSupport::isRetinaDisplay()
|
||||||
|
{
|
||||||
|
#if defined(MAC_OS_X_VERSION_10_7) && MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_7
|
||||||
|
return( [ [ NSScreen mainScreen ] respondsToSelector:@selector( backingScaleFactor ) ]
|
||||||
|
&& [ [ NSScreen mainScreen ] backingScaleFactor ] > 1.5 );
|
||||||
|
#else
|
||||||
|
return false;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
11
main.cc
11
main.cc
|
@ -33,6 +33,10 @@
|
||||||
|
|
||||||
#include "gddebug.hh"
|
#include "gddebug.hh"
|
||||||
|
|
||||||
|
#ifdef Q_OS_MAC
|
||||||
|
#include "lionsupport.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
void gdMessageHandler( QtMsgType type, const char *msg )
|
void gdMessageHandler( QtMsgType type, const char *msg )
|
||||||
{
|
{
|
||||||
QString message = QString::fromUtf8( msg );
|
QString message = QString::fromUtf8( msg );
|
||||||
|
@ -83,7 +87,12 @@ int main( int argc, char ** argv )
|
||||||
{
|
{
|
||||||
#ifdef Q_OS_MAC
|
#ifdef Q_OS_MAC
|
||||||
setenv("LANG", "en_US.UTF-8", 1);
|
setenv("LANG", "en_US.UTF-8", 1);
|
||||||
setenv("QT_GRAPHICSSYSTEM", "raster", 1);
|
|
||||||
|
// Check for retina display
|
||||||
|
if( LionSupport::isRetinaDisplay() )
|
||||||
|
QApplication::setGraphicsSystem( "native" );
|
||||||
|
else
|
||||||
|
QApplication::setGraphicsSystem( "raster" );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// The following clause fixes a race in the MinGW runtime where throwing
|
// The following clause fixes a race in the MinGW runtime where throwing
|
||||||
|
|
Loading…
Reference in a new issue