Hello community,

here is the log from the commit of package sddm for openSUSE:Factory checked in 
at 2018-03-20 21:42:39
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/sddm (Old)
 and      /work/SRC/openSUSE:Factory/.sddm.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "sddm"

Tue Mar 20 21:42:39 2018 rev:30 rq:585771 version:0.17.0

Changes:
--------
--- /work/SRC/openSUSE:Factory/sddm/sddm.changes        2018-03-08 
10:41:31.471844785 +0100
+++ /work/SRC/openSUSE:Factory/.sddm.new/sddm.changes   2018-03-20 
21:42:40.899871665 +0100
@@ -1,0 +2,13 @@
+Fri Mar  9 20:02:50 UTC 2018 - [email protected]
+
+- Reorder patches for easier maintainability, needs refresh of:
+  * 0001-Move-Xauthority-to-a-different-location-and-truncate.patch
+  * 0001-Read-the-DISPLAYMANAGER_AUTOLOGIN-value-from-sysconf.patch
+  * sddm-relaxed-auth.diff
+- Replace 0001-Revert-Rename-XDisplay-and-WaylandDisplay-config-sec.patch
+  with 0001-Support-both-X11-XDisplay-Wayland-and-WaylandDisplay.patch
+- Add patches to fix setting EnableHiDPI in the configuration:
+  * 0001-greeter-Use-Qt-command-line-parser.patch                              
                                                                                
                                                                                
   
+  * 0001-Fix-platform-detection-for-EnableHiDPI.patch
+
+-------------------------------------------------------------------

Old:
----
  0001-Revert-Rename-XDisplay-and-WaylandDisplay-config-sec.patch

New:
----
  0001-Fix-platform-detection-for-EnableHiDPI.patch
  0001-Support-both-X11-XDisplay-Wayland-and-WaylandDisplay.patch
  0001-greeter-Use-Qt-command-line-parser.patch

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ sddm.spec ++++++
--- /var/tmp/diff_new_pack.HjtwpZ/_old  2018-03-20 21:42:41.927834666 +0100
+++ /var/tmp/diff_new_pack.HjtwpZ/_new  2018-03-20 21:42:41.931834522 +0100
@@ -27,28 +27,26 @@
 Source1:        X11-displaymanagers-%{name}
 Source2:        00-general.conf
 Source3:        10-theme.conf
-# PATCH-FIX-OPENSUSE 
0001-Revert-Rename-XDisplay-and-WaylandDisplay-config-sec.patch -- Revert to 
0.13.0 config syntax
-Patch0:         0001-Revert-Rename-XDisplay-and-WaylandDisplay-config-sec.patch
-# PATCH-FIX-OPENSUSE proper_pam.diff -- Use openSUSE pam config
-Patch1:         proper_pam.diff
-# PATCH-FIX-OPENSUSE
-Patch2:         0001-Write-the-daemon-s-PID-to-a-file-on-startup.patch
-# PATCH-FIX-OPENSUSE sddm-relaxed-auth.diff -- Insert XAUTHLOCALHOSTNAME into 
users enviroment, so the session handles hostname changes with a single X 
instance/run
+# Patch0-100: PATCH-FIX-UPSTREAM
+Patch1:         0001-Don-t-quit-on-SIGHUP.patch
+Patch2:         0001-greeter-Use-Qt-command-line-parser.patch
+Patch3:         0001-Fix-platform-detection-for-EnableHiDPI.patch
+# Patch100-?: PATCH-FIX-OPENSUSE
+# Use openSUSE pam config
+Patch100:       proper_pam.diff
+Patch101:       0001-Write-the-daemon-s-PID-to-a-file-on-startup.patch
+# Insert XAUTHLOCALHOSTNAME into users enviroment, so the session handles 
hostname changes with a single X instance/run
 # related patches: libxcb/bug-262309_xcb-xauthlocalhostname.diff, 
xauth/xauth-tolerant-hostname-changes.diff, 
kdebase4-workspace/kdm-relaxed-auth.diff
-Patch3:         sddm-relaxed-auth.diff
-# PATCH-FIX-OPENSUSE
-Patch4:         0001-Read-the-DISPLAYMANAGER_AUTOLOGIN-value-from-sysconf.patch
-# PATCH-FIX-OPENSUSE sddm-service-handle-plymouth.patch -- sddm has some 
rudimentary support for plymouth handling, which only works with 
plymouth-quit.service
+Patch102:       sddm-relaxed-auth.diff
+Patch103:       0001-Read-the-DISPLAYMANAGER_AUTOLOGIN-value-from-sysconf.patch
+# sddm has some rudimentary support for plymouth handling, which only works 
with plymouth-quit.service
 # (the servce is not enabled on openSUSE). For users of sddm.service, we need 
