diff --git a/src/widgets/fullbackgroundwidget.cpp b/src/widgets/fullbackgroundwidget.cpp index 7cfee1e..c71510e 100644 --- a/src/widgets/fullbackgroundwidget.cpp +++ b/src/widgets/fullbackgroundwidget.cpp @@ -133,9 +133,6 @@ void FullBackgroundWidget::initUI() } setWindowFlags(Qt::FramelessWindowHint | Qt::X11BypassWindowManagerHint); - QTimer::singleShot(100, this, [=]() { - WindowManager::setWindowLayer(this->windowHandle(), WindowLayer::ScreenLock); - }); // 登录模式下监听屏幕插拔 if (isGreeterMode()) { @@ -170,6 +167,9 @@ bool FullBackgroundWidget::eventFilter(QObject *obj, QEvent *event) } QTimer::singleShot(500, this, SLOT(setLockState())); // QTimer::singleShot(200,this,SLOT(killWindow())); + } else if (event->type() == QEvent::Show || event->type() == QEvent::UpdateRequest) { + WindowManager::setWindowLayer(this->windowHandle(), WindowLayer::ScreenLock); + //qDebug()<<"Set window layer ScreenLock"; } return QWidget::eventFilter(obj, event); } @@ -637,7 +637,6 @@ void FullBackgroundWidget::showEvent(QShowEvent *event) if (QX11Info::isPlatformX11()) tryGrabKeyboard(); QTimer::singleShot(100, this, [=]() { - WindowManager::setWindowLayer(this->windowHandle(), WindowLayer::ScreenLock); m_lockWidget->updateFont(); m_lockWidget->updateFontSize(); });