Merge pull request #44 from Z-bin/master
Use X11 to get the screen width to determine the resolution
This commit is contained in:
commit
62f51cb865
|
@ -12,7 +12,8 @@ Build-Depends: debhelper-compat (= 12),
|
|||
qtbase5-dev-tools,
|
||||
libqt5x11extras5-dev,
|
||||
libgsettings-qt-dev,
|
||||
libkf5windowsystem-dev
|
||||
libkf5windowsystem-dev,
|
||||
libx11-dev,
|
||||
Standards-Version: 4.5.0
|
||||
Rules-Requires-Root: no
|
||||
Homepage: https://github.com/ukui/kylin-nm
|
||||
|
|
|
@ -18,7 +18,7 @@ CONFIG += release
|
|||
|
||||
# CONFIG += link_pkgconfig
|
||||
# PKGCONFIG += gsettings-qt
|
||||
LIBS += -L/usr/lib/ -lgsettings-qt
|
||||
LIBS += -L/usr/lib/ -lgsettings-qt -lX11
|
||||
|
||||
target.path = /usr/bin
|
||||
target.source += $$TARGET
|
||||
|
|
14
src/main.cpp
14
src/main.cpp
|
@ -26,6 +26,7 @@
|
|||
#include <QApplication>
|
||||
#include <QDebug>
|
||||
#include <QDesktopWidget>
|
||||
#include <X11/Xlib.h>
|
||||
|
||||
#define LOG_IDENT "ukui_kylin_nm"
|
||||
|
||||
|
@ -33,16 +34,23 @@
|
|||
int main(int argc, char *argv[])
|
||||
{
|
||||
//QGuiApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
|
||||
Display *disp = XOpenDisplay(NULL);
|
||||
Screen *scrn = DefaultScreenOfDisplay(disp);
|
||||
if (NULL == scrn) {
|
||||
return 0;
|
||||
}
|
||||
int width = scrn->width;
|
||||
|
||||
QApplication a(argc, argv);
|
||||
|
||||
if (QApplication::desktop()->width() >= 2560) {
|
||||
if (width > 2560) {
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 6, 0))
|
||||
QApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
|
||||
QApplication::setAttribute(Qt::AA_UseHighDpiPixmaps);
|
||||
#endif
|
||||
}
|
||||
|
||||
QApplication a(argc, argv);
|
||||
|
||||
|
||||
openlog(LOG_IDENT, LOG_NDELAY | LOG_NOWAIT | LOG_PID, LOG_USER);
|
||||
|
||||
syslog(LOG_DEBUG, "Kylin Network Manager Is Already Launched");
|
||||
|
|
Loading…
Reference in New Issue