diff --git a/src/fullbackgroundwidget.cpp b/src/fullbackgroundwidget.cpp index 23b3d13..f4124b0 100644 --- a/src/fullbackgroundwidget.cpp +++ b/src/fullbackgroundwidget.cpp @@ -1105,23 +1105,40 @@ void FullBackgroundWidget::onGlobalKeyRelease(int key) // 键盘上的num_lock生效、不需要登录界面进行管理 } #else - if (key == 65) { // "Space" - if (lockWidget && lockWidget->isVisible()) {/*keyReleaseEvent有时候监听不到Space的按键事件 原因未知 - 把Space按键放到nativeEventFilter里面*/ - lockWidget->key_enter_release(Qt::Key_Space); + if (QX11Info::isPlatformX11()) { + if (key == 65) { // "Space" + if (lockWidget && lockWidget->isVisible()) {/*keyReleaseEvent有时候监听不到Space的按键事件 原因未知 + 把Space按键放到nativeEventFilter里面*/ + lockWidget->key_enter_release(Qt::Key_Space); + } + } + if (key == 9 && screenStatus == SCREEN_LOCK) { // "escape" + bool canShow = true; + if (lockWidget && !lockWidget->exitSubWidget()) + canShow = false; + if (configuration && configuration->idledelay() == -1) + canShow = false; + if (!m_isAlreadyShowSaver) + canShow = false; + if (canShow) + showScreensaver(); + } else if (screenStatus & SCREEN_SAVER && !isBlank) { + clearScreensavers(); + } + } else { + if (key == Qt::Key_Escape && screenStatus == SCREEN_LOCK) { // "escape" + bool canShow = true; + if (lockWidget && !lockWidget->exitSubWidget()) + canShow = false; + if (configuration && configuration->idledelay() == -1) + canShow = false; + if (!m_isAlreadyShowSaver) + canShow = false; + if (canShow) + showScreensaver(); + } else if (screenStatus & SCREEN_SAVER && !isBlank) { + clearScreensavers(); } - } else if (key == Qt::Key_Escape && screenStatus == SCREEN_LOCK) { // "escape" - bool canShow = true; - if (lockWidget && !lockWidget->exitSubWidget()) - canShow = false; - if (configuration && configuration->idledelay() == -1) - canShow = false; - if (!m_isAlreadyShowSaver) - canShow = false; - if (canShow) - showScreensaver(); - } else if (screenStatus & SCREEN_SAVER && !isBlank) { - clearScreensavers(); } #endif } diff --git a/src/lockwidget.cpp b/src/lockwidget.cpp index c106c2b..3d0d60a 100644 --- a/src/lockwidget.cpp +++ b/src/lockwidget.cpp @@ -1604,7 +1604,8 @@ void LockWidget::initUserMenu() void LockWidget::keyReleaseEvent(QKeyEvent *e) { - Q_EMIT keyGlobalRelease(e->key()); + if (!QX11Info::isPlatformX11()) + Q_EMIT keyGlobalRelease(e->key()); /* if (e->key() == 9) { // "Escape"