mirror of
https://github.com/WerWolv/ImHex.git
synced 2026-02-09 13:58:44 -06:00
fix: Building on macOS
This commit is contained in:
@@ -2,9 +2,12 @@
|
||||
|
||||
#if defined(OS_MACOS)
|
||||
|
||||
#include <string>
|
||||
extern "C" {
|
||||
|
||||
extern "C" void openWebpageMacos(const char *url);
|
||||
extern "C" bool isMacosSystemDarkModeEnabled();
|
||||
void openWebpageMacos(const char *url);
|
||||
bool isMacosSystemDarkModeEnabled();
|
||||
float getBackingScaleFactorMacos();
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -4,6 +4,7 @@
|
||||
#include <ApplicationServices/ApplicationServices.h>
|
||||
#include <Foundation/NSUserDefaults.h>
|
||||
#include <Foundation/Foundation.h>
|
||||
#include <AppKit/NSScreen.h>
|
||||
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
@@ -25,4 +26,8 @@
|
||||
}
|
||||
}
|
||||
|
||||
float getBackingScaleFactorMacos(void) {
|
||||
return [[NSScreen mainScreen] backingScaleFactor];
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -22,10 +22,6 @@
|
||||
#include <future>
|
||||
#include <numeric>
|
||||
|
||||
#if defined (OS_MACOS)
|
||||
#include <AppKit/NSScreen.h>
|
||||
#endif
|
||||
|
||||
using namespace std::literals::chrono_literals;
|
||||
|
||||
namespace hex::init {
|
||||
@@ -209,7 +205,7 @@ namespace hex::init {
|
||||
meanScale = 1.0F;
|
||||
|
||||
#if defined(OS_MACOS)
|
||||
meanScale /= NSScreen.mainScreen.backingScaleFactor;
|
||||
meanScale /= getBackingScaleFactorMacos();
|
||||
#endif
|
||||
|
||||
ImHexApi::System::impl::setGlobalScale(meanScale);
|
||||
|
||||
Reference in New Issue
Block a user