update changelog

This commit is contained in:
winnerym 2023-08-08 09:48:53 +08:00 committed by cckylin-cibot
parent 4176d43dde
commit e6c6526a4b
3 changed files with 556 additions and 0 deletions

11
debian/changelog vendored
View File

@ -1,3 +1,14 @@
ukui-screensaver (4.0.0.0-ok6~0808) yangtze; urgency=medium
* BUG号I7JFT2 屏保时空格键无法唤醒登录密码输入框
I729TV 【用户切换】用户切换进入已登录用用户时,存在闪过屏保锁屏界面
I774FQ 【锁屏】进入锁屏切换用户到其他用户,再切换回来后登录进入桌面过程中右下角弹出切换用户窗口
* 需求号:无
* 其他修改说明:无
* commit id:004330d
-- Yang Min <yangmin@kylinos.cn> Tue, 08 Aug 2023 09:45:26 +0800
ukui-screensaver (4.0.0.0-ok5~0705) yangtze; urgency=medium ukui-screensaver (4.0.0.0-ok5~0705) yangtze; urgency=medium
* BUG号 * BUG号

View File

@ -0,0 +1,544 @@
From: winnerym <yangmin@kylinos.cn>
Date: Tue, 8 Aug 2023 09:48:53 +0800
Subject: update changelog
---
VirtualKeyboard/src/kbtitle.cpp | 6 ++-
src/authdialog.cpp | 5 ++
src/authdialog.h | 1 +
src/fullbackgroundwidget.cpp | 76 +++++++++++++++++++-----------
src/fullbackgroundwidget.h | 1 +
src/lockwidget.cpp | 101 ++++++++++++++++++++++++++--------------
src/lockwidget.h | 5 ++
src/logind.cpp | 53 +++++++++++++++++++--
src/logind.h | 12 +++--
src/ukui-screensaver-dialog.cpp | 27 +++++++++++
10 files changed, 217 insertions(+), 70 deletions(-)
diff --git a/VirtualKeyboard/src/kbtitle.cpp b/VirtualKeyboard/src/kbtitle.cpp
index 1d270cc..f5aa6b7 100644
--- a/VirtualKeyboard/src/kbtitle.cpp
+++ b/VirtualKeyboard/src/kbtitle.cpp
@@ -37,13 +37,14 @@ KBTitle::~KBTitle()
void KBTitle::initUI()
{
setFixedHeight(KEYBOARD_TITLE_DEFAULT_HEIGHT);
- QString strBtnStyle = "QPushButton{ text-align:center; color: rgb(255, 255, 255, 255); border: none; border-radius: 4px; outline: none;}"
- "QPushButton:hover{ background-color: rgb(255,255,255,15%); }"
+ QString strBtnStyle = "QPushButton{ text-align:center; color: rgba(255, 255, 255, 255); border: none; border-radius: 4px; outline: none;}"
+ "QPushButton:hover{ background-color: rgba(255,255,255,15%); }"
"QPushButton::pressed { background-color: rgba(255,255,255,40%); }"
"QPushButton::checked { background-color: rgba(255,255,255,40%); }";
m_btnFloat = new QPushButton(this);
m_btnFloat->setFlat(true);
+ m_btnFloat->setFocusPolicy(Qt::NoFocus);
m_btnFloat->setIcon(QIcon(":/images/images/float.svg"));
m_btnFloat->setObjectName("btn_float");
m_btnFloat->setIconSize(KEYBOARD_FIXED_DEFAULT_ICONSIZE);
@@ -53,6 +54,7 @@ void KBTitle::initUI()
m_btnClose = new QPushButton(this);
m_btnClose->setFlat(true);
+ m_btnClose->setFocusPolicy(Qt::NoFocus);
m_btnClose->setIcon(QIcon(":/images/images/close.svg"));
m_btnClose->setIconSize(KEYBOARD_FIXED_DEFAULT_ICONSIZE);
m_btnClose->setObjectName("btn_close");
diff --git a/src/authdialog.cpp b/src/authdialog.cpp
index b351202..e68e6ed 100644
--- a/src/authdialog.cpp
+++ b/src/authdialog.cpp
@@ -1639,6 +1639,11 @@ void AuthDialog::onBiometricDbusChanged(bool bActive)
}
}
+QString AuthDialog::getCurAuthUserName()
+{
+ return user.name;
+}
+
QPixmap AuthDialog::makeRoundLogo(QString logo, int wsize, int hsize, int radius)
{
QPixmap rectPixmap;
diff --git a/src/authdialog.h b/src/authdialog.h
index b3602e3..9288545 100644
--- a/src/authdialog.h
+++ b/src/authdialog.h
@@ -71,6 +71,7 @@ public:
void checkPassword();
int getBioNum();
bool getLineeditStatus();
+ QString getCurAuthUserName();
private:
void initUI();
void startWaiting();
diff --git a/src/fullbackgroundwidget.cpp b/src/fullbackgroundwidget.cpp
index 5ab2976..f4124b0 100644
--- a/src/fullbackgroundwidget.cpp
+++ b/src/fullbackgroundwidget.cpp
@@ -260,15 +260,6 @@ FullBackgroundWidget::FullBackgroundWidget(QWidget *parent)
qApp->installNativeEventFilter(this);
installEventFilter(this);
QTimer::singleShot(500,this,SLOT(switchToLinux()));
-
- LogindIntegration *m_logind = new LogindIntegration(this);
-
-
- connect(m_logind, &LogindIntegration::requestUnlock, this,
- [this]() {
- closeScreensaver();
- });
-
}
#ifdef USE_INTEL
@@ -438,6 +429,16 @@ void FullBackgroundWidget::paintEvent(QPaintEvent *event)
void FullBackgroundWidget::closeEvent(QCloseEvent *event)
{
qDebug() << "FullBackgroundWidget::closeEvent";
+ // 处理认证完成后收到屏幕变化信号调用lockWidget指针崩溃问题
+ QDesktopWidget *desktop = QApplication::desktop();
+ disconnect(desktop, &QDesktopWidget::resized,
+ this, &FullBackgroundWidget::onDesktopResized);
+ disconnect(desktop, &QDesktopWidget::workAreaResized,
+ this, &FullBackgroundWidget::onDesktopResized);
+ disconnect(desktop, &QDesktopWidget::primaryScreenChanged,
+ this, &FullBackgroundWidget::onDesktopResized);
+ disconnect(desktop, &QDesktopWidget::screenCountChanged,
+ this, &FullBackgroundWidget::onDesktopResized);
if (isStartup)
setIsStartup(false);
if(future.isRunning()){
@@ -466,7 +467,6 @@ void FullBackgroundWidget::closeEvent(QCloseEvent *event)
if(widget)
widget->close();
}
-
if(QX11Info::isPlatformX11()){
closeGrab();
}
@@ -930,6 +930,13 @@ int FullBackgroundWidget::onSessionStatusChanged(uint status)
return 0;
}
+void FullBackgroundWidget::onSessionActiveChanged(bool isActive)
+{
+ if (lockWidget) {
+ lockWidget->onSessionActiveChanged(isActive);
+ }
+}
+
void FullBackgroundWidget::delayLockScreen()
{
if (!m_timerLock) {
@@ -1098,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/fullbackgroundwidget.h b/src/fullbackgroundwidget.h
index 92f1e06..e960415 100644
--- a/src/fullbackgroundwidget.h
+++ b/src/fullbackgroundwidget.h
@@ -75,6 +75,7 @@ public Q_SLOTS:
void propertiesChangedSlot(QString, QMap<QString, QVariant>, QStringList);
void onShowBlackBackGround();
#endif
+ void onSessionActiveChanged(bool isActive);
Q_SIGNALS:
void StartupModeChanged(bool isStartup);
diff --git a/src/lockwidget.cpp b/src/lockwidget.cpp
index 43eefb6..3d0d60a 100644
--- a/src/lockwidget.cpp
+++ b/src/lockwidget.cpp
@@ -216,24 +216,7 @@ void LockWidget::key_enter_release(int key)
break;
case SWITCHBTN:
if(scrollArea && scrollArea->isVisible()) {
- if(authDialog)
- {
- if(list.at(nowAt)->objectName() != getenv("USER"))
- authDialog->stopAuth();
- }
- if(list.at(nowAt)->objectName() == "Guest")
- {
- displayManager->switchToGuest();
- }
- else if(list.at(nowAt)->objectName() == "SwitchUser")
- {
- displayManager->switchToGreeter();
- }
- else
- {
- if(list.at(nowAt)->objectName() != getenv("USER"))
- displayManager->switchToUser(list.at(nowAt)->objectName());
- }
+ SwitchToUser(list.at(nowAt)->objectName());
} else {
ui->btnSwitchUser->setStyleSheet(ON_NORMAL_SHEET);
showUserMenu();
@@ -1422,6 +1405,67 @@ void LockWidget::setVirkeyboardPos()
}
}
+void LockWidget::SwitchToUser(QString strUserName)
+{
+ bool isSwitchSelf = false;
+ if(authDialog) {
+ if (strUserName == authDialog->getCurAuthUserName()) {
+ isSwitchSelf = true;
+ } else {
+ authDialog->stopAuth();
+ }
+ }
+ if (!isSwitchSelf) {
+ this->hide();
+ if (!m_timerChkActive) {
+ m_timerChkActive = new QTimer(this);
+ m_timerChkActive->setInterval(10*1000);
+ connect(m_timerChkActive, &QTimer::timeout, this, [&,this](){
+ if (this->isHidden()) {
+ this->show();
+ }
+ m_timerChkActive->stop();
+ });
+ } else {
+ if (m_timerChkActive->isActive()) {
+ m_timerChkActive->stop();
+ }
+ }
+ m_timerChkActive->start();
+ }
+ QTimer::singleShot(10,this, [&,this, isSwitchSelf, strUserName](){
+ if(strUserName == "*Guest")
+ {
+ this->displayManager->switchToGuest();
+ }
+ else if(strUserName == "*SwitchUser")
+ {
+ this->displayManager->switchToGreeter();
+ }
+ else
+ {
+ if (!isSwitchSelf) {
+ this->displayManager->switchToUser(strUserName);
+ }
+ }
+ });
+}
+
+void LockWidget::onSessionActiveChanged(bool isActive)
+{
+ if (isActive) {
+ if (m_timerChkActive && m_timerChkActive->isActive()) {
+ m_timerChkActive->stop();
+ }
+ if (this->isHidden()) {
+ this->show();
+ }
+ } else {
+ if (m_timerChkActive && m_timerChkActive->isActive()) {
+ m_timerChkActive->stop();
+ }
+ }
+}
void LockWidget::initUserMenu()
{
@@ -1560,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"
@@ -1787,11 +1832,6 @@ void LockWidget::onUserMenuTrigged(QAction *action)
{
qDebug() << action->data().toString() << "selected";
- if(authDialog)
- {
- authDialog->stopAuth();
- }
-
QString userName = action->data().toString();
for (int i =0; i < list.count(); i++)
{
@@ -1803,18 +1843,7 @@ void LockWidget::onUserMenuTrigged(QAction *action)
"HoverWidget:hover:!pressed{background-color:rgb(255,255,255,15%);border-radius: 6px;}");
}
}
- if(userName == "Guest")
- {
- displayManager->switchToGuest();
- }
- else if(userName == "SwitchUser")
- {
- displayManager->switchToGreeter();
- }
- else
- {
- displayManager->switchToUser(userName);
- }
+ SwitchToUser(userName);
}
bool LockWidget::exitSubWidget()
diff --git a/src/lockwidget.h b/src/lockwidget.h
index da89db0..47f8b28 100644
--- a/src/lockwidget.h
+++ b/src/lockwidget.h
@@ -95,6 +95,7 @@ public:
void onActiveLineedit();
QString getBatteryIconName();
void key_enter_release(int key);
+ void onSessionActiveChanged(bool isActive);
Q_SIGNALS:
void closed();
@@ -128,6 +129,8 @@ private:
*/
void setRootWindow();
+ void SwitchToUser(QString strUserName);
+
private Q_SLOTS:
void onUserAdded(const UserItem &user);
void onUserDeleted(const UserItem &user);
@@ -208,6 +211,8 @@ private:
double curFontSize = 0;
QFuture<void> m_futureLoadDeskBg;
+
+ QTimer *m_timerChkActive = nullptr;
};
#endif // LOCKWIDGET_H
diff --git a/src/logind.cpp b/src/logind.cpp
index 34c00ed..e8817ac 100644
--- a/src/logind.cpp
+++ b/src/logind.cpp
@@ -24,6 +24,7 @@
const static QString login1Service = QStringLiteral("org.freedesktop.login1");
const static QString login1Path = QStringLiteral("/org/freedesktop/login1");
+const static QString propertiesInterface = QStringLiteral("org.freedesktop.DBus.Properties");
const static QString login1ManagerInterface = QStringLiteral("org.freedesktop.login1.Manager");
const static QString login1SessionInterface = QStringLiteral("org.freedesktop.login1.Session");
@@ -34,12 +35,11 @@ LogindIntegration::LogindIntegration(QObject *parent)
login1Path,
login1ManagerInterface,
QDBusConnection::systemBus());
- QDBusReply<QDBusObjectPath> sessionPath = loginInterface.call("GetSessionByPID",(quint32) QCoreApplication::applicationPid());
+ QDBusReply<QDBusObjectPath> sessionPath = loginInterface.call("GetSession", "auto");
if(!sessionPath.isValid()){
qWarning()<< "Get session error:" << sessionPath.error();
}
else{
-
QString session = sessionPath.value().path();
QDBusConnection::systemBus().connect(login1Service,
session,
@@ -53,9 +53,56 @@ LogindIntegration::LogindIntegration(QObject *parent)
QStringLiteral("Unlock"),
this,
SIGNAL(requestUnlock()));
+
+ // 获取会话激活状态
+ QDBusInterface iface(login1Service,
+ session,
+ propertiesInterface,
+ QDBusConnection::systemBus());
+ QDBusReply<QVariant> reply = iface.call("Get", login1SessionInterface, "Active");
+ if (reply.isValid()) {
+ m_isSessionActive = reply.value().toBool();
+ qDebug()<<"Session is active:"<<m_isSessionActive;
+ } else {
+ qDebug() << "Failed to get session active state!";
+ }
+
+ // 监听属性变化
+ QDBusConnection::systemBus().connect(login1Service,
+ session,
+ propertiesInterface,
+ "PropertiesChanged",
+ this,
+ SLOT(onSessionPropChanged(QString, QVariantMap, QStringList)));
}
return;
}
-LogindIntegration::~LogindIntegration() = default;
+LogindIntegration::~LogindIntegration()
+{
+
+}
+
+void LogindIntegration::onSessionPropChanged(QString strInterface, QVariantMap mapVar, QStringList listValue)
+{
+ if (login1SessionInterface == strInterface) {
+ qDebug()<<"onSessionPropChanged:"<<strInterface<<mapVar<<listValue;
+ QVariantMap::iterator itVar = mapVar.begin();
+ for ( ; itVar != mapVar.end(); itVar++) {
+ if (itVar.key() == "Active") {
+ QVariant varValue = itVar.value();
+ m_isSessionActive = varValue.toBool();
+ if (!m_isSessionActive) {
+ Q_EMIT requestLock();
+ }
+ Q_EMIT sessionActiveChanged(m_isSessionActive);
+ break;
+ }
+ }
+ }
+}
+bool LogindIntegration::isSessionActive()
+{
+ return m_isSessionActive;
+}
diff --git a/src/logind.h b/src/logind.h
index f1e27ed..155c1ef 100644
--- a/src/logind.h
+++ b/src/logind.h
@@ -19,6 +19,7 @@
#define LOGIND_H
#include <QDBusConnection>
+#include <QVariantMap>
#include <QObject>
class QDBusServiceWatcher;
@@ -28,15 +29,20 @@ class LogindIntegration : public QObject
Q_OBJECT
public:
explicit LogindIntegration(QObject *parent = nullptr);
- ~LogindIntegration() override;
+ virtual ~LogindIntegration();
+
+ bool isSessionActive();
+
+public Q_SLOTS:
+ void onSessionPropChanged(QString, QVariantMap, QStringList);
Q_SIGNALS:
void requestLock();
void requestUnlock();
- void connectedChanged();
+ void sessionActiveChanged(bool isActive);
private:
-
+ bool m_isSessionActive = false;
};
#endif
diff --git a/src/ukui-screensaver-dialog.cpp b/src/ukui-screensaver-dialog.cpp
index 8626b4c..009fd8b 100644
--- a/src/ukui-screensaver-dialog.cpp
+++ b/src/ukui-screensaver-dialog.cpp
@@ -29,6 +29,7 @@
#include <QX11Info>
#include <QDesktopWidget>
#include <QDBusInterface>
+#include <QEventLoop>
#include "plasma-shell-manager.h"
#include <signal.h>
#include <unistd.h>
@@ -158,6 +159,30 @@ int main(int argc, char *argv[])
QApplication a(argc, argv);
QApplication::setSetuidAllowed(true);
+ LogindIntegration *m_logind = new LogindIntegration(&a);
+ QObject::connect(m_logind, &LogindIntegration::requestUnlock, [=]() {
+ if (window) {
+ window->closeScreensaver();
+ } else {
+ exit(0);
+ }
+ });
+ if (!m_logind->isSessionActive()) {
+ QEventLoop *loopTemp = new QEventLoop(&a);
+ QObject::connect(m_logind, &LogindIntegration::sessionActiveChanged, [loopTemp](bool isActive) {
+ qDebug()<<"sessionActiveChanged:"<<isActive;
+ if (isActive && loopTemp->isRunning()) {
+ loopTemp->quit();
+ }
+ });
+ QObject::connect(m_logind, &LogindIntegration::requestLock, [loopTemp]() {
+ qDebug()<<"session requestLock!";
+ if (loopTemp->isRunning()) {
+ loopTemp->quit();
+ }
+ });
+ loopTemp->exec();
+ }
//命令行参数解析
QCommandLineParser parser;
@@ -214,6 +239,8 @@ int main(int argc, char *argv[])
// a.setStyleSheet(qssFile.readAll());
// }
// qssFile.close();
+ // 监听会话active状态
+ QObject::connect(m_logind, &LogindIntegration::sessionActiveChanged, window, &FullBackgroundWidget::onSessionActiveChanged);
// 注册DBus
ScreenSaverWndAdaptor adaptorWnd(window);

View File

@ -2,3 +2,4 @@
0002-update-changelog.patch 0002-update-changelog.patch
0003-30-bug-I69CSS.patch 0003-30-bug-I69CSS.patch
0004-33-changelog.patch 0004-33-changelog.patch
0005-update-changelog.patch