diff --git a/src/widgets/fullbackgroundwidget.cpp b/src/widgets/fullbackgroundwidget.cpp index d36f964..030b0a1 100644 --- a/src/widgets/fullbackgroundwidget.cpp +++ b/src/widgets/fullbackgroundwidget.cpp @@ -40,6 +40,7 @@ #include #include #include +#include #include "commonfunc.h" #include "screensavermode.h" #include "screensaverwidget.h" @@ -135,7 +136,7 @@ bool FullBackgroundWidget::eventFilter(QObject *obj, QEvent *event) static bool isFirstActive = true; if (!QX11Info::isPlatformX11()) { - if(event->type() == QEvent::MouseButtonPress || event->type() == QEvent::MouseMove || event->type() == 7){ + if(event->type() == QEvent::MouseButtonPress || event->type() == QEvent::MouseMove/* || event->type() == 7*/){ if(screenStatus & SCREEN_SAVER && !isBlank){ onClearScreensaver(); } @@ -551,6 +552,21 @@ void FullBackgroundWidget::showEvent(QShowEvent *event) KWindowSystem::setType(this->winId(), NET::ScreenLock); } +void FullBackgroundWidget::keyReleaseEvent(QKeyEvent *e) +{ + if (!QX11Info::isPlatformX11()) { + if(e->key() == Qt::Key_Escape && screenStatus == SCREEN_LOCK) { // "escape" + bool canShow = true; + if (m_lockWidget && !m_lockWidget->exitSubWidget()) + canShow = false; + if (canShow) + onShowScreensaver(); + } else if(screenStatus & SCREEN_SAVER/* && !isBlank*/) { + onClearScreensaver(); + } + } +} + void FullBackgroundWidget::tryGrabKeyboard() { if (window()->windowHandle() && window()->windowHandle()->setKeyboardGrabEnabled(true)) { diff --git a/src/widgets/fullbackgroundwidget.h b/src/widgets/fullbackgroundwidget.h index 462f0e5..3b258b9 100644 --- a/src/widgets/fullbackgroundwidget.h +++ b/src/widgets/fullbackgroundwidget.h @@ -97,6 +97,7 @@ protected: void mousePressEvent(QMouseEvent *e); void showEvent(QShowEvent *event) Q_DECL_OVERRIDE; void paintEvent(QPaintEvent *event); + void keyReleaseEvent(QKeyEvent *e); private: void initUI(); void initConnections();