|
@@ -32,6 +32,7 @@
|
|
#include <X11/extensions/XInput.h>
|
|
#include <X11/extensions/XInput.h>
|
|
#include <X11/extensions/XInput2.h>
|
|
#include <X11/extensions/XInput2.h>
|
|
#include <X11/extensions/Xfixes.h>
|
|
#include <X11/extensions/Xfixes.h>
|
|
|
|
+#include <X11/extensions/Xrandr.h>
|
|
#include <X11/Xcursor/Xcursor.h>
|
|
#include <X11/Xcursor/Xcursor.h>
|
|
#include <X11/cursorfont.h>
|
|
#include <X11/cursorfont.h>
|
|
#include <GL/glx.h>
|
|
#include <GL/glx.h>
|
|
@@ -605,6 +606,42 @@ void logClear(){
|
|
while(l=lstPopItem(&MAIN.Logs)){ strSafeDestroy(&l->Content); memFree(l); }
|
|
while(l=lstPopItem(&MAIN.Logs)){ strSafeDestroy(&l->Content); memFree(l); }
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+#ifdef __linux__
|
|
|
|
+int la_GetDPI(){
|
|
|
|
+ XRRScreenResources *screen;
|
|
|
|
+ XRROutputInfo *info;
|
|
|
|
+ XRRCrtcInfo *crtc_info;
|
|
|
|
+ XRRCrtcInfo *crtc;
|
|
|
|
+ int iscres, icrtc, dpi=0;
|
|
|
|
+
|
|
|
|
+ screen=XRRGetScreenResources(MAIN.dpy, DefaultRootWindow(MAIN.dpy));
|
|
|
|
+ for(iscres=0;iscres<screen->noutput;iscres++){
|
|
|
|
+ info=XRRGetOutputInfo(MAIN.dpy,screen,screen->outputs[iscres]);
|
|
|
|
+ if(!info->mm_width || !info->mm_height){ continue; }
|
|
|
|
+ logPrint(" Xrandr reported output size: %dmm x %dmm\n",info->mm_width,info->mm_height);
|
|
|
|
+ crtc=XRRGetCrtcInfo(MAIN.dpy,screen,info->crtc);
|
|
|
|
+ dpi=(real)crtc->width/(real)info->mm_width*25.4;
|
|
|
|
+ logPrint(" CRTC: %d x %d, around %ddpi\n",crtc->width,crtc->height,dpi);
|
|
|
|
+ XRRFreeCrtcInfo(crtc);
|
|
|
|
+ //if(info->connection==RR_Connected){
|
|
|
|
+ // for (icrtc=0;icrtc<info->ncrtc;icrtc++) {
|
|
|
|
+ // crtc_info=XRRGetCrtcInfo(MAIN.dpy,screen,screen->crtcs[icrtc]);
|
|
|
|
+ // printf("==> %d,%d + %dx%d\n", crtc_info->x, crtc_info->y, crtc_info->width, crtc_info->height);
|
|
|
|
+ // XRRFreeCrtcInfo(crtc_info);
|
|
|
|
+ // }
|
|
|
|
+ //}
|
|
|
|
+ XRRFreeOutputInfo(info);
|
|
|
|
+ }
|
|
|
|
+ XRRFreeScreenResources(screen);
|
|
|
|
+ return dpi;
|
|
|
|
+}
|
|
|
|
+#endif
|
|
|
|
+#ifdef _WIN32
|
|
|
|
+int la_GetDPI(){
|
|
|
|
+ return 144;
|
|
|
|
+}
|
|
|
|
+#endif
|
|
|
|
+
|
|
|
|
|
|
#define PROGRESSW (LA_RH*15)
|
|
#define PROGRESSW (LA_RH*15)
|
|
|
|
|
|
@@ -940,7 +977,11 @@ int laGetReadyWith(laInitArguments* ia){
|
|
MAIN.SavePreferenceOnExit=1;
|
|
MAIN.SavePreferenceOnExit=1;
|
|
|
|
|
|
MAIN.FontSize = 0.6;
|
|
MAIN.FontSize = 0.6;
|
|
- MAIN.UiRowHeight = MAIN.ScaledUiRowHeight =24;
|
|
|
|
|
|
+
|
|
|
|
+ int dpi=la_GetDPI(); if((!dpi) || dpi<96){ dpi=144; } if(dpi>300){ dpi=300; }
|
|
|
|
+ int UiSize=(int)(tnsLinearItp(16.0f,24.0f,tnsGetRatiod(96,144,dpi))+0.5);
|
|
|
|
+
|
|
|
|
+ MAIN.UiRowHeight = MAIN.ScaledUiRowHeight =UiSize;
|
|
MAIN.UiScale=1;
|
|
MAIN.UiScale=1;
|
|
MAIN.MarginSize = 1;
|
|
MAIN.MarginSize = 1;
|
|
|
|
|