Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Adapt Treeland #39

Merged
merged 1 commit into from
Oct 21, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading