commit:     e57438123e4153bcae1a1b05bdc0831a75812c35
Author:     Michael Palimaka <kensington <AT> gentoo <DOT> org>
AuthorDate: Thu May  5 17:07:05 2016 +0000
Commit:     Michael Palimaka <kensington <AT> gentoo <DOT> org>
CommitDate: Thu May  5 17:07:42 2016 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=e5743812

x11-misc/sddm: backport patch from upstream to ensure that the password field 
has focus

Gentoo-bug: 566082

Package-Manager: portage-2.2.28

 .../sddm/files/sddm-0.13.0-password-focus.patch    | 109 +++++++++++++++++++++
 x11-misc/sddm/sddm-0.13.0-r4.ebuild                |  81 +++++++++++++++
 2 files changed, 190 insertions(+)

diff --git a/x11-misc/sddm/files/sddm-0.13.0-password-focus.patch 
b/x11-misc/sddm/files/sddm-0.13.0-password-focus.patch
new file mode 100644
index 0000000..cc27669
--- /dev/null
+++ b/x11-misc/sddm/files/sddm-0.13.0-password-focus.patch
@@ -0,0 +1,109 @@
+From 6d5b36b28907b16280ff78995fef764bb0c573db Mon Sep 17 00:00:00 2001
+From: Pier Luigi Fiorini <[email protected]>
+Date: Sat, 16 Jan 2016 19:52:09 +0100
+Subject: [PATCH] Activate window for the primary screen
+
+Request activation for the view on the primary screen
+otherwise text fields won't get focus.
+
+Closes #501
+
+[ChangeLog][Greeter] Fix text field focus (issue #501)
+---
+ src/greeter/GreeterApp.cpp | 31 ++++++++++++++++++++++++++++++-
+ src/greeter/GreeterApp.h   |  4 +++-
+ 2 files changed, 33 insertions(+), 2 deletions(-)
+
+diff --git a/src/greeter/GreeterApp.cpp b/src/greeter/GreeterApp.cpp
+index 06d13c5..8201a4e 100644
+--- a/src/greeter/GreeterApp.cpp
++++ b/src/greeter/GreeterApp.cpp
+@@ -1,5 +1,5 @@
+ /***************************************************************************
+-* Copyright (c) 2015 Pier Luigi Fiorini <[email protected]>
++* Copyright (c) 2015-2016 Pier Luigi Fiorini <[email protected]>
+ * Copyright (c) 2013 Abdurrahman AVCI <[email protected]>
+ *
+ * This program is free software; you can redistribute it and/or modify
+@@ -36,6 +36,7 @@
+ #include <QQmlContext>
+ #include <QQmlEngine>
+ #include <QDebug>
++#include <QTimer>
+ #include <QTranslator>
+ 
+ #include <iostream>
+@@ -135,6 +136,11 @@ namespace SDDM {
+ 
+         // handle screens
+         connect(this, &GreeterApp::screenAdded, this, 
&GreeterApp::addViewForScreen);
++#if QT_VERSION >= QT_VERSION_CHECK(5, 6, 0)
++        connect(this, &GreeterApp::primaryScreenChanged, this, [this](QScreen 
*) {
++            activatePrimary();
++        });
++#endif
+     }
+ 
+     void GreeterApp::addViewForScreen(QScreen *screen) {
+@@ -144,6 +150,7 @@ namespace SDDM {
+         view->setResizeMode(QQuickView::SizeRootObjectToView);
+         //view->setGeometry(QRect(QPoint(0, 0), screen->geometry().size()));
+         view->setGeometry(screen->geometry());
++        m_views.append(view);
+ 
+         // remove the view when the screen is removed, but we
+         // need to be careful here since Qt will move the view to
+@@ -201,11 +208,33 @@ namespace SDDM {
+         // show
+         qDebug() << "Adding view for" << screen->name() << screen->geometry();
+         view->show();
++
++        // activate windows for the primary screen to give focus to text 
fields
++        if (QGuiApplication::primaryScreen() == screen)
++            view->requestActivate();
+     }
+ 
+     void GreeterApp::removeViewForScreen(QQuickView *view) {
++        // screen is gone, remove the window
+         m_views.removeOne(view);
+         view->deleteLater();
++
++#if QT_VERSION < QT_VERSION_CHECK(5, 6, 0)
++        // starting from Qt 5.6 we are notified when the primary screen is 
changed
++        // and we request activation for the view when we get the signal, with
++        // older version we iterate the views and request activation
++        activatePrimary();
++#endif
++    }
++
++    void GreeterApp::activatePrimary() {
++        // activate and give focus to the window assigned to the primary 
screen
++        Q_FOREACH (QQuickView *view, m_views) {
++            if (view->screen() == QGuiApplication::primaryScreen()) {
++                view->requestActivate();
++                break;
++            }
++        }
+     }
+ }
+ 
+diff --git a/src/greeter/GreeterApp.h b/src/greeter/GreeterApp.h
+index 91fc1a9..1ebd981 100644
+--- a/src/greeter/GreeterApp.h
++++ b/src/greeter/GreeterApp.h
+@@ -1,5 +1,5 @@
+ /***************************************************************************
+-* Copyright (c) 2015 Pier Luigi Fiorini <[email protected]>
++* Copyright (c) 2015-2016 Pier Luigi Fiorini <[email protected]>
+ * Copyright (c) 2013 Nikita Mikhaylov <[email protected]>
+ *
+ * This program is free software; you can redistribute it and/or modify
+@@ -65,6 +65,8 @@ namespace SDDM {
+         UserModel *m_userModel { nullptr };
+         GreeterProxy *m_proxy { nullptr };
+         KeyboardModel *m_keyboard { nullptr };
++
++        void activatePrimary();
+     };
+ }
+ 

diff --git a/x11-misc/sddm/sddm-0.13.0-r4.ebuild 
b/x11-misc/sddm/sddm-0.13.0-r4.ebuild
new file mode 100644
index 0000000..b3f70b3
--- /dev/null
+++ b/x11-misc/sddm/sddm-0.13.0-r4.ebuild
@@ -0,0 +1,81 @@
+# Copyright 1999-2016 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=6
+inherit cmake-utils user
+
+DESCRIPTION="Simple Desktop Display Manager"
+HOMEPAGE="https://github.com/sddm/sddm";
+SRC_URI="https://github.com/${PN}/${PN}/releases/download/v${PV}/${P}.tar.xz";
+KEYWORDS="~amd64 ~arm ~x86"
+
+LICENSE="GPL-2+ MIT CC-BY-3.0 CC-BY-SA-3.0 public-domain"
+SLOT="0"
+IUSE="consolekit +pam systemd"
+
+RDEPEND="dev-qt/qtcore:5
+       dev-qt/qtdbus:5
+       dev-qt/qtgui:5
+       dev-qt/qtdeclarative:5
+       dev-qt/qtnetwork:5
+       >=x11-base/xorg-server-1.15.1
+       x11-libs/libxcb[xkb(-)]
+       consolekit? ( >=sys-auth/consolekit-0.9.4 )
+       pam? ( sys-libs/pam )
+       systemd? ( sys-apps/systemd:= )
+       !systemd? ( || ( sys-power/upower sys-power/upower-pm-utils ) )"
+
+DEPEND="${RDEPEND}
+       dev-python/docutils
+       dev-qt/linguist-tools:5
+       dev-qt/qttest:5
+       virtual/pkgconfig"
+
+pkg_pretend() {
+       if [[ ${MERGE_TYPE} != binary  && $(tc-getCC) == *gcc* ]]; then
+               if [[ $(gcc-major-version) -lt 4 || $(gcc-major-version) == 4 
&& $(gcc-minor-version) -lt 7 ]] ; then
+                       die 'The active compiler needs to be gcc 4.7 (or newer)'
+               fi
+       fi
+}
+
+src_prepare() {
+       eapply "${FILESDIR}/${PN}-0.13.0-pam_kwallet.patch"
+       # fix for flags handling and bug 563108
+       eapply "${FILESDIR}/${PN}-0.12.0-respect-user-flags.patch"
+       eapply "${FILESDIR}/${P}-password-focus.patch"
+       use consolekit && eapply "${FILESDIR}/${PN}-0.11.0-consolekit.patch"
+
+       cmake-utils_src_prepare
+}
+
+src_configure() {
+       local mycmakeargs=(
+               -DENABLE_PAM=$(usex pam)
+               -DNO_SYSTEMD=$(usex '!systemd')
+               -DBUILD_MAN_PAGES=ON
+               -DDBUS_CONFIG_FILENAME="org.freedesktop.sddm.conf"
+               )
+
+       cmake-utils_src_configure
+}
+
+pkg_postinst() {
+       enewgroup ${PN}
+       enewuser ${PN} -1 -1 /var/lib/${PN} ${PN} video
+
+       if use consolekit && use pam && [[ -e "${ROOT}"/etc/pam.d/system-login 
]]; then
+               local line=$(grep "pam_ck_connector.*nox11" 
"${ROOT}"/etc/pam.d/system-login)
+               if [[ -z ${line} ]]; then
+                       ewarn
+                       ewarn "Erroneous /etc/pam.d/system-login settings 
detected!"
+                       ewarn "Please restore 'nox11' option in the line 
containing pam_ck_connector:"
+                       ewarn
+                       ewarn "session      optional      pam_ck_connector.so 
nox11"
+                       ewarn
+                       ewarn "or 'emerge -1 sys-auth/pambase' and run 
etc-update."
+                       ewarn
+               fi
+       fi
+}

Reply via email to