From 316fbbe7434cd5fcabf09b45481f5ccdafaacec9 Mon Sep 17 00:00:00 2001 From: Guldoman Date: Sat, 30 Sep 2023 16:48:38 +0200 Subject: [PATCH] Remove DPI detection for default `SCALE` This often leads to `SCALE` values that are way off, and makes Lite XL unusable, so we now just default it to 1. --- data/core/start.lua | 2 +- src/main.c | 13 ------------- 2 files changed, 1 insertion(+), 14 deletions(-) diff --git a/data/core/start.lua b/data/core/start.lua index a0edbe54..040f109d 100644 --- a/data/core/start.lua +++ b/data/core/start.lua @@ -2,7 +2,7 @@ VERSION = "@PROJECT_VERSION@" MOD_VERSION = "3" -SCALE = tonumber(os.getenv("LITE_SCALE") or os.getenv("GDK_SCALE") or os.getenv("QT_SCALE_FACTOR")) or SCALE +SCALE = tonumber(os.getenv("LITE_SCALE") or os.getenv("GDK_SCALE") or os.getenv("QT_SCALE_FACTOR")) or 1 PATHSEP = package.config:sub(1, 1) EXEDIR = EXEFILE:match("^(.+)[/\\][^/\\]+$") diff --git a/src/main.c b/src/main.c index 468fb568..dca3cbd1 100644 --- a/src/main.c +++ b/src/main.c @@ -20,16 +20,6 @@ static SDL_Window *window; -static double get_scale(void) { -#ifndef __APPLE__ - float dpi; - if (SDL_GetDisplayDPI(0, NULL, &dpi, NULL) == 0) - return dpi / 96.0; -#endif - return 1.0; -} - - static void get_exe_filename(char *buf, int sz) { #if _WIN32 int len; @@ -203,9 +193,6 @@ init_lua: lua_pushstring(L, LITE_ARCH_TUPLE); lua_setglobal(L, "ARCH"); - lua_pushnumber(L, get_scale()); - lua_setglobal(L, "SCALE"); - char exename[2048]; get_exe_filename(exename, sizeof(exename)); if (*exename) {