to issue plymouth quit command by hand in this case
-Patch5:         sddm-service-handle-plymouth.patch
-# PATCH-FIX-UPSTREAM https://github.com/sddm/sddm/pull/987
-Patch6:         0001-Don-t-quit-on-SIGHUP.patch
-# PATCH-FIX-OPENSUSE 0001-Systemd-service-unit-Use-tty7-by-default.patch -- 
Use tty7 by default in the systemd service unit
-Patch8:         0001-Systemd-service-unit-Use-tty7-by-default.patch
-# PATCH-FIX-OPENSUSE
-Patch9:         0001-Move-Xauthority-to-a-different-location-and-truncate.patch
-# PATCH-FIX-OPENSUSE
-Patch18:        0003-Leave-duplicate-symlinks-out-of-the-SessionModel.patch
+Patch104:       sddm-service-handle-plymouth.patch
+# Use tty7 by default in the systemd service unit
+Patch105:       0001-Systemd-service-unit-Use-tty7-by-default.patch
+Patch106:       0001-Move-Xauthority-to-a-different-location-and-truncate.patch
+Patch107:       0003-Leave-duplicate-symlinks-out-of-the-SessionModel.patch
+Patch108:       0001-Support-both-X11-XDisplay-Wayland-and-WaylandDisplay.patch
 BuildRequires:  cmake
 BuildRequires:  extra-cmake-modules >= 1.4.0
 BuildRequires:  fdupes

++++++ 0001-Fix-platform-detection-for-EnableHiDPI.patch ++++++
>From 70b1059cebd0bc98d1545a7a702c1c1779286c42 Mon Sep 17 00:00:00 2001
From: Fabian Vogt <[email protected]>
Date: Thu, 8 Mar 2018 10:47:03 +0100
Subject: [PATCH] Fix platform detection for EnableHiDPI

We can't use QGuiApplication before it's constructed, so find out which
platform is requested ourselves.

Fixes #894
---
 src/greeter/GreeterApp.cpp | 20 ++++++++++++++++++--
 1 file changed, 18 insertions(+), 2 deletions(-)

diff --git a/src/greeter/GreeterApp.cpp b/src/greeter/GreeterApp.cpp
index 1230efa..5181e4e 100644
--- a/src/greeter/GreeterApp.cpp
+++ b/src/greeter/GreeterApp.cpp
@@ -278,11 +278,27 @@ int main(int argc, char **argv)
     // Install message handler
     qInstallMessageHandler(SDDM::GreeterMessageHandler);
 
+    // We set an attribute based on the platform we run on.
+    // We only know the platform after we constructed QGuiApplication
+    // though, so we need to find it out ourselves.
+    QLatin1String platform;
+    for (int i = 1; i < argc - 1; ++i) {
+        if(qstrcmp(argv[i], "-platform") == 0) {
+            platform = QLatin1String(argv[i + 1]);
+        }
+    }
+    if (platform.isEmpty()) {
+        platform = QLatin1String(qgetenv("QT_QPA_PLATFORM"));
+    }
+    if (platform.isEmpty()) {
+        platform = QLatin1String("xcb");
+    }
+
     // HiDPI
     bool hiDpiEnabled = false;
-    if (QGuiApplication::platformName() == QLatin1String("xcb"))
+    if (platform == QLatin1String("xcb"))
         hiDpiEnabled = SDDM::mainConfig.X11.EnableHiDPI.get();
