Skip to content

Commit

Permalink
feat: Adapt Treeland
Browse files Browse the repository at this point in the history
Adapt Treeland, disable wayland settings in
Treeland enviroment.

Log: Adapt Treeland.
  • Loading branch information
lzwind authored and deepin-bot[bot] committed Oct 21, 2024
1 parent 6ab5495 commit e8e94a6
Showing 1 changed file with 13 additions and 9 deletions.
22 changes: 13 additions & 9 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,11 @@

DWIDGET_USE_NAMESPACE

bool isTreeland()
{
return qEnvironmentVariable("DDE_CURRENT_COMPOSITOR") == QStringLiteral("TreeLand");
}

int main(int argc, char *argv[])
{
if (!QString(qgetenv("XDG_CURRENT_DESKTOP")).toLower().startsWith("deepin")) {
Expand All @@ -33,15 +38,15 @@ int main(int argc, char *argv[])
QString XDG_SESSION_TYPE = e.value(QStringLiteral("XDG_SESSION_TYPE"));
QString WAYLAND_DISPLAY = e.value(QStringLiteral("WAYLAND_DISPLAY"));

if (XDG_SESSION_TYPE == QLatin1String("wayland") || WAYLAND_DISPLAY.contains(QLatin1String("wayland"), Qt::CaseInsensitive)) {
if ((XDG_SESSION_TYPE == QLatin1String("wayland") || WAYLAND_DISPLAY.contains(QLatin1String("wayland"), Qt::CaseInsensitive)) && !isTreeland()) {
qputenv("QT_WAYLAND_SHELL_INTEGRATION", "kwayland-shell");
}

// Init attributes.
const char *descriptionText = QT_TRANSLATE_NOOP(
"MainWindow",
"Deepin Picker is a quick and easy screen color picking tool. RGB and HEX codes "
"are obtained on click and auto saved to the clipboard.");
"MainWindow",
"Deepin Picker is a quick and easy screen color picking tool. RGB and HEX codes "
"are obtained on click and auto saved to the clipboard.");

const QString acknowledgementLink = "https://www.deepin.org/acknowledgments/deepin-picker";

Expand All @@ -50,10 +55,10 @@ int main(int argc, char *argv[])
app.setAttribute(Qt::AA_UseHighDpiPixmaps);

// 判断窗口特效是否开启
// if (!DWindowManagerHelper::instance()->hasComposite()) {
// Utils::warnNoComposite();
// return 0;
// }
// if (!DWindowManagerHelper::instance()->hasComposite()) {
// Utils::warnNoComposite();
// return 0;
// }

app.loadTranslator();

Expand Down Expand Up @@ -86,7 +91,6 @@ int main(int argc, char *argv[])
}
QObject::connect(picker.data(), &CPickerManager::copyColor, &clipboard, &Clipboard::copyToClipboard, Qt::QueuedConnection);


if (isLaunchByDBus) {
QDBusConnection dbus = QDBusConnection::sessionBus();
if (dbus.registerService("com.deepin.Picker")) {
Expand Down

0 comments on commit e8e94a6

Please sign in to comment.