fix: set DEEPIN_WINE_SCALE on launch an application (#36)
Supported HiDPI for the deepin wine applications. We must give an env variant to apply the window scale effect to it.
This commit is contained in:
parent
b0383d43da
commit
63d9f4ed57
@ -22,6 +22,8 @@
|
|||||||
#include <QJsonObject>
|
#include <QJsonObject>
|
||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
#include <QThread>
|
#include <QThread>
|
||||||
|
#include <QDBusConnection>
|
||||||
|
#include <QDBusReply>
|
||||||
|
|
||||||
#define DESKTOPEXT ".desktop"
|
#define DESKTOPEXT ".desktop"
|
||||||
#define SETTING StartManagerSettings::instance()
|
#define SETTING StartManagerSettings::instance()
|
||||||
@ -387,11 +389,22 @@ bool StartManager::launch(DesktopInfo *info, QString cmdLine, uint32_t timestamp
|
|||||||
envs << var;
|
envs << var;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!appId.isEmpty() && shouldDisableScaling(appId)) {
|
// FIXME: Don't using env to control the window scale factor, this function
|
||||||
double scale = SETTING->getScaleFactor();
|
// should via using graphisc server(Wayland Compositor/Xorg Xft) in deepin wine.
|
||||||
scale = scale > 0 ? 1 / scale : 1;
|
if (!appId.isEmpty() && !shouldDisableScaling(appId)) {
|
||||||
QString qtEnv = "QT_SCALE_FACTOR=" + QString::number(scale, 'f', -1);
|
auto dbus = QDBusConnection::sessionBus();
|
||||||
cmdPrefixesEnvs << "/usr/bin/env" << "GDK_DPI_SCALE=1" << "GDK_SCALE=1" << qtEnv;
|
QDBusMessage reply = dbus.call(QDBusMessage::createMethodCall("org.deepin.dde.XSettings1",
|
||||||
|
"/org/deepin/dde/XSettings1",
|
||||||
|
"org.deepin.dde.XSettings1",
|
||||||
|
"GetScaleFactor"), QDBus::Block, 2);
|
||||||
|
|
||||||
|
if (reply.type() == QDBusMessage::ReplyMessage) {
|
||||||
|
QDBusReply<double> ret(reply);
|
||||||
|
double scale = ret.isValid() ? ret.value() : 1.0;
|
||||||
|
scale = scale > 0 ? scale : 1;
|
||||||
|
const QString scaleStr = QString::number(scale, 'f', -1);
|
||||||
|
envs << "DEEPIN_WINE_SCALE=" + scaleStr;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
envs << cmdPrefixesEnvs;
|
envs << cmdPrefixesEnvs;
|
||||||
|
Loading…
Reference in New Issue
Block a user