commit sddm for openSUSE:Factory
Hello community, here is the log from the commit of package sddm for openSUSE:Factory checked in at 2018-04-30 22:52:00 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/sddm (Old) and /work/SRC/openSUSE:Factory/.sddm.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Package is "sddm" Mon Apr 30 22:52:00 2018 rev:33 rq:601509 version:0.17.0 Changes: -------- --- /work/SRC/openSUSE:Factory/sddm/sddm.changes 2018-03-29 11:48:35.261565879 +0200 +++ /work/SRC/openSUSE:Factory/.sddm.new/sddm.changes 2018-04-30 22:52:02.943544449 +0200 @@ -1,0 +2,22 @@ +Mon Apr 23 06:55:16 UTC 2018 - fabian@ritter-vogt.de + +- Add patch to show a username input field with too many users: + * 0006-Don-t-fill-UserModel-if-theme-does-not-require-it.patch +- Backport related changes from develop branch: + * 0001-Support-for-theme-supplied-default-avatars.patch + * 0002-Remove-trailing-spaces.patch + * 0003-UserModel-optimize-filtering-out-duplicate-users-995.patch + * 0004-UserModel-fix-filtering-out-duplicate-users-998.patch + * 0005-UserModel-optimize-setting-of-default-user-icon-999.patch + +------------------------------------------------------------------- +Mon Apr 16 09:30:50 UTC 2018 - fabian@ritter-vogt.de + +- Revert previous change, had the opposite effect for some reason + +------------------------------------------------------------------- +Thu Apr 12 08:50:03 UTC 2018 - fabian@ritter-vogt.de + +- Start the X server with -keeptty (boo#1089287) + +------------------------------------------------------------------- New: ---- 0001-Support-for-theme-supplied-default-avatars.patch 0002-Remove-trailing-spaces.patch 0003-UserModel-optimize-filtering-out-duplicate-users-995.patch 0004-UserModel-fix-filtering-out-duplicate-users-998.patch 0005-UserModel-optimize-setting-of-default-user-icon-999.patch 0006-Don-t-fill-UserModel-if-theme-does-not-require-it.patch ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ sddm.spec ++++++ --- /var/tmp/diff_new_pack.aqdkjx/_old 2018-04-30 22:52:03.931508401 +0200 +++ /var/tmp/diff_new_pack.aqdkjx/_new 2018-04-30 22:52:03.935508255 +0200 @@ -32,8 +32,15 @@ Patch2: 0001-greeter-Use-Qt-command-line-parser.patch Patch3: 0001-Fix-platform-detection-for-EnableHiDPI.patch Patch4: 0001-Fix-build-with-Qt-5.10-Use-QString-instead-of-QLatin.patch +Patch5: 0001-Support-for-theme-supplied-default-avatars.patch +Patch6: 0002-Remove-trailing-spaces.patch +Patch7: 0003-UserModel-optimize-filtering-out-duplicate-users-995.patch +Patch8: 0004-UserModel-fix-filtering-out-duplicate-users-998.patch +Patch9: 0005-UserModel-optimize-setting-of-default-user-icon-999.patch # Not merged yet: https://github.com/sddm/sddm/pull/997 Patch50: 0001-Remove-suffix-for-Wayland-session.patch +# Not merged yet: https://github.com/sddm/sddm/pull/1017 +Patch51: 0006-Don-t-fill-UserModel-if-theme-does-not-require-it.patch # Patch100-?: PATCH-FIX-OPENSUSE # Use openSUSE pam config Patch100: proper_pam.diff ++++++ 0001-Support-for-theme-supplied-default-avatars.patch ++++++
From 2f079338408dfead4ba0e3e424a4d84a6bdf6019 Mon Sep 17 00:00:00 2001 From: Sogatori
Date: Sun, 4 Mar 2018 00:42:28 +0100 Subject: [PATCH 1/6] Support for theme supplied default avatars
This patch adds support for custom default avatars under $ThemeDir/themeName/faces. This will make sddm use an avatar icon that is provided by the theme and is consistent with its look. --- src/greeter/UserModel.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/greeter/UserModel.cpp b/src/greeter/UserModel.cpp index ebc1819..c790336 100644 --- a/src/greeter/UserModel.cpp +++ b/src/greeter/UserModel.cpp @@ -52,7 +52,10 @@ namespace SDDM { UserModel::UserModel(QObject *parent) : QAbstractListModel(parent), d(new UserModelPrivate()) { const QString facesDir = mainConfig.Theme.FacesDir.get(); - const QString defaultFace = QStringLiteral("file://%1/.face.icon").arg(facesDir); + const QString themeDir = mainConfig.Theme.ThemeDir.get(); + const QString currentTheme = mainConfig.Theme.Current.get(); + const QString themeDefaultFace = QStringLiteral("%1/%2/faces/.face.icon").arg(themeDir).arg(currentTheme); + const QString defaultFace = QStringLiteral("%1/.face.icon").arg(facesDir); struct passwd *current_pw; while ((current_pw = getpwent()) != nullptr) { @@ -91,7 +94,10 @@ namespace SDDM { user->needsPassword = strcmp(current_pw->pw_passwd, "") != 0; // search for face icon - user->icon = defaultFace; + if (QFile::exists(themeDefaultFace)) + user->icon = QStringLiteral("file://%1").arg(themeDefaultFace); + else + user->icon = QStringLiteral("file://%1").arg(defaultFace); // add user d->users << user; -- 2.16.2 ++++++ 0002-Remove-trailing-spaces.patch ++++++
From 719e6590f325e60e415defc9af3642dbd0183a9f Mon Sep 17 00:00:00 2001 From: Pier Luigi Fiorini
Date: Sat, 17 Mar 2018 20:02:48 +0100 Subject: [PATCH 2/6] Remove trailing spaces
--- src/greeter/UserModel.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/greeter/UserModel.cpp b/src/greeter/UserModel.cpp index c790336..fae5cfa 100644 --- a/src/greeter/UserModel.cpp +++ b/src/greeter/UserModel.cpp @@ -94,9 +94,9 @@ namespace SDDM { user->needsPassword = strcmp(current_pw->pw_passwd, "") != 0; // search for face icon - if (QFile::exists(themeDefaultFace)) + if (QFile::exists(themeDefaultFace)) user->icon = QStringLiteral("file://%1").arg(themeDefaultFace); - else + else user->icon = QStringLiteral("file://%1").arg(defaultFace); // add user -- 2.16.2 ++++++ 0003-UserModel-optimize-filtering-out-duplicate-users-995.patch ++++++
From 47f28bb0b903ae1603b8f855e77bbeb79d8e6ace Mon Sep 17 00:00:00 2001 From: Dmitry Torokhov
Date: Mon, 19 Mar 2018 19:07:12 -0700 Subject: [PATCH 3/6] UserModel: optimize filtering out duplicate users (#995)
Instead of using naive approach of trying to detect duplicates when inserting a new user into the list of users, which is O(n^2) complexity, let's filter them out after the fact, which is much more efficient on real-world data. With this change time to load user list in our environment (over 500000 account entries) is reduced from over 1 hour to about 2 seconds. --- src/greeter/UserModel.cpp | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/src/greeter/UserModel.cpp b/src/greeter/UserModel.cpp index fae5cfa..daf93c5 100644 --- a/src/greeter/UserModel.cpp +++ b/src/greeter/UserModel.cpp @@ -75,13 +75,6 @@ namespace SDDM { if (mainConfig.Users.HideShells.get().contains(QString::fromLocal8Bit(current_pw->pw_shell))) continue; - // skip duplicates - // Note: getpwent() makes no attempt to suppress duplicate information - // if multiple sources are specified in nsswitch.conf(5). - if (d->users.cend() - != std::find_if(d->users.cbegin(), d->users.cend(), [current_pw](const UserPtr & u) { return u->uid == current_pw->pw_uid; })) - continue; - // create user UserPtr user { new User() }; user->name = QString::fromLocal8Bit(current_pw->pw_name); @@ -107,6 +100,9 @@ namespace SDDM { // sort users by username std::sort(d->users.begin(), d->users.end(), [&](const UserPtr &u1, const UserPtr &u2) { return u1->name < u2->name; }); + // Remove duplicates in case we have several sources specified + // in nsswitch.conf(5). + std::unique(d->users.begin(), d->users.end(), [&](const UserPtr &u1, const UserPtr &u2) { return u1->name == u2->name; }); bool avatarsEnabled = mainConfig.Theme.EnableAvatars.get(); if (avatarsEnabled && mainConfig.Theme.EnableAvatars.isDefault()) { -- 2.16.2 ++++++ 0004-UserModel-fix-filtering-out-duplicate-users-998.patch ++++++
From 126a722a4a36cb4cc6d17714ff4b18b6657493e4 Mon Sep 17 00:00:00 2001 From: Dmitry Torokhov
Date: Wed, 21 Mar 2018 14:24:39 -0700 Subject: [PATCH 4/6] UserModel: fix filtering out duplicate users (#998)
std::unique() is "interesting": it modifies the container, rearranging elements in it, but does not reduce the size of the container, so there are invalid elements at the end that have to be erased explicitly. --- src/greeter/UserModel.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/greeter/UserModel.cpp b/src/greeter/UserModel.cpp index daf93c5..57f236d 100644 --- a/src/greeter/UserModel.cpp +++ b/src/greeter/UserModel.cpp @@ -102,7 +102,8 @@ namespace SDDM { std::sort(d->users.begin(), d->users.end(), [&](const UserPtr &u1, const UserPtr &u2) { return u1->name < u2->name; }); // Remove duplicates in case we have several sources specified // in nsswitch.conf(5). - std::unique(d->users.begin(), d->users.end(), [&](const UserPtr &u1, const UserPtr &u2) { return u1->name == u2->name; }); + auto newEnd = std::unique(d->users.begin(), d->users.end(), [&](const UserPtr &u1, const UserPtr &u2) { return u1->name == u2->name; }); + d->users.erase(newEnd, d->users.end()); bool avatarsEnabled = mainConfig.Theme.EnableAvatars.get(); if (avatarsEnabled && mainConfig.Theme.EnableAvatars.isDefault()) { -- 2.16.2 ++++++ 0005-UserModel-optimize-setting-of-default-user-icon-999.patch ++++++
From 1ea5a0a85488e425c2d1ffcf3eafa8d8b0abe0b1 Mon Sep 17 00:00:00 2001 From: Dmitry Torokhov
Date: Fri, 6 Apr 2018 19:56:14 -0700 Subject: [PATCH 5/6] UserModel: optimize setting of default user icon (#999)
Instead of checking for existence of theme-specific icon and re-creating string literals every time we add a new user to the list, do it once. It helps in large organizations with a lot of users. --- src/greeter/UserModel.cpp | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/greeter/UserModel.cpp b/src/greeter/UserModel.cpp index 57f236d..f6f4f95 100644 --- a/src/greeter/UserModel.cpp +++ b/src/greeter/UserModel.cpp @@ -56,6 +56,8 @@ namespace SDDM { const QString currentTheme = mainConfig.Theme.Current.get(); const QString themeDefaultFace = QStringLiteral("%1/%2/faces/.face.icon").arg(themeDir).arg(currentTheme); const QString defaultFace = QStringLiteral("%1/.face.icon").arg(facesDir); + const QString iconURI = QStringLiteral("file://%1").arg( + QFile::exists(themeDefaultFace) ? themeDefaultFace : defaultFace); struct passwd *current_pw; while ((current_pw = getpwent()) != nullptr) { @@ -85,12 +87,7 @@ namespace SDDM { // if shadow is used pw_passwd will be 'x' nevertheless, so this // will always be true user->needsPassword = strcmp(current_pw->pw_passwd, "") != 0; - - // search for face icon - if (QFile::exists(themeDefaultFace)) - user->icon = QStringLiteral("file://%1").arg(themeDefaultFace); - else - user->icon = QStringLiteral("file://%1").arg(defaultFace); + user->icon = iconURI; // add user d->users << user; -- 2.16.2 ++++++ 0006-Don-t-fill-UserModel-if-theme-does-not-require-it.patch ++++++
From 2dcff84bfe21c8e1c7976797c3f22b91b45f0695 Mon Sep 17 00:00:00 2001 From: Fabian Vogt
Date: Sat, 21 Apr 2018 17:40:56 +0200 Subject: [PATCH 6/6] Don't fill UserModel if theme does not require it
Certain themes switch to a username input field if there are too many users
to show. In those cases we don't need to provide a complete user model.
The last logged in user is still added (if available) to keep the index
and data valid.
To tell sddm that a theme does not need a full user model, theme.conf has to
set "General/needsFullUserModel=false".
Fixes #479
---
src/greeter/GreeterApp.cpp | 11 ++++++++++-
src/greeter/UserModel.cpp | 49 ++++++++++++++++++++++++++++++++++------------
src/greeter/UserModel.h | 4 +++-
3 files changed, 49 insertions(+), 15 deletions(-)
diff --git a/src/greeter/GreeterApp.cpp b/src/greeter/GreeterApp.cpp
index 1230efa..a9d785c 100644
--- a/src/greeter/GreeterApp.cpp
+++ b/src/greeter/GreeterApp.cpp
@@ -60,7 +60,6 @@ namespace SDDM {
// Create models
m_sessionModel = new SessionModel();
- m_userModel = new UserModel();
m_keyboard = new KeyboardModel();
}
@@ -111,6 +110,16 @@ namespace SDDM {
else
m_themeConfig = new ThemeConfig(configFile);
+ const bool themeNeedsAllUsers = m_themeConfig->value(QStringLiteral("needsFullUserModel"), true).toBool();
+ if(m_userModel && themeNeedsAllUsers && !m_userModel->containsAllUsers()) {
+ // The theme needs all users, but the current user model doesn't have them -> recreate
+ m_userModel->deleteLater();
+ m_userModel = nullptr;
+ }
+
+ if (!m_userModel)
+ m_userModel = new UserModel(themeNeedsAllUsers, nullptr);
+
// Set default icon theme from greeter theme
if (m_themeConfig->contains(QStringLiteral("iconTheme")))
QIcon::setThemeName(m_themeConfig->value(QStringLiteral("iconTheme")).toString());
diff --git a/src/greeter/UserModel.cpp b/src/greeter/UserModel.cpp
index f6f4f95..fdf2b7e 100644
--- a/src/greeter/UserModel.cpp
+++ b/src/greeter/UserModel.cpp
@@ -33,13 +33,25 @@
namespace SDDM {
class User {
public:
+ User(const struct passwd *data, const QString icon) :
+ name(QString::fromLocal8Bit(data->pw_name)),
+ realName(QString::fromLocal8Bit(data->pw_gecos).split(QLatin1Char(',')).first()),
+ homeDir(QString::fromLocal8Bit(data->pw_dir)),
+ uid(data->pw_uid),
+ gid(data->pw_gid),
+ // if shadow is used pw_passwd will be 'x' nevertheless, so this
+ // will always be true
+ needsPassword(strcmp(data->pw_passwd, "") != 0),
+ icon(icon)
+ {}
+
QString name;
QString realName;
QString homeDir;
- QString icon;
- bool needsPassword { false };
int uid { 0 };
int gid { 0 };
+ bool needsPassword { false };
+ QString icon;
};
typedef std::shared_ptr<User> UserPtr;
@@ -48,9 +60,10 @@ namespace SDDM {
public:
int lastIndex { 0 };
QList<UserPtr> users;
+ bool containsAllUsers { true };
};
- UserModel::UserModel(QObject *parent) : QAbstractListModel(parent), d(new UserModelPrivate()) {
+ UserModel::UserModel(bool needAllUsers, QObject *parent) : QAbstractListModel(parent), d(new UserModelPrivate()) {
const QString facesDir = mainConfig.Theme.FacesDir.get();
const QString themeDir = mainConfig.Theme.ThemeDir.get();
const QString currentTheme = mainConfig.Theme.Current.get();
@@ -59,6 +72,8 @@ namespace SDDM {
const QString iconURI = QStringLiteral("file://%1").arg(
QFile::exists(themeDefaultFace) ? themeDefaultFace : defaultFace);
+ bool lastUserFound = false;
+
struct passwd *current_pw;
while ((current_pw = getpwent()) != nullptr) {
@@ -78,19 +93,23 @@ namespace SDDM {
continue;
// create user
- UserPtr user { new User() };
- user->name = QString::fromLocal8Bit(current_pw->pw_name);
- user->realName = QString::fromLocal8Bit(current_pw->pw_gecos).split(QLatin1Char(',')).first();
- user->homeDir = QString::fromLocal8Bit(current_pw->pw_dir);
- user->uid = int(current_pw->pw_uid);
- user->gid = int(current_pw->pw_gid);
- // if shadow is used pw_passwd will be 'x' nevertheless, so this
- // will always be true
- user->needsPassword = strcmp(current_pw->pw_passwd, "") != 0;
- user->icon = iconURI;
+ UserPtr user { new User(current_pw, iconURI) };
// add user
d->users << user;
+
+ if (user->name == lastUser())
+ lastUserFound = true;
+
+ if (!needAllUsers && d->users.count() > mainConfig.Theme.DisableAvatarsThreshold.get()) {
+ struct passwd *lastUserData;
+ // If the theme doesn't require that all users are present, try to add the data for lastUser at least
+ if(!lastUserFound && (lastUserData = getpwnam(qPrintable(lastUser()))))
+ d->users << UserPtr(new User(lastUserData, themeDefaultFace));
+
+ d->containsAllUsers = false;
+ break;
+ }
}
endpwent();
@@ -182,4 +201,8 @@ namespace SDDM {
int UserModel::disableAvatarsThreshold() const {
return mainConfig.Theme.DisableAvatarsThreshold.get();
}
+
+ bool UserModel::containsAllUsers() const {
+ return d->containsAllUsers;
+ }
}
diff --git a/src/greeter/UserModel.h b/src/greeter/UserModel.h
index 1bbf77e..b63cf9a 100644
--- a/src/greeter/UserModel.h
+++ b/src/greeter/UserModel.h
@@ -34,6 +34,7 @@ namespace SDDM {
Q_PROPERTY(QString lastUser READ lastUser CONSTANT)
Q_PROPERTY(int count READ rowCount CONSTANT)
Q_PROPERTY(int disableAvatarsThreshold READ disableAvatarsThreshold CONSTANT)
+ Q_PROPERTY(bool containsAllUsers READ containsAllUsers CONSTANT)
public:
enum UserRoles {
NameRole = Qt::UserRole + 1,
@@ -43,7 +44,7 @@ namespace SDDM {
NeedsPasswordRole
};
- UserModel(QObject *parent = 0);
+ UserModel(bool needAllUsers, QObject *parent = 0);
~UserModel();
QHash
participants (1)
-
root@hilbert.suse.de