diff --git a/0001-fix-icon-misplaced.patch b/0001-fix-icon-misplaced.patch deleted file mode 100644 index e68cfed..0000000 --- a/0001-fix-icon-misplaced.patch +++ /dev/null @@ -1,34 +0,0 @@ -From 92214058d11321cfc55613d588e47b8e33b942cc Mon Sep 17 00:00:00 2001 -From: myshow <296570182@qq.com> -Date: Wed, 9 Dec 2020 10:53:02 +0800 -Subject: [PATCH] fix-icon-misplaced - ---- - src/lockwidget.cpp | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/src/lockwidget.cpp b/src/lockwidget.cpp -index d6a66c0..9a62ef7 100644 ---- a/src/lockwidget.cpp -+++ b/src/lockwidget.cpp -@@ -187,7 +187,7 @@ void LockWidget::showPowerManager() - authDialog->show(); - powermanager->hide(); - } -- else{ -+ else{ - authDialog->hide(); - powermanager->show(); - powermanager->setGeometry((width()-ITEM_WIDTH*5)/2, -@@ -227,7 +227,7 @@ void LockWidget::initUserMenu() - * qt5.6上,qmenu文字以图标左方为起点,20.04上文字以图标右方为起点,所以 - * qt5.6时,左边距要设置大一点,避免与图标重合 - */ --#if (QT_VERSION >= QT_VERSION_CHECK(5, 7, 0)) -+#if (QT_VERSION >= QT_VERSION_CHECK(5, 12, 0)) - usersMenu->setStyleSheet("QMenu::item{padding: 2px 10px 2px 10px;}"); - #else - usersMenu->setStyleSheet("QMenu::item{padding: 2px 10px 2px 30px;}"); --- -2.29.2.windows.2 - diff --git a/0001-insert-the-monitor-after-placement-and-the-screensav.patch b/0001-insert-the-monitor-after-placement-and-the-screensav.patch deleted file mode 100644 index 03c4191..0000000 --- a/0001-insert-the-monitor-after-placement-and-the-screensav.patch +++ /dev/null @@ -1,84 +0,0 @@ -From 7687e1221e55f96035ba559c374b1672207f4ef4 Mon Sep 17 00:00:00 2001 -From: huayadong -Date: Fri, 10 Dec 2021 15:39:21 +0800 -Subject: [PATCH] insert the monitor after placement, and the screensaver is - abnormal - ---- - src/fullbackgroundwidget.cpp | 17 +++++++++++++---- - src/lockwidget.cpp | 2 +- - src/ukui-screensaver-dialog.cpp | 2 +- - 3 files changed, 15 insertions(+), 6 deletions(-) - -diff --git a/src/fullbackgroundwidget.cpp b/src/fullbackgroundwidget.cpp -index 46795d0..f4ddaa1 100755 ---- a/src/fullbackgroundwidget.cpp -+++ b/src/fullbackgroundwidget.cpp -@@ -516,7 +516,10 @@ void FullBackgroundWidget::onGlobalButtonDrag(int xPos, int yPos) - ScreenSaver *saver = configuration->getScreensaver(); - if(saver->path == "/usr/lib/ukui-screensaver/ukui-screensaver-default") - return ; -- clearScreensavers(); -+ if(screenStatus & SCREEN_SAVER) -+ { -+ clearScreensavers(); -+ } - } - } - -@@ -526,8 +529,11 @@ void FullBackgroundWidget::onScreenCountChanged(int) - QSize newSize = monitorWatcher->getVirtualSize(); - setGeometry(0, 0, newSize.width(), newSize.height()); - //repaint(); -+ if(screenStatus & SCREEN_SAVER) -+ { -+ clearScreensavers(); -+ } - update(); -- clearScreensavers(); - } - - void FullBackgroundWidget::onDesktopResized() -@@ -536,8 +542,11 @@ void FullBackgroundWidget::onDesktopResized() - setGeometry(desktop->geometry()); - if(lockWidget) - onCursorMoved(cursor().pos()); --// clearScreensavers(); -- //repaint(); -+ if(screenStatus & SCREEN_SAVER) -+ { -+ clearScreensavers(); -+ } -+ //repaint(); - update(); - - } -diff --git a/src/lockwidget.cpp b/src/lockwidget.cpp -index 3ab66a5..d69e890 100755 ---- a/src/lockwidget.cpp -+++ b/src/lockwidget.cpp -@@ -227,7 +227,7 @@ void LockWidget::initUserMenu() - * qt5.6上,qmenu文字以图标左方为起点,20.04上文字以图标右方为起点,所以 - * qt5.6时,左边距要设置大一点,避免与图标重合 - */ --#if (QT_VERSION >= QT_VERSION_CHECK(5, 12, 0)) -+#if (QT_VERSION >= QT_VERSION_CHECK(5, 7, 0)) - usersMenu->setStyleSheet("QMenu::item{padding: 2px 10px 2px 10px;}"); - #else - usersMenu->setStyleSheet("QMenu::item{padding: 2px 10px 2px 30px;}"); -diff --git a/src/ukui-screensaver-dialog.cpp b/src/ukui-screensaver-dialog.cpp -index d78dafb..84a912a 100755 ---- a/src/ukui-screensaver-dialog.cpp -+++ b/src/ukui-screensaver-dialog.cpp -@@ -173,7 +173,7 @@ int main(int argc, char *argv[]) - - if(parser.isSet(lockOption)) - { -- window->onScreensaver(); -+ window->lock(); - } - - if(parser.isSet(sessionIdleOption)) --- -2.30.0 - diff --git a/0002-fix-ukui-screensaver-dialog-lock.patch b/0002-fix-ukui-screensaver-dialog-lock.patch deleted file mode 100644 index 755114a..0000000 --- a/0002-fix-ukui-screensaver-dialog-lock.patch +++ /dev/null @@ -1,26 +0,0 @@ -From 39459bf543d45644426885ae98641fa26ea0ab55 Mon Sep 17 00:00:00 2001 -From: lvhan -Date: Wed, 13 Jan 2021 14:31:46 +0800 -Subject: [PATCH] fix-ukui-screensaver-dialog--lock - ---- - src/ukui-screensaver-dialog.cpp | 3 ++- - 1 file changed, 2 insertions(+), 1 deletion(-) - -diff --git a/src/ukui-screensaver-dialog.cpp b/src/ukui-screensaver-dialog.cpp -index 2baad4b..237b377 100644 ---- a/src/ukui-screensaver-dialog.cpp -+++ b/src/ukui-screensaver-dialog.cpp -@@ -174,7 +174,8 @@ int main(int argc, char *argv[]) - - if(parser.isSet(lockOption)) - { -- window->lock(); -+ // window->lock(); -+ window->onScreensaver(); - } - - if(parser.isSet(sessionIdleOption)) --- -2.29.2.windows.2 - diff --git a/0003-Fix-a-return-type-error.patch b/0003-Fix-a-return-type-error.patch deleted file mode 100644 index ff97d17..0000000 --- a/0003-Fix-a-return-type-error.patch +++ /dev/null @@ -1,24 +0,0 @@ -From 2c1aad754aa7b1923c5d2e3805f9352a0dd79a82 Mon Sep 17 00:00:00 2001 -From: tanyulong -Date: Thu, 28 Oct 2021 17:07:08 +0800 -Subject: [PATCH] Fix a return type error - ---- - src/screensaver.cpp | 1 + - 1 file changed, 1 insertion(+) - -diff --git a/src/screensaver.cpp b/src/screensaver.cpp -index 601b325..8e35ab1 100755 ---- a/src/screensaver.cpp -+++ b/src/screensaver.cpp -@@ -63,6 +63,7 @@ bool ScreenSaver::exists() - case SAVER_IMAGE: - return QDir(path).exists(); - } -+ return false; - } - - void ScreenSaver::startSwitchImages() --- -2.30.0 - diff --git a/0004-remove-in-debian-copyright-file.patch b/0004-remove-in-debian-copyright-file.patch deleted file mode 100644 index b4d9ff9..0000000 --- a/0004-remove-in-debian-copyright-file.patch +++ /dev/null @@ -1,24 +0,0 @@ -From 47cd0361ea8f29ad2a92ad280f1882087af3e547 Mon Sep 17 00:00:00 2001 -From: tanyulong -Date: Fri, 29 Oct 2021 11:04:43 +0800 -Subject: [PATCH] remove in debian copyright file - ---- - debian/copyright | 1 - - 1 file changed, 1 deletion(-) - -diff --git a/debian/copyright b/debian/copyright -index 9920bbb..a79795b 100755 ---- a/debian/copyright -+++ b/debian/copyright -@@ -10,7 +10,6 @@ Files: CMakeLists.txt - debian/* - screensaver/* - Common/* -- .gitmodules - Copyright: 2018, Tianjin KYLIN Information Technology Co., Ltd. - License: GPL-3+ - --- -2.30.0 - diff --git a/0005-Add-sentence-author-info.patch b/0005-Add-sentence-author-info.patch deleted file mode 100644 index 4de2685..0000000 --- a/0005-Add-sentence-author-info.patch +++ /dev/null @@ -1,25 +0,0 @@ -From a8eb0d69feedb02693b711348a7aaa25ff3961b6 Mon Sep 17 00:00:00 2001 -From: tanyulong -Date: Sat, 30 Oct 2021 14:24:31 +0800 -Subject: [PATCH] Add sentence author info - ---- - screensaver/language/screensaver-zh_CN.ini | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/screensaver/language/screensaver-zh_CN.ini b/screensaver/language/screensaver-zh_CN.ini -index 7c4a442..0b1b594 100755 ---- a/screensaver/language/screensaver-zh_CN.ini -+++ b/screensaver/language/screensaver-zh_CN.ini -@@ -136,7 +136,7 @@ OL=我将永远忠于自己,披星戴月的奔向理想与自由。 - author=佚名 - [41] - OL=有一天,我看了43次日落! --author=佚名 -+author=《小王子》 - [42] - OL=当太阳升到最高点的时候,影子就不见了。 - author=佚名 --- -2.30.0 - diff --git a/0007-screen-saver-mode-is-set-to-single-and-the-problem-of-segfault.patch b/0007-screen-saver-mode-is-set-to-single-and-the-problem-of-segfault.patch deleted file mode 100644 index 1ff4090..0000000 --- a/0007-screen-saver-mode-is-set-to-single-and-the-problem-of-segfault.patch +++ /dev/null @@ -1,28 +0,0 @@ -From 53c17d4f9cf4a85f662b2ebdbb97610cb91ed237 Mon Sep 17 00:00:00 2001 -From: tanyulong -Date: Mon, 1 Nov 2021 11:08:30 +0800 -Subject: [PATCH] screen saver mode is set to single and the problem of - segfault - ---- - src/configuration.cpp | 4 ++++ - 1 file changed, 4 insertions(+) - -diff --git a/src/configuration.cpp b/src/configuration.cpp -index 6590172..f67f844 100755 ---- a/src/configuration.cpp -+++ b/src/configuration.cpp -@@ -141,6 +141,10 @@ ScreenSaver *Configuration::getScreensaver() - break; - } - case SAVER_SINGLE: -+ if(themes.count()==0){ -+ saver->path = "/usr/lib/ukui-screensaver/ukui-screensaver-default"; -+ break; -+ } - saver->path = getXScreensaverPath(themes[0]); - break; - case SAVER_IMAGE: --- -2.30.0 - diff --git a/0008-Screen-saver-add-x11-attribute.patch b/0008-Screen-saver-add-x11-attribute.patch deleted file mode 100644 index 87cbb31..0000000 --- a/0008-Screen-saver-add-x11-attribute.patch +++ /dev/null @@ -1,48 +0,0 @@ -From 3ff7cce8755475f9a458cabf9bfacafb2f587225 Mon Sep 17 00:00:00 2001 -From: tanyulong -Date: Tue, 2 Nov 2021 14:52:58 +0800 -Subject: [PATCH] Screen saver add x11 attribute - ---- - screensaver/screensaver.cpp | 1 + - src/screensaverwidget.cpp | 11 ++++++++--- - 2 files changed, 9 insertions(+), 3 deletions(-) - -diff --git a/screensaver/screensaver.cpp b/screensaver/screensaver.cpp -index f722c8f..1739afd 100755 ---- a/screensaver/screensaver.cpp -+++ b/screensaver/screensaver.cpp -@@ -57,6 +57,7 @@ Screensaver::Screensaver(QWidget *parent): - m_timer(nullptr) - { - installEventFilter(this); -+ setWindowFlags(Qt::X11BypassWindowManagerHint); - setUpdateCenterWidget(); - initUI(); - m_background = new MBackground(); -diff --git a/src/screensaverwidget.cpp b/src/screensaverwidget.cpp -index 8f9efd3..d691786 100755 ---- a/src/screensaverwidget.cpp -+++ b/src/screensaverwidget.cpp -@@ -37,10 +37,15 @@ ScreenSaverWidget::ScreenSaverWidget(ScreenSaver *screensaver, QWidget *parent) - setFocus(); - this->installEventFilter(this); - -- QPalette plt; -- plt.setBrush(QPalette::Window, Qt::black); -- setPalette(plt); -+ //QPalette plt; -+ //plt.setBrush(QPalette::Window, Qt::black); -+ //setPalette(plt); -+ QPalette pal(palette()); -+ pal.setColor(QPalette::Background, Qt::black); //设置背景黑色 -+ - setAutoFillBackground(true); -+ setPalette(pal); -+ - switch(screensaver->mode) { - case SAVER_RANDOM: - case SAVER_SINGLE: --- -2.30.0 - diff --git a/0009-only-one-user-the-switch-user-button-is-not-displayed.patch b/0009-only-one-user-the-switch-user-button-is-not-displayed.patch deleted file mode 100644 index ba7b9a1..0000000 --- a/0009-only-one-user-the-switch-user-button-is-not-displayed.patch +++ /dev/null @@ -1,27 +0,0 @@ -From 1e26460fc8b4cd856feade5711004f5d85391f2c Mon Sep 17 00:00:00 2001 -From: tanyulong -Date: Fri, 5 Nov 2021 14:25:30 +0800 -Subject: [PATCH] only one user the switch user button is not displayed - ---- - src/lockwidget.cpp | 4 ++++ - 1 file changed, 4 insertions(+) - -diff --git a/src/lockwidget.cpp b/src/lockwidget.cpp -index 9a62ef7..0b75b6d 100755 ---- a/src/lockwidget.cpp -+++ b/src/lockwidget.cpp -@@ -52,6 +52,10 @@ LockWidget::LockWidget(QWidget *parent) - authDialog, &AuthDialog::onCapsLockChanged); - this->installEventFilter(this); - initUI(); -+ -+ if(users->getUsers().count() < 2){ -+ ui->btnSwitchUser->hide(); -+ } - } - - LockWidget::~LockWidget() --- -2.30.0 - diff --git a/0010-Add-opencv-compilation-dependency.patch b/0010-Add-opencv-compilation-dependency.patch deleted file mode 100644 index fd57cf5..0000000 --- a/0010-Add-opencv-compilation-dependency.patch +++ /dev/null @@ -1,24 +0,0 @@ -From 92a02f6bbe9305a18f9a918697a43194ad2bbe90 Mon Sep 17 00:00:00 2001 -From: tanyulong -Date: Wed, 10 Nov 2021 09:57:29 +0800 -Subject: [PATCH] Add opencv compilation dependency - ---- - debian/control | 1 + - 1 file changed, 1 insertion(+) - -diff --git a/debian/control b/debian/control -index cdfa10f..1cd8543 100755 ---- a/debian/control -+++ b/debian/control -@@ -12,6 +12,7 @@ Build-Depends: debhelper-compat (= 12), - qttools5-dev, - qttools5-dev-tools, - libglib2.0-dev, -+ libopencv-dev, - libx11-dev, - libxtst-dev, - libgsettings-qt-dev --- -2.30.0 - diff --git a/0011-Add-gitattriutes-files.patch b/0011-Add-gitattriutes-files.patch deleted file mode 100644 index ac6141f..0000000 --- a/0011-Add-gitattriutes-files.patch +++ /dev/null @@ -1,22 +0,0 @@ -From 47f5cde3cd8392153b10f6565c7da0c69547603c Mon Sep 17 00:00:00 2001 -From: tanyulong -Date: Thu, 2 Dec 2021 11:34:30 +0800 -Subject: [PATCH] Add gitattriutes files - ---- - .gitattributes | 3 +++ - 1 file changed, 3 insertions(+) - create mode 100644 .gitattributes - -diff --git a/.gitattributes b/.gitattributes -new file mode 100644 -index 0000000..df0353f ---- /dev/null -+++ b/.gitattributes -@@ -0,0 +1,3 @@ -+debian/changelog -+debian/compat -+debian/source/format --- -2.30.0 - diff --git a/0012-add-build-requires-packages.patch b/0012-add-build-requires-packages.patch deleted file mode 100644 index 1e7780a..0000000 --- a/0012-add-build-requires-packages.patch +++ /dev/null @@ -1,27 +0,0 @@ -From 252361725d993924eac3f86989eb8250ad03d534 Mon Sep 17 00:00:00 2001 -From: tanyulong -Date: Fri, 3 Dec 2021 09:59:53 +0800 -Subject: [PATCH] add build requires packages - ---- - debian/control | 4 +++- - 1 file changed, 3 insertions(+), 1 deletion(-) - -diff --git a/debian/control b/debian/control -index 1cd8543..d5fcc83 100755 ---- a/debian/control -+++ b/debian/control -@@ -15,7 +15,9 @@ Build-Depends: debhelper-compat (= 12), - libopencv-dev, - libx11-dev, - libxtst-dev, -- libgsettings-qt-dev -+ libgsettings-qt-dev, -+ libkf5windowsystem-dev, -+ libmatemixer-dev - Standards-Version: 4.5.0 - Rules-Requires-Root: no - Homepage: https://www.github.com/ukui/ukui-screensaver --- -2.30.0 - diff --git a/0013-Update-package-version.patch b/0013-Update-package-version.patch deleted file mode 100644 index 98fc0d9..0000000 --- a/0013-Update-package-version.patch +++ /dev/null @@ -1,32 +0,0 @@ -From e2bc456fa7ab55d67e851aef35c34b39617412ca Mon Sep 17 00:00:00 2001 -From: tanyulong -Date: Tue, 7 Dec 2021 14:47:14 +0800 -Subject: [PATCH] Update package version - ---- - debian/changelog | 12 ++++++++++++ - 1 file changed, 12 insertions(+) - -diff --git a/debian/changelog b/debian/changelog -index 146b2b5..843e20c 100755 ---- a/debian/changelog -+++ b/debian/changelog -@@ -1,3 +1,15 @@ -+ukui-screensaver (3.0.2-1~0804) unstable; urgency=medium -+ -+ * New upstream release. -+ -+ -- handsome_feng Thu, 05 Aug 2021 14:22:40+0800 -+ -+ukui-screensaver (3.0.1-1) unstable; urgency=medium -+ -+ * New upstream bugfix release. -+ -+ -- handsome_feng Sun, 27 Sep 2020 14:47:09 +0800 -+ - ukui-screensaver (3.0.0-1+1031) focal; urgency=medium - - * Daily build. --- -2.30.0 - diff --git a/fix-root-can-not-input-passwd-bug.patch b/fix-root-can-not-input-passwd-bug.patch deleted file mode 100644 index 0042249..0000000 --- a/fix-root-can-not-input-passwd-bug.patch +++ /dev/null @@ -1,32 +0,0 @@ -From 6740159fcdaa0276824fbac93501c4fd79b23d03 Mon Sep 17 00:00:00 2001 -From: huayadong -Date: Thu, 9 Dec 2021 18:01:43 +0800 -Subject: [PATCH] fix root can not input passwd bug - ---- - data/ukui-screensaver-qt | 14 ++++---------- - 1 file changed, 4 insertions(+), 10 deletions(-) - -diff --git a/data/ukui-screensaver-qt b/data/ukui-screensaver-qt -index 6af045a..25d81df 100755 ---- a/data/ukui-screensaver-qt -+++ b/data/ukui-screensaver-qt -@@ -1,11 +1,5 @@ --@include common-auth --auth optional pam_gnome_keyring.so -+auth include system-auth -+account include system-auth -+password include system-auth -+session include system-auth - -- --#If you are using Arch,comment out the --#above and use the following. -- --#auth include system-auth --#account include system-auth --#password include system-auth --#session include system-auth --- -2.30.0 - diff --git a/fix-root-user-had-not-face-icon.patch b/fix-root-user-had-not-face-icon.patch deleted file mode 100644 index afbfb84..0000000 --- a/fix-root-user-had-not-face-icon.patch +++ /dev/null @@ -1,1153 +0,0 @@ -From 9234037bda8171712106b3dd920c1040aaf4b678 Mon Sep 17 00:00:00 2001 -From: huayadong -Date: Thu, 9 Dec 2021 17:44:44 +0800 -Subject: [PATCH] sssss - ---- - data/org.ukui.screensaver.gschema.xml | 2 +- - data/ukui-screensaver-qt | 15 +- - debian/changelog | 18 -- - debian/control | 5 +- - debian/copyright | 1 + - debian/source/format | 2 +- - screensaver/language/screensaver-zh_CN.ini | 4 +- - screensaver/screensaver.cpp | 2 +- - screensaver/sleeptime.cpp | 6 +- - screensaver/sleeptime.h | 1 + - src/CMakeLists.txt | 14 +- - src/authdialog.cpp | 7 +- - src/authdialog.h | 3 +- - src/configuration.cpp | 4 - - src/fullbackgroundwidget.cpp | 21 +- - src/interface.cpp | 99 +------ - src/interface.h | 9 - - src/lockwidget.cpp | 14 +- - src/lockwidget.h | 1 - - src/org.ukui.ScreenSaver.xml | 2 - - src/pam-tally.c | 323 +++++++++++++++++++++ - src/pam-tally.h | 54 ++-- - src/screensaver.cpp | 1 - - src/screensaverwidget.cpp | 11 +- - src/ukui-screensaver-backend.cpp | 19 ++ - src/ukui-screensaver-dialog.cpp | 6 +- - 26 files changed, 423 insertions(+), 221 deletions(-) - create mode 100644 src/pam-tally.c - -diff --git a/data/org.ukui.screensaver.gschema.xml b/data/org.ukui.screensaver.gschema.xml -index daf72b7..1fd0c86 100755 ---- a/data/org.ukui.screensaver.gschema.xml -+++ b/data/org.ukui.screensaver.gschema.xml -@@ -99,7 +99,7 @@ - Allow the session status message to be displayed when the screen is locked. - - -- '/usr/share/backgrounds/warty-final-ubuntukylin.jpg' -+ '' - the background iamge of lockscreen - Allow the user to set the background iamge of lockscreen. - -diff --git a/data/ukui-screensaver-qt b/data/ukui-screensaver-qt -index ae19643..6af045a 100755 ---- a/data/ukui-screensaver-qt -+++ b/data/ukui-screensaver-qt -@@ -1,4 +1,11 @@ --auth include system-auth --account include system-auth --password include system-auth --session include system-auth -\ No newline at end of file -+@include common-auth -+auth optional pam_gnome_keyring.so -+ -+ -+#If you are using Arch,comment out the -+#above and use the following. -+ -+#auth include system-auth -+#account include system-auth -+#password include system-auth -+#session include system-auth -diff --git a/debian/changelog b/debian/changelog -index 843e20c..60f2269 100755 ---- a/debian/changelog -+++ b/debian/changelog -@@ -1,21 +1,3 @@ --ukui-screensaver (3.0.2-1~0804) unstable; urgency=medium -- -- * New upstream release. -- -- -- handsome_feng Thu, 05 Aug 2021 14:22:40+0800 -- --ukui-screensaver (3.0.1-1) unstable; urgency=medium -- -- * New upstream bugfix release. -- -- -- handsome_feng Sun, 27 Sep 2020 14:47:09 +0800 -- --ukui-screensaver (3.0.0-1+1031) focal; urgency=medium -- -- * Daily build. -- -- -- liuliang Mon, 27 May 2019 15:48:18 +0800 -- - ukui-screensaver (3.0.0-1) unstable; urgency=medium - - * New upstream release. -diff --git a/debian/control b/debian/control -index d5fcc83..cdfa10f 100755 ---- a/debian/control -+++ b/debian/control -@@ -12,12 +12,9 @@ Build-Depends: debhelper-compat (= 12), - qttools5-dev, - qttools5-dev-tools, - libglib2.0-dev, -- libopencv-dev, - libx11-dev, - libxtst-dev, -- libgsettings-qt-dev, -- libkf5windowsystem-dev, -- libmatemixer-dev -+ libgsettings-qt-dev - Standards-Version: 4.5.0 - Rules-Requires-Root: no - Homepage: https://www.github.com/ukui/ukui-screensaver -diff --git a/debian/copyright b/debian/copyright -index a79795b..9920bbb 100755 ---- a/debian/copyright -+++ b/debian/copyright -@@ -10,6 +10,7 @@ Files: CMakeLists.txt - debian/* - screensaver/* - Common/* -+ .gitmodules - Copyright: 2018, Tianjin KYLIN Information Technology Co., Ltd. - License: GPL-3+ - -diff --git a/debian/source/format b/debian/source/format -index 89ae9db..163aaf8 100755 ---- a/debian/source/format -+++ b/debian/source/format -@@ -1 +1 @@ --3.0 (native) -+3.0 (quilt) -diff --git a/screensaver/language/screensaver-zh_CN.ini b/screensaver/language/screensaver-zh_CN.ini -index 0b1b594..aefa4d5 100755 ---- a/screensaver/language/screensaver-zh_CN.ini -+++ b/screensaver/language/screensaver-zh_CN.ini -@@ -136,13 +136,13 @@ OL=我将永远忠于自己,披星戴月的奔向理想与自由。 - author=佚名 - [41] - OL=有一天,我看了43次日落! --author=《小王子》 -+author=佚名 - [42] - OL=当太阳升到最高点的时候,影子就不见了。 - author=佚名 - [43] - OL=拯救地球好累,虽然有些疲惫但我还是会。 --author=《超人不会飞》 -+author=佚名 - [44] - OL=陌上花开,可缓缓归矣 - author=佚名 -diff --git a/screensaver/screensaver.cpp b/screensaver/screensaver.cpp -index 1739afd..5a7deaa 100755 ---- a/screensaver/screensaver.cpp -+++ b/screensaver/screensaver.cpp -@@ -57,7 +57,6 @@ Screensaver::Screensaver(QWidget *parent): - m_timer(nullptr) - { - installEventFilter(this); -- setWindowFlags(Qt::X11BypassWindowManagerHint); - setUpdateCenterWidget(); - initUI(); - m_background = new MBackground(); -@@ -408,6 +407,7 @@ void Screensaver::setSleeptime() - { - sleepTime = new SleepTime(this); - sleepTime->adjustSize(); -+ sleepTime->setInitTime(QDateTime::currentDateTime()); - updateDate(); - } - -diff --git a/screensaver/sleeptime.cpp b/screensaver/sleeptime.cpp -index cc92fa4..2cf1f63 100755 ---- a/screensaver/sleeptime.cpp -+++ b/screensaver/sleeptime.cpp -@@ -74,7 +74,11 @@ void SleepTime::init() - - layout->addWidget(restTime); - -- initTime = QDateTime::currentDateTime(); -+} -+ -+int SleepTime::setInitTime(QDateTime time) -+{ -+ initTime = time; - } - - int SleepTime::setTime(QDateTime time) -diff --git a/screensaver/sleeptime.h b/screensaver/sleeptime.h -index 7ed618a..5bc6d7a 100755 ---- a/screensaver/sleeptime.h -+++ b/screensaver/sleeptime.h -@@ -33,6 +33,7 @@ public: - explicit SleepTime(QWidget *parent = nullptr); - ~SleepTime(); - int setTime(QDateTime time); -+ int setInitTime(QDateTime time); - - private: - QLabel *restTime; -diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt -index 5f2e32c..62bb23e 100755 ---- a/src/CMakeLists.txt -+++ b/src/CMakeLists.txt -@@ -37,6 +37,7 @@ qt5_add_resources(dialog_SRC - - # 头文件中包含了Xlib.h,需要单独拿出来处理,不知道原因 - qt5_wrap_cpp(dialog_SRC -+ pam-tally.h - fullbackgroundwidget.h - lockwidget.h - authdialog.h -@@ -47,16 +48,16 @@ qt5_wrap_cpp(dialog_SRC - xeventmonitor.h - monitorwatcher.h - configuration.h -- users.h -- displaymanager.h -+ users.h -+ displaymanager.h - iconedit.h - powermanager.h -- logind.h -- pam-tally.h -+ logind.h - ) - - set(dialog_SRC - ${dialog_SRC} -+ pam-tally.c - ukui-screensaver-dialog.cpp - fullbackgroundwidget.cpp - lockwidget.cpp -@@ -72,8 +73,7 @@ set(dialog_SRC - users.cpp - displaymanager.cpp - iconedit.cpp -- logind.cpp -- pam-tally.cpp -+ logind.cpp - ) - add_executable(ukui-screensaver-dialog ${dialog_SRC}) - -@@ -83,7 +83,7 @@ target_link_libraries(ukui-screensaver-dialog - Qt5::DBus - Qt5::X11Extras - ${EXTRA_LIBS} -- BiometricAuth -+ BiometricAuth - VirtualKeyboard - Common - ) -diff --git a/src/authdialog.cpp b/src/authdialog.cpp -index d94f775..bf25009 100755 ---- a/src/authdialog.cpp -+++ b/src/authdialog.cpp -@@ -31,7 +31,6 @@ - #include "biometricproxy.h" - #include "biometricauthwidget.h" - #include "biometricdeviceswidget.h" --#include "pam-tally.h" - - AuthDialog::AuthDialog(const UserItem &user, QWidget *parent) : - QWidget(parent), -@@ -42,11 +41,12 @@ AuthDialog::AuthDialog(const UserItem &user, QWidget *parent) : - m_biometricProxy(nullptr), - m_biometricAuthWidget(nullptr), - m_biometricDevicesWidget(nullptr), -- pamTally(PamTally::instance(this)), - m_buttonsWidget(nullptr) - { - initUI(); - -+ pam_tally_init(); -+ - connect(auth, &Auth::showMessage, this, &AuthDialog::onShowMessage); - connect(auth, &Auth::showPrompt, this, &AuthDialog::onShowPrompt); - connect(auth, &Auth::authenticateComplete, this, &AuthDialog::onAuthComplete); -@@ -251,8 +251,7 @@ void AuthDialog::onAuthComplete() - } - else - { -- if(pamTally->getDeny() == 0) -- onShowMessage(tr("Password Incorrect, Please try again"), -+ onShowMessage(tr("Password Incorrect, Please try again"), - Auth::MessageTypeError); - //认证失败,重新认证 - -diff --git a/src/authdialog.h b/src/authdialog.h -index 6572152..837c6dd 100755 ---- a/src/authdialog.h -+++ b/src/authdialog.h -@@ -27,6 +27,7 @@ - #include "types.h" - #include "users.h" - #include "biometricdeviceinfo.h" -+#include "pam-tally.h" - - - namespace Ui { -@@ -40,7 +41,6 @@ class Auth; - class BiometricProxy; - class BiometricAuthWidget; - class BiometricDevicesWidget; --class PamTally; - - extern float scale; - class AuthDialog : public QWidget -@@ -129,7 +129,6 @@ private: - QWidget *m_passwdWidget; //放置密码输入框和信息列表 - IconEdit *m_passwordEdit; //密码输入框 - QLabel *m_messageLabel; //PAM消息显示 -- PamTally *pamTally; - }; - - #endif // AUTHDIALOG_H -diff --git a/src/configuration.cpp b/src/configuration.cpp -index f67f844..6590172 100755 ---- a/src/configuration.cpp -+++ b/src/configuration.cpp -@@ -141,10 +141,6 @@ ScreenSaver *Configuration::getScreensaver() - break; - } - case SAVER_SINGLE: -- if(themes.count()==0){ -- saver->path = "/usr/lib/ukui-screensaver/ukui-screensaver-default"; -- break; -- } - saver->path = getXScreensaverPath(themes[0]); - break; - case SAVER_IMAGE: -diff --git a/src/fullbackgroundwidget.cpp b/src/fullbackgroundwidget.cpp -index d7bccb5..46795d0 100755 ---- a/src/fullbackgroundwidget.cpp -+++ b/src/fullbackgroundwidget.cpp -@@ -165,7 +165,7 @@ FullBackgroundWidget::FullBackgroundWidget(QWidget *parent) - - init(); - qApp->installNativeEventFilter(this); -- installEventFilter(this); -+ - QTimer::singleShot(500,this,SLOT(switchToLinux())); - } - -@@ -213,7 +213,7 @@ bool FullBackgroundWidget::eventFilter(QObject *obj, QEvent *event) - if(event->type() == QEvent::WindowDeactivate){ - QTimer::singleShot(50,this,SLOT(laterActivate())); - }else if(event->type() == QEvent::WindowActivate){ -- QTimer::singleShot(200,this,SLOT(setLockState())); -+ QTimer::singleShot(500,this,SLOT(setLockState())); - } - return false; - } -@@ -516,10 +516,7 @@ void FullBackgroundWidget::onGlobalButtonDrag(int xPos, int yPos) - ScreenSaver *saver = configuration->getScreensaver(); - if(saver->path == "/usr/lib/ukui-screensaver/ukui-screensaver-default") - return ; -- if(screenStatus & SCREEN_SAVER) -- { -- clearScreensavers(); -- } -+ clearScreensavers(); - } - } - -@@ -529,11 +526,8 @@ void FullBackgroundWidget::onScreenCountChanged(int) - QSize newSize = monitorWatcher->getVirtualSize(); - setGeometry(0, 0, newSize.width(), newSize.height()); - //repaint(); -- if(screenStatus & SCREEN_SAVER) -- { -- clearScreensavers(); -- } - update(); -+ clearScreensavers(); - } - - void FullBackgroundWidget::onDesktopResized() -@@ -542,11 +536,8 @@ void FullBackgroundWidget::onDesktopResized() - setGeometry(desktop->geometry()); - if(lockWidget) - onCursorMoved(cursor().pos()); -- if(screenStatus & SCREEN_SAVER) -- { -- clearScreensavers(); -- } -- //repaint(); -+// clearScreensavers(); -+ //repaint(); - update(); - - } -diff --git a/src/interface.cpp b/src/interface.cpp -index 37de99b..5801ec9 100755 ---- a/src/interface.cpp -+++ b/src/interface.cpp -@@ -19,16 +19,11 @@ - #include - #include - #include --#include --#include - #include --#include - #include - - Interface::Interface(QObject *parent) -- : QObject(parent), -- m_timerCount(0), -- m_timer(nullptr) -+ : QObject(parent) - { - lockState = false; - m_logind = new LogindIntegration(this); -@@ -43,13 +38,6 @@ Interface::Interface(QObject *parent) - } - ); - -- QDBusInterface *iface = new QDBusInterface("org.freedesktop.login1", -- "/org/freedesktop/login1", -- "org.freedesktop.login1.Manager", -- QDBusConnection::systemBus(), -- this); -- connect(iface, SIGNAL(PrepareForSleep(bool)), this, SLOT(onPrepareForSleep(bool))); -- inhibit(); - } - - bool Interface::GetLockState() -@@ -62,52 +50,37 @@ void Interface::SetLockState() - lockState = true; - } - --void Interface::emitLockState() --{ -- QDBusMessage message = QDBusMessage::createSignal(SS_DBUS_PATH, -- SS_DBUS_INTERFACE, -- "lock"); -- QDBusConnection::sessionBus().send(message); --} -- - void Interface::Lock() - { -- if(process.state() != QProcess::NotRunning) -- return ; - qDebug() << "Lock requested"; - lockState = false; - QString cmd = QString("/usr/bin/ukui-screensaver-dialog --lock"); - qDebug() << cmd; - - process.start(cmd); -- emitLockState(); -+ - } - - void Interface::onSessionIdleReceived() - { -- if(process.state() != QProcess::NotRunning) -- return ; -- - qDebug() << "emit SessionIdle"; - lockState = false; - QString cmd = QString("/usr/bin/ukui-screensaver-dialog --session-idle"); - qDebug() << cmd; -+ - process.start(cmd); -- emitLockState(); -+ - } - - void Interface::onShowScreensaver() - { -- if(process.state() != QProcess::NotRunning) -- return ; -- - qDebug() << "lock and show screensaver"; - lockState = false; - QString cmd = QString("/usr/bin/ukui-screensaver-dialog --screensaver"); - qDebug() << cmd; - - process.start(cmd); -- emitLockState(); -+ - } - - bool Interface::checkExistChild() -@@ -136,65 +109,3 @@ void Interface::onNameLost(const QString &serviceName) - if(serviceName == "cn.kylinos.ScreenSaver") - exit(0); - } -- --void Interface::onPrepareForSleep(bool sleep) --{ -- -- if(sleep) -- { -- if(GetLockState()){ -- uninhibit(); -- return; -- } -- -- this->Lock(); -- -- if(!m_timer){ -- m_timer = new QTimer(this); -- connect(m_timer, &QTimer::timeout, this, [&]{ -- m_timerCount+=1; -- -- if(GetLockState() || m_timerCount>20){ -- m_timer->stop(); -- m_timerCount = 0; -- uninhibit(); -- } -- }); -- } -- m_timer->start(100); -- } -- else -- { -- inhibit(); -- } --} -- --void Interface::inhibit() --{ -- if (m_inhibitFileDescriptor.isValid()) { -- return; -- } -- -- QDBusMessage message = QDBusMessage::createMethodCall("org.freedesktop.login1", -- "/org/freedesktop/login1", -- "org.freedesktop.login1.Manager", -- QStringLiteral("Inhibit")); -- message.setArguments(QVariantList({QStringLiteral("sleep"), -- "Screen Locker Backend", -- "Ensuring that the screen gets locked before going to sleep", -- QStringLiteral("delay")})); -- QDBusPendingReply reply = QDBusConnection::systemBus().call(message); -- if (!reply.isValid()) { -- return; -- } -- reply.value().swap(m_inhibitFileDescriptor); --} -- --void Interface::uninhibit() --{ -- if (!m_inhibitFileDescriptor.isValid()) { -- return; -- } -- -- m_inhibitFileDescriptor = QDBusUnixFileDescriptor(); --} -diff --git a/src/interface.h b/src/interface.h -index 38209c8..f6889d9 100755 ---- a/src/interface.h -+++ b/src/interface.h -@@ -21,8 +21,6 @@ - #include - #include - #include --#include --#include - #include "types.h" - #include "logind.h" - -@@ -48,17 +46,10 @@ public Q_SLOTS: - void onSessionIdleReceived(); - void onShowScreensaver(); - void onNameLost(const QString&); -- void onPrepareForSleep(bool sleep); - - private: - bool checkExistChild(); -- void inhibit(); -- void uninhibit(); - bool lockState; -- void emitLockState(); -- int m_timerCount; -- QTimer *m_timer; -- QDBusUnixFileDescriptor m_inhibitFileDescriptor; - - private: - QProcess process; -diff --git a/src/lockwidget.cpp b/src/lockwidget.cpp -index 0b75b6d..3ab66a5 100755 ---- a/src/lockwidget.cpp -+++ b/src/lockwidget.cpp -@@ -52,10 +52,6 @@ LockWidget::LockWidget(QWidget *parent) - authDialog, &AuthDialog::onCapsLockChanged); - this->installEventFilter(this); - initUI(); -- -- if(users->getUsers().count() < 2){ -- ui->btnSwitchUser->hide(); -- } - } - - LockWidget::~LockWidget() -@@ -191,7 +187,7 @@ void LockWidget::showPowerManager() - authDialog->show(); - powermanager->hide(); - } -- else{ -+ else{ - authDialog->hide(); - powermanager->show(); - powermanager->setGeometry((width()-ITEM_WIDTH*5)/2, -@@ -282,14 +278,6 @@ void LockWidget::initUserMenu() - } - } - --void LockWidget::keyReleaseEvent(QKeyEvent *e) --{ -- if(e->key() == Qt::Key_K){ -- if(e->modifiers() & Qt::ControlModifier) -- showVirtualKeyboard(); -- } --} -- - /* lockscreen follows cursor */ - void LockWidget::resizeEvent(QResizeEvent *event) - { -diff --git a/src/lockwidget.h b/src/lockwidget.h -index 0e8d586..311b872 100755 ---- a/src/lockwidget.h -+++ b/src/lockwidget.h -@@ -69,7 +69,6 @@ private Q_SLOTS: - protected: - bool eventFilter(QObject *obj, QEvent *event); - void resizeEvent(QResizeEvent *event); -- void keyReleaseEvent(QKeyEvent *e); - - private: - Ui::LockWidget *ui; -diff --git a/src/org.ukui.ScreenSaver.xml b/src/org.ukui.ScreenSaver.xml -index 85d08c2..cd4fa9e 100755 ---- a/src/org.ukui.ScreenSaver.xml -+++ b/src/org.ukui.ScreenSaver.xml -@@ -3,8 +3,6 @@ - - - -- -- - - - -diff --git a/src/pam-tally.c b/src/pam-tally.c -new file mode 100644 -index 0000000..53bd377 ---- /dev/null -+++ b/src/pam-tally.c -@@ -0,0 +1,323 @@ -+/* -+ * Copyright (C) 2018 Tianjin KYLIN Information Technology Co., Ltd. -+ * -+ * This program is free software; you can redistribute it and/or modify -+ * it under the terms of the GNU General Public License as published by -+ * the Free Software Foundation; either version 3, or (at your option) -+ * any later version. -+ * -+ * This program is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ * GNU General Public License for more details. -+ * -+ * You should have received a copy of the GNU General Public License -+ * along with this program; if not, see . -+ * -+**/ -+ -+#include "pam-tally.h" -+ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+//#include "gs-debug.h" -+ -+char shm_tally_real[128]; -+ -+#define FILE_MODE (S_IRUSR | S_IWUSR) -+ -+#define CONFIG_FILE "/usr/share/lightdm/lightdm.conf.d/96-kylin-setting.conf" -+ -+ -+ -+static -+int get_is_open_other_authentication() -+{ -+ char buf[128]; -+ FILE *config_file; -+ -+ if( (config_file = fopen(CONFIG_FILE, "r")) == NULL) -+ { -+ //gs_debug("open %s failed", CONFIG_FILE); -+ return 0; -+ } -+ -+ int open_other_authentication = 0; -+ while(fgets(buf, sizeof(buf), config_file)) { -+ if(strlen(buf) == 0 || buf[0] == '#') -+ { -+ memset(buf, sizeof(buf), 0); -+ continue; -+ } -+ if(buf[strlen(buf)-1] == '\n') -+ buf[strlen(buf)-1] = '\0'; -+ -+ char *p = strchr(buf, '='); -+ if(!p) -+ continue; -+ *p = '\0'; -+ -+ size_t len = strlen(buf); -+ if(len == 0) -+ continue; -+ //去掉=之前的空格 -+ while(len--) -+ if(buf[len] == ' ' || buf[len] == '\t') -+ buf[len] = '\0'; -+ if(strcmp(buf, "open-other-authentication") != 0) -+ continue; -+ -+ p++; -+ len = strlen(p); -+ if(len == 0) -+ break; -+ //去掉等号之后的空格 -+ while(*p == ' ' || *p == '\t') -+ { -+ p++; -+ len--; -+ } -+ //去掉尾部空格 -+ while(len--) -+ if(*(p+len) == ' ' || *(p+len) == '\t') -+ *(p+len) = '\0'; -+ -+ if(*p == '0') -+ break; -+ if(*p == '1') -+ { -+ open_other_authentication = 1; -+ break; -+ } -+ } -+ fclose(config_file); -+ //gs_debug("--------------------------%d", open_other_authentication); -+ return open_other_authentication; -+} -+ -+static -+int get_pam_tally(int *deny, int *unlock_time) -+{ -+ char buf[128]; -+ FILE *auth_file; -+ -+ if( (auth_file = fopen("/etc/pam.d/common-auth", "r")) == NULL) -+ return -1; -+ -+ while(fgets(buf, sizeof(buf), auth_file)) { -+ if(strlen(buf) == 0 || buf[0] == '#') -+ continue; -+ if(!strstr(buf, "deny")) -+ continue; -+ -+ char *ptr = strtok(buf, " \t"); -+ while(ptr) { -+ if(strncmp(ptr, "deny=", 5)==0){ -+ sscanf(ptr, "deny=%d", deny); -+ //gs_debug("-------------------- deny=%d", *deny); -+ } -+ if(strncmp(ptr, "unlock_time=", 12)==0){ -+ sscanf(ptr, "unlock_time=%d", unlock_time); -+ //gs_debug("-------------------- unlock_time=%d", *unlock_time); -+ } -+ ptr = strtok(NULL, " \t"); -+ } -+ return 1; -+ } -+ return 0; -+} -+ -+static -+void set_shm_tally_real() -+{ -+ sprintf(shm_tally_real, "%s_%d", SHM_TALLY, getuid()); -+} -+ -+int pam_tally_init() -+{ -+ int fd; -+ int deny = 0, unlock_time = 0; -+ pam_tally *tally_ptr; -+ -+ set_shm_tally_real(); -+ -+ printf("shm path =========== : %s\n", shm_tally_real); -+ -+ shm_unlink(shm_tally_real); -+ -+ if(get_is_open_other_authentication()) -+ { -+ //gs_debug("open other authentication, disable pam_tally."); -+ return 0; -+ } -+ if(!get_pam_tally(&deny, &unlock_time)) -+ { -+ //gs_debug("get pam_tally configuration failed, disable pam_tally."); -+ return 0; -+ } -+ -+ /* if(deny <= 0) -+ deny = 3; -+ if(unlock_time <= 0) -+ unlock_time = 1800; -+*/ -+ if( (fd = shm_open(shm_tally_real, O_RDWR | O_CREAT, FILE_MODE)) == -1) -+ { -+ printf("shm_open error: %s\n", strerror(errno)); -+ return -1; -+ } -+ -+ ftruncate(fd, sizeof(pam_tally)); -+ -+ if( (tally_ptr = mmap(NULL, sizeof(pam_tally), -+ PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0)) == MAP_FAILED) -+ { -+ //gs_debug("mmap error: %s", strerror(errno)); -+ close(fd); -+ return -1; -+ } -+ close(fd); -+ -+ tally_ptr->deny = deny; -+ tally_ptr->unlock_time = unlock_time; -+ tally_ptr->failed = 0; -+ tally_ptr->lock_start_time = 0; -+ -+ return 1; -+} -+ -+static -+pam_tally* pam_tally_memory() -+{ -+ int fd; -+ pam_tally *tally_ptr; -+ -+ set_shm_tally_real(); -+ -+ if( (fd = shm_open(shm_tally_real, O_RDWR, FILE_MODE)) == -1) -+ { -+ //gs_debug("shm_open error: %s", strerror(errno)); -+ return NULL; -+ } -+ -+ if( (tally_ptr = mmap(NULL, sizeof(pam_tally), -+ PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0)) == MAP_FAILED) -+ { -+ //gs_debug("mmap error: %s", strerror(errno)); -+ close(fd); -+ return NULL; -+ } -+ close(fd); -+ return tally_ptr; -+} -+ -+int pam_tally_is_enbled() -+{ -+ int fd; -+ -+ set_shm_tally_real(); -+ -+ if( (fd = shm_open(shm_tally_real, O_RDONLY, FILE_MODE)) == -1) -+ { -+ printf("shm_open error: %s\n", strerror(errno)); -+ return 0; -+ } -+ -+ pam_tally *tally_ptr; -+ -+ if((tally_ptr = pam_tally_memory()) == NULL) -+ return -1; -+ -+ if(tally_ptr->deny == 0 || tally_ptr->unlock_time == 0) -+ return 0; -+ return 1; -+} -+ -+int pam_tally_add_failed() -+{ -+ pam_tally *tally_ptr; -+ -+ if((tally_ptr = pam_tally_memory()) == NULL) -+ return -1; -+ -+ tally_ptr->failed++; -+ -+ //如果失败次数达到上限,开始计时 -+ if(tally_ptr->failed >= tally_ptr->deny) -+ tally_ptr->lock_start_time = time(NULL); -+ -+ return 0; -+} -+ -+int pam_tally_clear_failed() -+{ -+ pam_tally *tally_ptr; -+ -+ if((tally_ptr = pam_tally_memory()) == NULL) -+ return -1; -+ -+ tally_ptr->failed = 0; -+ tally_ptr->lock_start_time = 0; -+ return 0; -+} -+ -+int pam_tally_failure_is_out() -+{ -+ pam_tally *tally_ptr; -+ -+ if((tally_ptr = pam_tally_memory()) == NULL) -+ return -1; -+ -+ return (tally_ptr->failed >= tally_ptr->deny ? 1 : 0); -+} -+ -+int pam_tally_deny() -+{ -+ pam_tally *tally_ptr; -+ -+ if((tally_ptr = pam_tally_memory()) == NULL) -+ return -1; -+ -+ return tally_ptr->deny; -+} -+ -+int pam_tally_failed_count() -+{ -+ pam_tally *tally_ptr; -+ -+ if((tally_ptr = pam_tally_memory()) == NULL) -+ return -1; -+ -+ return tally_ptr->failed; -+} -+ -+int pam_tally_unlock_time() -+{ -+ pam_tally *tally_ptr; -+ -+ if((tally_ptr = pam_tally_memory()) == NULL) -+ return -1; -+ -+ printf("########################### unlock time = %d\n", tally_ptr->unlock_time); -+ return tally_ptr->unlock_time; -+} -+ -+int pam_tally_is_canUnlock() -+{ -+ pam_tally *tally_ptr; -+ -+ if((tally_ptr = pam_tally_memory()) == NULL) -+ return -1; -+ -+ if(tally_ptr->failed >= tally_ptr->deny && -+ time(NULL) - tally_ptr->lock_start_time < tally_ptr->unlock_time) -+ return 0; -+ return 1; -+} -diff --git a/src/pam-tally.h b/src/pam-tally.h -index 07708c5..19c52d6 100755 ---- a/src/pam-tally.h -+++ b/src/pam-tally.h -@@ -1,9 +1,9 @@ --/* configuration.h -+/* - * Copyright (C) 2018 Tianjin KYLIN Information Technology Co., Ltd. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by -- * the Free Software Foundation; either version 2, or (at your option) -+ * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * This program is distributed in the hope that it will be useful, -@@ -12,34 +12,38 @@ - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License -- * along with this program; if not, write to the Free Software -- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA -- * 02110-1301, USA. -+ * along with this program; if not, see . -+ * - **/ - #ifndef PAM_TALLY_H - #define PAM_TALLY_H - --#include -- --class PamTally : public QObject --{ -- Q_OBJECT --private: -- explicit PamTally(QObject *parent = nullptr); -+#include - --public: -- static PamTally *instance(QObject *parent = nullptr); -- int getDeny(); -- unsigned long long getUnlockTime(); -- unsigned long long getRootUnlockTime(); -+#ifdef __cplusplus -+extern "C" { -+#endif - --private: -- int deny; -- unsigned long long unlock_time; -- unsigned long long root_unlock_time; -- static PamTally *instance_; -- -- int parsePamConfig(); -+#define SHM_TALLY "/shm_tally" -+struct _pam_tally { -+ int deny; //失败次数上限 -+ int unlock_time; //失败次数达到上限后,多少秒之后才能解锁 -+ int failed; //当前失败的次数 -+ time_t lock_start_time; //失败次数达到上限后,开始计时 - }; -+typedef struct _pam_tally pam_tally; -+ -+int pam_tally_init(); -+int pam_tally_add_failed(); -+int pam_tally_clear_failed(); -+int pam_tally_falure_is_out(); -+int pam_tally_deny(); -+int pam_tally_failed_count(); -+int pam_tally_unlock_time(); -+int pam_tally_is_enbled(); -+int pam_tally_is_canUnlock(); -+#ifdef __cplusplus -+} -+#endif - --#endif // CONFIGURATION_H -+#endif // PAM_TALLY_H -diff --git a/src/screensaver.cpp b/src/screensaver.cpp -index 8e35ab1..601b325 100755 ---- a/src/screensaver.cpp -+++ b/src/screensaver.cpp -@@ -63,7 +63,6 @@ bool ScreenSaver::exists() - case SAVER_IMAGE: - return QDir(path).exists(); - } -- return false; - } - - void ScreenSaver::startSwitchImages() -diff --git a/src/screensaverwidget.cpp b/src/screensaverwidget.cpp -index d691786..8f9efd3 100755 ---- a/src/screensaverwidget.cpp -+++ b/src/screensaverwidget.cpp -@@ -37,15 +37,10 @@ ScreenSaverWidget::ScreenSaverWidget(ScreenSaver *screensaver, QWidget *parent) - setFocus(); - this->installEventFilter(this); - -- //QPalette plt; -- //plt.setBrush(QPalette::Window, Qt::black); -- //setPalette(plt); -- QPalette pal(palette()); -- pal.setColor(QPalette::Background, Qt::black); //设置背景黑色 -- -+ QPalette plt; -+ plt.setBrush(QPalette::Window, Qt::black); -+ setPalette(plt); - setAutoFillBackground(true); -- setPalette(pal); -- - switch(screensaver->mode) { - case SAVER_RANDOM: - case SAVER_SINGLE: -diff --git a/src/ukui-screensaver-backend.cpp b/src/ukui-screensaver-backend.cpp -index ccf4e3a..b333fd4 100755 ---- a/src/ukui-screensaver-backend.cpp -+++ b/src/ukui-screensaver-backend.cpp -@@ -60,7 +60,25 @@ int main(int argc, char *argv[]) - exit(EXIT_FAILURE); - } - -+ // 如果已经有实例在运行则kill, 主要是针对注销后重新登录时之前的实例没有被kill掉 -+ char cmd[128] = {0}; -+ char str[16]; - FILE *fp; -+ int pid; -+ -+ int n = sprintf(cmd, "ps aux | grep ukui-screensaver-backend | grep %s | grep -v grep | awk '{print $2}'", getenv("USER")); -+ Q_UNUSED(n) -+ -+ fp = popen(cmd, "r"); -+ while(fgets(str, sizeof(str)-1, fp)) { -+ pid = atoi(str); -+ -+ if(pid > 0 && pid != getpid()) { -+ qDebug() << "existing instance pid: " << pid; -+ kill(pid, SIGKILL); -+ } -+ } -+ pclose(fp); - - // for PowerManager - fp = popen("xset s 0 0", "r"); -@@ -101,5 +119,6 @@ int main(int argc, char *argv[]) - QObject::connect(checkInterface, SIGNAL(NameLost(QString)), - interface, SLOT(onNameLost(QString))); - -+ - return a.exec(); - } -diff --git a/src/ukui-screensaver-dialog.cpp b/src/ukui-screensaver-dialog.cpp -index 237b377..d78dafb 100755 ---- a/src/ukui-screensaver-dialog.cpp -+++ b/src/ukui-screensaver-dialog.cpp -@@ -78,8 +78,7 @@ void checkIsRunning() - struct flock lock; - - const QString PID_DIR = QString("/var/run/user/%1").arg(QString::number(getuid())); -- QString env = qgetenv("DISPLAY"); -- const QString PID_FILE = PID_DIR + QString("/ukui-screensaver%1.pid").arg(env); -+ const QString PID_FILE = PID_DIR + "/ukui-screensaver.pid"; - - qDebug() << PID_DIR; - QDir dir(PID_DIR); -@@ -174,8 +173,7 @@ int main(int argc, char *argv[]) - - if(parser.isSet(lockOption)) - { -- // window->lock(); -- window->onScreensaver(); -+ window->onScreensaver(); - } - - if(parser.isSet(sessionIdleOption)) --- -2.30.0 - diff --git a/ukui-screensaver-3.0.1.tar.gz b/ukui-screensaver-3.0.1.tar.gz index 6dca62d..863ea21 100644 Binary files a/ukui-screensaver-3.0.1.tar.gz and b/ukui-screensaver-3.0.1.tar.gz differ diff --git a/ukui-screensaver.spec b/ukui-screensaver.spec index d0d8479..b33e7d3 100644 --- a/ukui-screensaver.spec +++ b/ukui-screensaver.spec @@ -1,6 +1,6 @@ Name: ukui-screensaver Version: 3.0.1 -Release: 17 +Release: 18 Summary: parallels toolbox for UKUI License: GPL-3+ GPL-2+ URL: http://www.ukui.org @@ -26,23 +26,6 @@ Requires: qt5-qttools-devel Requires: gsettings-qt-devel Requires: dconf-devel -patch0: 0001-fix-icon-misplaced.patch -patch1: 0002-fix-ukui-screensaver-dialog-lock.patch -patch2: 0003-Fix-a-return-type-error.patch -patch3: 0004-remove-in-debian-copyright-file.patch -patch4: 0005-Add-sentence-author-info.patch -#patch5: 0006-Add-fractional-scaling-parameters.patch -patch6: 0007-screen-saver-mode-is-set-to-single-and-the-problem-of-segfault.patch -patch7: 0008-Screen-saver-add-x11-attribute.patch -patch8: 0009-only-one-user-the-switch-user-button-is-not-displayed.patch -patch9: 0010-Add-opencv-compilation-dependency.patch -patch10: 0011-Add-gitattriutes-files.patch -patch11: 0012-add-build-requires-packages.patch -patch12: 0013-Update-package-version.patch -patch13: fix-root-user-had-not-face-icon.patch -Patch14: fix-root-can-not-input-passwd-bug.patch -Patch15: 0001-insert-the-monitor-after-placement-and-the-screensav.patch - %description The ukui-sidebar is mainly used in the desktop operating system. It pops up from the right side of the desktop in the form of a tray, @@ -51,22 +34,6 @@ Patch15: 0001-insert-the-monitor-after-placement-and-the-screensav.patch %prep %setup -q -%patch0 -p1 -%patch1 -p1 -%patch2 -p1 -%patch3 -p1 -%patch4 -p1 -#%patch5 -p1 -%patch6 -p1 -%patch7 -p1 -%patch8 -p1 -%patch9 -p1 -%patch10 -p1 -%patch11 -p1 -%patch12 -p1 -%patch13 -p1 -%patch15 -p1 -%patch14 -p1 %build cmake . @@ -90,11 +57,14 @@ rm -rf $RPM_BUILD_ROOT %{_datadir}/desktop-directories/ukui-screensaver.directory %{_sysconfdir}/xdg/menus/ukui-screensavers.menu %{_sysconfdir}/pam.d/ukui-screensaver-qt -%{_prefix}/lib/ukui-screensaver/ukui-screensaver-default +##%{_prefix}/lib/ukui-screensaver/ukui-screensaver-default #%%{_datadir}/ukui-screensaver/screensaver.ini #%%{_datadir}/ukui-screensaver/screensaver-en.ini %changelog +* Mon Mar 28 2022 huayadong - 3.0.1-18 +- Before adding the lock screen, determine whether the lock screen has been activated, and prevent the login password box from being input when multiple lock screens are activated. + * Fri Dec 10 2021 huayadong - 3.0.1-17 - add patch15: 0001-insert-the-monitor-after-placement-and-the-screensav.patch