ukui-greeter/0003-add-set-dpi.patch
2021-10-29 10:29:09 +08:00

53 lines
1.4 KiB
Diff

From 87ea222e7f73b2250727e827ed5d4bb002bfdc6b Mon Sep 17 00:00:00 2001
From: tanyulong <tanyulong@kylinos.cn>
Date: Fri, 29 Oct 2021 10:25:53 +0800
Subject: [PATCH] add set dpi
---
ukui-greeter/greeter/main.cpp | 20 ++++++++++++++++++++
1 file changed, 20 insertions(+)
diff --git a/ukui-greeter/greeter/main.cpp b/ukui-greeter/greeter/main.cpp
index 76cfbf0..0fc09da 100755
--- a/ukui-greeter/greeter/main.cpp
+++ b/ukui-greeter/greeter/main.cpp
@@ -34,6 +34,7 @@
#include <X11/Xlib.h>
#include <X11/XKBlib.h>
#include <X11/keysym.h>
+#include <X11/Xatom.h>
#include <X11/cursorfont.h>
#include <X11/extensions/Xrandr.h>
#include "globalv.h"
@@ -108,8 +109,27 @@ void x11_get_screen_size(int *width,int *height)
}
+void XsettingsHidpi()
+{
+ Display *dpy;
+ int w,h;
+ x11_get_screen_size (&w, &h);
+ dpy = XOpenDisplay (NULL);
+ if(h > 2000){
+ XChangeProperty(dpy, RootWindow (dpy, 0),
+ XA_RESOURCE_MANAGER, XA_STRING, 8, PropModeReplace, (unsigned char *) "Xft.dpi: 192\n", 13);
+ }else{
+ XChangeProperty(dpy, RootWindow (dpy, 0),
+ XA_RESOURCE_MANAGER, XA_STRING, 8, PropModeReplace, (unsigned char *) "Xft.dpi: 96\n", 12);
+ }
+ XCloseDisplay (dpy);
+}
+
+
+
int main(int argc, char *argv[])
{
+ XsettingsHidpi ();
qInstallMessageHandler(outputMessage);
#if(QT_VERSION>=QT_VERSION_CHECK(5,6,0))
--
2.30.0