Fix: 平板模式下开启应用后锁屏,重新登录后应用窗口最小化 (wayland)

This commit is contained in:
pangyi 2022-12-07 15:53:14 +08:00
parent 52731ace8f
commit 6c586d763d
1 changed files with 9 additions and 10 deletions

View File

@ -116,7 +116,7 @@ void TabletManager::init()
bool bTabletMode = response.arguments().takeFirst().toBool();
slotSwitchTabletMode(bTabletMode);
} else {
printf("TabletMode qdus invalid\n");
qDebug() << "TabletMode dbus is invalid !";
}
QDBusConnection::sessionBus().connect(KYLIN_STATUSMANAGER_SERVICE,
@ -270,11 +270,7 @@ void TabletManager::hideBackground(double radius)
TabletBackground::TabletBackground()
: QWidget()
{
if (kwinApp()->operationMode() == Application::OperationMode::OperationModeX11) {
setWindowFlags(Qt::WindowStaysOnBottomHint | Qt::FramelessWindowHint);
} else {
setWindowFlags(Qt::BypassWindowManagerHint | Qt::WindowStaysOnBottomHint | Qt::FramelessWindowHint);
}
setWindowFlags(Qt::WindowStaysOnBottomHint | Qt::FramelessWindowHint);
setAttribute(Qt::WA_ShowWithoutActivating);
setAttribute(Qt::WA_TranslucentBackground);
setFocusPolicy(Qt::NoFocus);
@ -603,10 +599,11 @@ void SingleWindowManager::handleClientRemoved(AbstractClient *client)
// 是 false因为 workspace 在发送 clientRemoved 信号前,已经将父子窗口全部清空关系了。所以要将瞬态窗口提前保存下来,利用自
// 定义的 removeTransient() 函数来判断是否移除的是瞬态窗口。瞬态窗口不直接return的话可能会导致毛玻璃背景先隐藏再被显示出来。
// wayland 环境下任务栏隐藏也会触发此槽函数直接return即可。
if (isTransientRemoved || client->isDock() || client->caption().contains(QStringLiteral("sidebar"))) {
if (isTransientRemoved || client->isDock()
|| client->caption().contains(QStringLiteral("sidebar"))
|| client->caption().contains(QStringLiteral("ukui-screensaver-"))) {
return;
}
else {
} else {
// 窗口可以最大化,意味着毛玻璃背景窗口并没有显示出来
if (client->isMaximizable()) {
return;
@ -639,7 +636,9 @@ void SingleWindowManager::handleClientActivated(AbstractClient *client)
hideBackground();
return;
}
if (client->caption().contains(QStringLiteral("sidebar"))) {
// wayland 中不存在不受窗管管理的窗口,所以也会拿到锁屏的激活信号
// 2023年计划扩展窗口类型暂时只能通过标题名判断
if (client->caption().contains(QStringLiteral("sidebar")) || client->caption().contains(QStringLiteral("ukui-screensaver-"))) {
return;
}