-    else if 
(QGuiApplication::platformName().startsWith(QLatin1String("wayland")))
+    else if (platform.startsWith(QLatin1String("wayland")))
         hiDpiEnabled = SDDM::mainConfig.Wayland.EnableHiDPI.get();
     if (hiDpiEnabled) {
         qDebug() << "High-DPI autoscaling Enabled";
-- 
2.16.1

++++++ 0001-Move-Xauthority-to-a-different-location-and-truncate.patch ++++++
--- /var/tmp/diff_new_pack.HjtwpZ/_old  2018-03-20 21:42:41.975832938 +0100
+++ /var/tmp/diff_new_pack.HjtwpZ/_new  2018-03-20 21:42:41.975832938 +0100
@@ -19,11 +19,11 @@
  src/helper/UserSession.cpp       | 4 ++--
  4 files changed, 9 insertions(+), 6 deletions(-)
 
-Index: sddm-0.15.0/data/man/sddm.conf.rst.in
+Index: sddm-0.17.0/data/man/sddm.conf.rst.in
 ===================================================================
---- sddm-0.15.0.orig/data/man/sddm.conf.rst.in
-+++ sddm-0.15.0/data/man/sddm.conf.rst.in
-@@ -110,7 +110,7 @@ OPTIONS
+--- sddm-0.17.0.orig/data/man/sddm.conf.rst.in
++++ sddm-0.17.0/data/man/sddm.conf.rst.in
+@@ -119,7 +119,7 @@ OPTIONS
  
  `UserAuthFile=`
          Path to the Xauthority file, relative to the home directory.
@@ -32,10 +32,10 @@
  
  `DisplayCommand=`
        Path of script to execute when starting the display server.
-Index: sddm-0.15.0/src/common/Configuration.h
+Index: sddm-0.17.0/src/common/Configuration.h
 ===================================================================
---- sddm-0.15.0.orig/src/common/Configuration.h
-+++ sddm-0.15.0/src/common/Configuration.h
+--- sddm-0.17.0.orig/src/common/Configuration.h
++++ sddm-0.17.0/src/common/Configuration.h
 @@ -65,7 +65,7 @@ namespace SDDM {
              Entry(SessionDir,          QString,     
_S("/usr/share/xsessions"),                 _S("Directory containing available 
X sessions"));
              Entry(SessionCommand,      QString,     _S(SESSION_COMMAND),      
                  _S("Path to a script to execute when starting the desktop 
session"));
@@ -45,11 +45,11 @@
              Entry(DisplayCommand,      QString,     _S(DATA_INSTALL_DIR 
"/scripts/Xsetup"),     _S("Path to a script to execute when starting the 
display server"));
              Entry(DisplayStopCommand,  QString,     _S(DATA_INSTALL_DIR 
"/scripts/Xstop"),      _S("Path to a script to execute when stopping the 
display server"));
              Entry(MinimumVT,           int,         MINIMUM_VT,               
                  _S("The lowest virtual terminal number that will be used."));
-Index: sddm-0.15.0/src/daemon/XorgDisplayServer.cpp
+Index: sddm-0.17.0/src/daemon/XorgDisplayServer.cpp
 ===================================================================
---- sddm-0.15.0.orig/src/daemon/XorgDisplayServer.cpp
-+++ sddm-0.15.0/src/daemon/XorgDisplayServer.cpp
-@@ -90,9 +90,12 @@ namespace SDDM {
+--- sddm-0.17.0.orig/src/daemon/XorgDisplayServer.cpp
++++ sddm-0.17.0/src/daemon/XorgDisplayServer.cpp
+@@ -91,9 +91,12 @@ namespace SDDM {
          // log message
          qDebug() << "Adding cookie to" << file;
  
@@ -63,11 +63,11 @@
 +        file_handler.open(QIODevice::WriteOnly);
          file_handler.close();
  
-         QString cmd = QStringLiteral("%1 -f %2 
-q").arg(mainConfig.XDisplay.XauthPath.get()).arg(file);
-Index: sddm-0.15.0/src/helper/UserSession.cpp
+         QString cmd = QStringLiteral("%1 -f %2 
-q").arg(mainConfig.X11.XauthPath.get()).arg(file);
+Index: sddm-0.17.0/src/helper/UserSession.cpp
 ===================================================================
---- sddm-0.15.0.orig/src/helper/UserSession.cpp
-+++ sddm-0.15.0/src/helper/UserSession.cpp
+--- sddm-0.17.0.orig/src/helper/UserSession.cpp
++++ sddm-0.17.0/src/helper/UserSession.cpp
 @@ -174,12 +174,12 @@ namespace SDDM {
              qDebug() << "Adding cookie to" << file;
  
@@ -82,4 +82,4 @@
 +            file_handler.open(QIODevice::WriteOnly);
              file_handler.close();
  
-             QString cmd = QStringLiteral("%1 -f %2 
-q").arg(mainConfig.XDisplay.XauthPath.get()).arg(file);
+             QString cmd = QStringLiteral("%1 -f %2 
-q").arg(mainConfig.X11.XauthPath.get()).arg(file);

++++++ 0001-Read-the-DISPLAYMANAGER_AUTOLOGIN-value-from-sysconf.patch ++++++
--- /var/tmp/diff_new_pack.HjtwpZ/_old  2018-03-20 21:42:41.983832651 +0100
+++ /var/tmp/diff_new_pack.HjtwpZ/_new  2018-03-20 21:42:41.987832507 +0100
@@ -15,11 +15,11 @@
  src/daemon/Display.cpp     | 12 ++++++++++++
  4 files changed, 17 insertions(+), 2 deletions(-)
 
-diff --git a/CMakeLists.txt b/CMakeLists.txt
-index 764765e..fca2147 100644
---- a/CMakeLists.txt
-+++ b/CMakeLists.txt
-@@ -182,6 +182,7 @@ set(WAYLAND_SESSION_COMMAND     
"${DATA_INSTALL_DIR}/scripts/wayland-session"
+Index: sddm-0.17.0/CMakeLists.txt
+===================================================================
+--- sddm-0.17.0.orig/CMakeLists.txt
++++ sddm-0.17.0/CMakeLists.txt
+@@ -186,6 +186,7 @@ set(WAYLAND_SESSION_COMMAND     "${DATA_
  set(CONFIG_FILE                 "${CMAKE_INSTALL_FULL_SYSCONFDIR}/sddm.conf"  
      CACHE PATH      "Path of the sddm config file")
  set(CONFIG_DIR                  
"${CMAKE_INSTALL_FULL_SYSCONFDIR}/sddm.conf.d"      CACHE PATH      "Path of 
the sddm config directory")
  set(SYSTEM_CONFIG_DIR           
"${CMAKE_INSTALL_PREFIX}/lib/sddm/sddm.conf.d"      CACHE PATH      "Path of 
the system sddm config directory")
@@ -27,10 +27,10 @@
  set(LOG_FILE                    
"${CMAKE_INSTALL_FULL_LOCALSTATEDIR}/log/sddm.log"  CACHE PATH      "Path of 
the sddm log file")
  set(DBUS_CONFIG_FILENAME        "org.freedesktop.DisplayManager.conf"         
      CACHE STRING    "Name of the sddm config file")
  set(COMPONENTS_TRANSLATION_DIR  "${DATA_INSTALL_DIR}/translations"            
      CACHE PATH      "Components translations directory")
-diff --git a/src/common/Configuration.h b/src/common/Configuration.h
-index e6ca79e..a1ec53c 100644
---- a/src/common/Configuration.h
-+++ b/src/common/Configuration.h
+Index: sddm-0.17.0/src/common/Configuration.h
+===================================================================
+--- sddm-0.17.0.orig/src/common/Configuration.h
++++ sddm-0.17.0/src/common/Configuration.h
 @@ -94,14 +94,15 @@ namespace SDDM {
  
          Section(Autologin,
@@ -49,10 +49,10 @@
                                                                                
                     "This session will be preselected when the login screen 
appears."));
              Entry(User,            QString,     QString(),                    
                  _S("Name of the last logged-in user.\n"
                                                                                
                     "This user will be preselected when the login screen 
appears"));
-diff --git a/src/common/Constants.h.in b/src/common/Constants.h.in
-index 09b80a7..b23045c 100644
---- a/src/common/Constants.h.in
-+++ b/src/common/Constants.h.in
+Index: sddm-0.17.0/src/common/Constants.h.in
+===================================================================
+--- sddm-0.17.0.orig/src/common/Constants.h.in
++++ sddm-0.17.0/src/common/Constants.h.in
 @@ -35,6 +35,7 @@
  #define CONFIG_FILE                 "@CONFIG_FILE@"
  #define CONFIG_DIR                  "@CONFIG_DIR@"
@@ -61,10 +61,10 @@
  
  #define LOG_FILE                    "@LOG_FILE@"
  #define PID_FILE                    "@PID_FILE@"
-diff --git a/src/daemon/Display.cpp b/src/daemon/Display.cpp
-index 50961e4..485ee4b 100644
---- a/src/daemon/Display.cpp
-+++ b/src/daemon/Display.cpp
+Index: sddm-0.17.0/src/daemon/Display.cpp
+===================================================================
+--- sddm-0.17.0.orig/src/daemon/Display.cpp
++++ sddm-0.17.0/src/daemon/Display.cpp
 @@ -35,6 +35,7 @@
  #include <QDebug>
  #include <QFile>
@@ -85,6 +85,3 @@
          if ((daemonApp->first || mainConfig.Autologin.Relogin.get()) &&
              !mainConfig.Autologin.User.get().isEmpty()) {
              // reset first flag
--- 
-2.14.1
-

++++++ 0001-Support-both-X11-XDisplay-Wayland-and-WaylandDisplay.patch ++++++
>From 823c0e9daeac9a1b8a8c667f38685e1ce92dca61 Mon Sep 17 00:00:00 2001
From: Fabian Vogt <[email protected]>
Date: Fri, 9 Mar 2018 21:51:23 +0100
Subject: [PATCH] Support both [X11], [XDisplay], [Wayland] and
 [WaylandDisplay] config sections

In sddm 0.14.0, the [XDisplay] and [WaylandDisplay] sections were renamed for
no good reason. This totally breaks existing configurations, so we need to
fix that. Reverting would break forwards compat., so just alias them for now.
---
 src/common/ConfigReader.cpp | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/src/common/ConfigReader.cpp b/src/common/ConfigReader.cpp
index 4b5983c..952f8ef 100644
--- a/src/common/ConfigReader.cpp
+++ b/src/common/ConfigReader.cpp
@@ -198,6 +198,12 @@ namespace SDDM {
             // get rid of comments first
             lineRef = 
lineRef.left(lineRef.indexOf(QLatin1Char('#'))).trimmed();
 
+            // In version 0.13.0, these sections were renamed for no good 
reason...
+            if (currentSection == QStringLiteral("XDisplay"))
+                currentSection = QStringLiteral("X11");
+            else if (currentSection == QStringLiteral("WaylandDisplay"))
+                currentSection = QStringLiteral("WaylandDisplay");
+
             // value assignment
             int separatorPosition = lineRef.indexOf(QLatin1Char('='));
             if (separatorPosition >= 0) {
-- 
2.16.2

++++++ 0001-greeter-Use-Qt-command-line-parser.patch ++++++
>From 66b764abc0f7fa1562cf2b9ef4d751fd5d5a686e Mon Sep 17 00:00:00 2001
From: Pier Luigi Fiorini <[email protected]>
Date: Sun, 4 Mar 2018 04:12:55 +0100
Subject: [PATCH 1/2] greeter: Use Qt command line parser

Do not reinvent the wheel with a command line parser.
Restructure the code so that GreeterApp no longer need to
parse arguments itself.
---
 src/greeter/GreeterApp.cpp | 211 +++++++++++++++++++++++++++------------------
 src/greeter/GreeterApp.h   |  30 +++++--
 2 files changed, 149 insertions(+), 92 deletions(-)

diff --git a/src/greeter/GreeterApp.cpp b/src/greeter/GreeterApp.cpp
index 5fb70ea..1230efa 100644
--- a/src/greeter/GreeterApp.cpp
+++ b/src/greeter/GreeterApp.cpp
@@ -1,5 +1,5 @@
 /***************************************************************************
-* Copyright (c) 2015-2016 Pier Luigi Fiorini <[email protected]>
+* Copyright (c) 2015-2018 Pier Luigi Fiorini <[email protected]>
 * Copyright (c) 2013 Abdurrahman AVCI <[email protected]>
 *
 * This program is free software; you can redistribute it and/or modify
@@ -31,6 +31,7 @@
 
 #include "MessageHandler.h"
 
+#include <QCommandLineParser>
 #include <QGuiApplication>
 #include <QQuickItem>
 #include <QQuickView>
@@ -42,98 +43,91 @@
 
 #include <iostream>
 
-namespace SDDM {
-    QString parameter(const QStringList &arguments, const QString &key, const 
QString &defaultValue) {
-        int index = arguments.indexOf(key);
+#define TR(x) QT_TRANSLATE_NOOP("Command line parser", QStringLiteral(x))
 
-        if ((index < 0) || (index >= arguments.size() - 1))
-            return defaultValue;
+static const QEvent::Type StartupEventType = 
static_cast<QEvent::Type>(QEvent::registerEventType());
 
-        QString value = arguments.at(index + 1);
+namespace SDDM {
+    GreeterApp::GreeterApp(QObject *parent)
+        : QObject(parent)
+    {
+        // Translations
+        // Components translation
+        m_components_tranlator = new QTranslator();
+        if (m_components_tranlator->load(QLocale::system(), QString(), 
QString(), QStringLiteral(COMPONENTS_TRANSLATION_DIR)))
+            QCoreApplication::installTranslator(m_components_tranlator);
 
-        if (value.startsWith(QLatin1Char('-')))
-            return defaultValue;
 
-        return value;
+        // Create models
+        m_sessionModel = new SessionModel();
+        m_userModel = new UserModel();
+        m_keyboard = new KeyboardModel();
     }
 
-    GreeterApp *GreeterApp::self = nullptr;
+    bool GreeterApp::isTestModeEnabled() const
+    {
+        return m_testing;
+    }
 
-    GreeterApp::GreeterApp(int &argc, char **argv) : QGuiApplication(argc, 
argv) {
-        // point instance to this
-        self = this;
+    void GreeterApp::setTestModeEnabled(bool value)
+    {
+        m_testing = value;
+    }
 
-        // Parse arguments
-        bool testing = false;
+    QString GreeterApp::socketName() const
+    {
+        return m_socket;
+    }
 
-        if (arguments().contains(QStringLiteral("--test-mode")))
-            testing = true;
+    void GreeterApp::setSocketName(const QString &name)
+    {
+        m_socket = name;
+    }
 
-        // get socket name
-        QString socket = parameter(arguments(), QStringLiteral("--socket"), 
QString());
+    QString GreeterApp::themePath() const
+    {
+        return m_themePath;
+    }
 
-        // get theme path (fallback to internal theme)
-        m_themePath = parameter(arguments(), QStringLiteral("--theme"), 
QString());
+    void GreeterApp::setThemePath(const QString &path)
+    {
+        m_themePath = path;
         if (m_themePath.isEmpty())
             m_themePath = QLatin1String("qrc:/theme");
 
-        // read theme metadata
-        m_metadata = new 
ThemeMetadata(QStringLiteral("%1/metadata.desktop").arg(m_themePath));
-
-        // Translations
-        // Components translation
-        m_components_tranlator = new QTranslator();
-        if (m_components_tranlator->load(QLocale::system(), QString(), 
QString(), QStringLiteral(COMPONENTS_TRANSLATION_DIR)))
-            installTranslator(m_components_tranlator);
-
-        // Theme specific translation
-        m_theme_translator = new QTranslator();
-        if (m_theme_translator->load(QLocale::system(), QString(), QString(),
-                           QStringLiteral("%1/%2/").arg(m_themePath, 
m_metadata->translationsDirectory())))
-            installTranslator(m_theme_translator);
+        // Read theme metadata
+        const QString metadataPath = 
QStringLiteral("%1/metadata.desktop").arg(m_themePath);
+        if (m_metadata)
+            m_metadata->setTo(metadataPath);
+        else
+            m_metadata = new ThemeMetadata(metadataPath);
 
-        // get theme config file
+        // Get theme config file
         QString configFile = 
QStringLiteral("%1/%2").arg(m_themePath).arg(m_metadata->configFile());
 
-        // read theme config
-        m_themeConfig = new ThemeConfig(configFile);
+        // Read theme config
+        if (m_themeConfig)
+            m_themeConfig->setTo(configFile);
+        else
+            m_themeConfig = new ThemeConfig(configFile);
 
-        // set default icon theme from greeter theme
+        // Set default icon theme from greeter theme
         if (m_themeConfig->contains(QStringLiteral("iconTheme")))
             
QIcon::setThemeName(m_themeConfig->value(QStringLiteral("iconTheme")).toString());
 
-        // create models
-
-        m_sessionModel = new SessionModel();
-        m_userModel = new UserModel();
-        m_proxy = new GreeterProxy(socket);
-        m_keyboard = new KeyboardModel();
-
-        if(!testing && !m_proxy->isConnected()) {
-            qCritical() << "Cannot connect to the daemon - is it running?";
-            exit(EXIT_FAILURE);
-        }
-
-        // Set numlock upon start
-        if (m_keyboard->enabled()) {
-            if (mainConfig.Numlock.get() == MainConfig::NUM_SET_ON)
-                m_keyboard->setNumLockState(true);
-            else if (mainConfig.Numlock.get() == MainConfig::NUM_SET_OFF)
-                m_keyboard->setNumLockState(false);
-        }
-
-        m_proxy->setSessionModel(m_sessionModel);
-
-        // create views
-        QList<QScreen *> screens = primaryScreen()->virtualSiblings();
-        Q_FOREACH (QScreen *screen, screens)
-            addViewForScreen(screen);
+        // Theme specific translation
+        if (m_theme_translator)
+            m_theme_translator->deleteLater();
+        m_theme_translator = new QTranslator();
+        if (m_theme_translator->load(QLocale::system(), QString(), QString(),
+                           QStringLiteral("%1/%2/").arg(m_themePath, 
m_metadata->translationsDirectory())))
+            QCoreApplication::installTranslator(m_theme_translator);
+    }
 
-        // handle screens
-        connect(this, &GreeterApp::screenAdded, this, 
&GreeterApp::addViewForScreen);
-        connect(this, &GreeterApp::primaryScreenChanged, this, [this](QScreen 
*) {
-            activatePrimary();
-        });
+    void GreeterApp::customEvent(QEvent *event)
+    {
+        if (event->type() == StartupEventType)
+            startup();
     }
 
     void GreeterApp::addViewForScreen(QScreen *screen) {
@@ -149,7 +143,7 @@ namespace SDDM {
         // need to be careful here since Qt will move the view to
         // another screen before this signal is emitted so we
         // pass a pointer to the view to our slot
-        connect(this, &GreeterApp::screenRemoved, this, [view, this](QScreen 
*) {
+        connect(qGuiApp, &QGuiApplication::screenRemoved, this, [view, 
this](QScreen *) {
             removeViewForScreen(view);
         });
 
@@ -231,6 +225,38 @@ namespace SDDM {
         view->deleteLater();
     }
 
+    void GreeterApp::startup()
+    {
+        // Connect to the daemon
+        m_proxy = new GreeterProxy(m_socket);
+        if (!m_testing && !m_proxy->isConnected()) {
+            qCritical() << "Cannot connect to the daemon - is it running?";
+            QCoreApplication::exit(EXIT_FAILURE);
+        }
+
+        // Set numlock upon start
+        if (m_keyboard->enabled()) {
+            if (mainConfig.Numlock.get() == MainConfig::NUM_SET_ON)
+                m_keyboard->setNumLockState(true);
+            else if (mainConfig.Numlock.get() == MainConfig::NUM_SET_OFF)
+                m_keyboard->setNumLockState(false);
+        }
+
+        // Set session model on proxy
+        m_proxy->setSessionModel(m_sessionModel);
+
+        // Create views
+        QList<QScreen *> screens = qGuiApp->primaryScreen()->virtualSiblings();
+        Q_FOREACH (QScreen *screen, screens)
+            addViewForScreen(screen);
+
+        // Handle screens
+        connect(qGuiApp, &QGuiApplication::screenAdded, this, 
&GreeterApp::addViewForScreen);
+        connect(qGuiApp, &QGuiApplication::primaryScreenChanged, this, 
[this](QScreen *) {
+            activatePrimary();
+        });
+    }
+
     void GreeterApp::activatePrimary() {
         // activate and give focus to the window assigned to the primary screen
         Q_FOREACH (QQuickView *view, m_views) {
@@ -240,10 +266,16 @@ namespace SDDM {
             }
         }
     }
+
+    StartupEvent::StartupEvent()
+        : QEvent(StartupEventType)
+    {
+    }
 }
 
-int main(int argc, char **argv) {
-    // install message handler
+int main(int argc, char **argv)
+{
+    // Install message handler
     qInstallMessageHandler(SDDM::GreeterMessageHandler);
 
     // HiDPI
@@ -259,22 +291,29 @@ int main(int argc, char **argv) {
         qDebug() << "High-DPI autoscaling not Enabled";
     }
 
-    QStringList arguments;
+    QGuiApplication app(argc, argv);
 
-    for (int i = 0; i < argc; i++)
-        arguments << QString::fromLocal8Bit(argv[i]);
+    QCommandLineParser parser;
+    parser.setApplicationDescription(TR("SDDM greeter"));
+    parser.addHelpOption();
+    parser.addVersionOption();
 
-    if (arguments.contains(QStringLiteral("--help")) || 
arguments.contains(QStringLiteral("-h"))) {
-        std::cout << "Usage: " << argv[0] << " [options] [arguments]\n"
-                     "Options: \n"
-                     "  --theme <theme path>       Set greeter theme\n"
-                     "  --socket <socket name>     Set socket name\n"
-                     "  --test-mode                Start greeter in test mode" 
<< std::endl;
+    QCommandLineOption testModeOption(QLatin1String("test-mode"), TR("Start 
greeter in test mode"));
+    parser.addOption(testModeOption);
 
-        return EXIT_FAILURE;
-    }
+    QCommandLineOption socketOption(QLatin1String("socket"), TR("Socket 
name"), TR("name"));
+    parser.addOption(socketOption);
+
+    QCommandLineOption themeOption(QLatin1String("theme"), TR("Greeter 
theme"), TR("path"));
+    parser.addOption(themeOption);
+
+    parser.process(app);
 
-    SDDM::GreeterApp app(argc, argv);
+    SDDM::GreeterApp *greeter = new SDDM::GreeterApp();
+    greeter->setTestModeEnabled(parser.isSet(testModeOption));
+    greeter->setSocketName(parser.value(socketOption));
+    greeter->setThemePath(parser.value(themeOption));
+    QCoreApplication::postEvent(greeter, new SDDM::StartupEvent());
 
     return app.exec();
 }
diff --git a/src/greeter/GreeterApp.h b/src/greeter/GreeterApp.h
index 1ebd981..ed63595 100644
--- a/src/greeter/GreeterApp.h
+++ b/src/greeter/GreeterApp.h
@@ -21,7 +21,7 @@
 #ifndef GREETERAPP_H
 #define GREETERAPP_H
 
-#include <QGuiApplication>
+#include <QObject>
 #include <QScreen>
 #include <QQuickView>
 
@@ -38,27 +38,38 @@ namespace SDDM {
     class KeyboardModel;
 
 
-    class GreeterApp : public QGuiApplication
+    class GreeterApp : public QObject
     {
         Q_OBJECT
         Q_DISABLE_COPY(GreeterApp)
     public:
-        explicit GreeterApp(int &argc, char **argv);
+        explicit GreeterApp(QObject *parent = nullptr);
 
-        static GreeterApp *instance() { return self; }
+        bool isTestModeEnabled() const;
+        void setTestModeEnabled(bool value);
+
+        QString socketName() const;
+        void setSocketName(const QString &name);
+
+        QString themePath() const;
+        void setThemePath(const QString &path);
+
+    protected:
+        void customEvent(QEvent *event) override;
 
     private slots:
         void addViewForScreen(QScreen *screen);
         void removeViewForScreen(QQuickView *view);
 
     private:
-        static GreeterApp *self;
+        bool m_testing = false;
+        QString m_socket;
+        QString m_themePath;
 
         QList<QQuickView *> m_views;
         QTranslator *m_theme_translator { nullptr },
                     *m_components_tranlator { nullptr };
 
-        QString m_themePath;
         ThemeMetadata *m_metadata { nullptr };
         ThemeConfig *m_themeConfig { nullptr };
         SessionModel *m_sessionModel { nullptr };
@@ -66,8 +77,15 @@ namespace SDDM {
         GreeterProxy *m_proxy { nullptr };
         KeyboardModel *m_keyboard { nullptr };
 
+        void startup();
         void activatePrimary();
     };
+
+    class StartupEvent : public QEvent
+    {
+    public:
+        StartupEvent();
+    };
 }
 
 
-- 
2.16.1

++++++ sddm-relaxed-auth.diff ++++++
--- /var/tmp/diff_new_pack.HjtwpZ/_old  2018-03-20 21:42:42.059829916 +0100
+++ /var/tmp/diff_new_pack.HjtwpZ/_new  2018-03-20 21:42:42.059829916 +0100
@@ -1,8 +1,8 @@
-Index: sddm-0.14.0/src/daemon/XorgDisplayServer.cpp
+Index: sddm-0.17.0/src/daemon/XorgDisplayServer.cpp
 ===================================================================
---- sddm-0.14.0.orig/src/daemon/XorgDisplayServer.cpp
-+++ sddm-0.14.0/src/daemon/XorgDisplayServer.cpp
-@@ -281,6 +281,7 @@ namespace SDDM {
+--- sddm-0.17.0.orig/src/daemon/XorgDisplayServer.cpp
++++ sddm-0.17.0/src/daemon/XorgDisplayServer.cpp
+@@ -288,6 +288,7 @@ namespace SDDM {
          // set process environment
          QProcessEnvironment env;
          env.insert(QStringLiteral("DISPLAY"), m_display);
@@ -10,10 +10,10 @@
          env.insert(QStringLiteral("HOME"), QStringLiteral("/"));
          env.insert(QStringLiteral("PATH"), 
mainConfig.Users.DefaultPath.get());
          env.insert(QStringLiteral("XAUTHORITY"), m_authPath);
-Index: sddm-0.14.0/src/helper/Backend.cpp
+Index: sddm-0.17.0/src/helper/Backend.cpp
 ===================================================================
---- sddm-0.14.0.orig/src/helper/Backend.cpp
-+++ sddm-0.14.0/src/helper/Backend.cpp
+--- sddm-0.17.0.orig/src/helper/Backend.cpp
++++ sddm-0.17.0/src/helper/Backend.cpp
 @@ -27,6 +27,7 @@
  #include "UserSession.h"
  
@@ -24,7 +24,7 @@
  
 @@ -69,6 +70,7 @@ namespace SDDM {
                          .arg(QString::fromLocal8Bit(pw->pw_dir))
-                         .arg(mainConfig.XDisplay.UserAuthFile.get());
+                         .arg(mainConfig.X11.UserAuthFile.get());
                  env.insert(QStringLiteral("XAUTHORITY"), value);
 +                env.insert(QStringLiteral("XAUTHLOCALHOSTNAME"), 
QHostInfo::localHostName());
              }


Reply via email to