Skip to content

Commit

Permalink
Some change in wayland environment(dde-desktop)
Browse files Browse the repository at this point in the history
  • Loading branch information
gfdgd-xi committed Oct 6, 2024
1 parent 01f747a commit f2fd5f4
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 9 deletions.
20 changes: 12 additions & 8 deletions dde-desktop/desktop.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -101,20 +101,24 @@ void Desktop::onBackgroundEnableChanged()
QMetaObject::invokeMethod(background, "raise", Qt::QueuedConnection);

// 隐藏完全重叠的窗口
for (QLabel *l : d->background->allBackgrounds()) {
if (l != background) {
Xcb::XcbMisc::instance().set_window_transparent_input(l->winId(), true);
l->setVisible(!background->geometry().contains(l->geometry()));
} else {
Xcb::XcbMisc::instance().set_window_transparent_input(l->winId(), false);
l->show();
if (qgetenv("XDG_SESSION_TYPE") != "wayland") {
for (QLabel *l : d->background->allBackgrounds()) {
if (l != background) {
Xcb::XcbMisc::instance().set_window_transparent_input(l->winId(), true);
l->setVisible(!background->geometry().contains(l->geometry()));
} else {
Xcb::XcbMisc::instance().set_window_transparent_input(l->winId(), false);
l->show();
}
}
}
} else {
d->screenFrame.setParent(nullptr);
setWindowFlag(&d->screenFrame, Qt::FramelessWindowHint, true);
d->screenFrame.QWidget::setGeometry(qApp->primaryScreen()->geometry());
Xcb::XcbMisc::instance().set_window_type(d->screenFrame.winId(), Xcb::XcbMisc::Desktop);
if (qgetenv("XDG_SESSION_TYPE") != "wayland") {
Xcb::XcbMisc::instance().set_window_type(d->screenFrame.winId(), Xcb::XcbMisc::Desktop);
}
QWindow::fromWinId(d->screenFrame.winId())->setOpacity(0.99);
d->screenFrame.show();
}
Expand Down
4 changes: 3 additions & 1 deletion dde-desktop/view/backgroundhelper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,9 @@ void BackgroundHelper::onScreenAdded(QScreen *screen)
if (m_previuew) {
l->setWindowFlags(l->windowFlags() | Qt::BypassWindowManagerHint | Qt::WindowDoesNotAcceptFocus);
} else {
Xcb::XcbMisc::instance().set_window_type(l->winId(), Xcb::XcbMisc::Desktop);
if (qgetenv("XDG_SESSION_TYPE") != "wayland") {
Xcb::XcbMisc::instance().set_window_type(l->winId(), Xcb::XcbMisc::Desktop);
}
}

if (m_visible)
Expand Down

0 comments on commit f2fd5f4

Please sign in to comment.