Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 9 Oct 2020 20:10:19 +0000 (UTC)
From:      Baptiste Daroussin <bapt@FreeBSD.org>
To:        ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org
Subject:   svn commit: r551815 - in head/x11/gnome-shell: . files
Message-ID:  <202010092010.099KAJwQ024299@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: bapt
Date: Fri Oct  9 20:10:19 2020
New Revision: 551815
URL: https://svnweb.freebsd.org/changeset/ports/551815

Log:
  Gnome-shell: fix the login manager interface
  
  gdm call gnome-shell to provide its login manager. with the upgrade of gnome-shell
  this wasn't patched to be able to talk to consolekit. Fix this by incorporating patches
  from OpenBSD

Added:
  head/x11/gnome-shell/files/
  head/x11/gnome-shell/files/org.freedesktop.ConsoleKit.Manager.xml   (contents, props changed)
  head/x11/gnome-shell/files/org.freedesktop.ConsoleKit.Session.xml   (contents, props changed)
  head/x11/gnome-shell/files/patch-data_gnome-shell-dbus-interfaces.gresource.xml   (contents, props changed)
  head/x11/gnome-shell/files/patch-js_misc_loginManager_js   (contents, props changed)
  head/x11/gnome-shell/files/patch-js_ui_status_keyboard_js   (contents, props changed)
Modified:
  head/x11/gnome-shell/Makefile

Modified: head/x11/gnome-shell/Makefile
==============================================================================
--- head/x11/gnome-shell/Makefile	Fri Oct  9 20:06:57 2020	(r551814)
+++ head/x11/gnome-shell/Makefile	Fri Oct  9 20:10:19 2020	(r551815)
@@ -3,6 +3,7 @@
 
 PORTNAME=	gnome-shell
 PORTVERSION=	3.36.6
+PORTREVISION=	1
 CATEGORIES=	x11 gnome
 MASTER_SITES=	GNOME
 DIST_SUBDIR=	gnome
@@ -72,6 +73,9 @@ GLIB_SCHEMAS=	org.gnome.shell.gschema.xml \
 # Work around "New rpath must not be longer than the old one."
 LDFLAGS+=	-fuse-ld=lld
 .endif
+
+post-extract:
+	${CP} ${FILESDIR}/*.xml ${WRKSRC}/data/dbus-interfaces
 
 post-patch:
 	${REINPLACE_CMD} -e "s,python3,${PYTHON_VERSION},g" \

Added: head/x11/gnome-shell/files/org.freedesktop.ConsoleKit.Manager.xml
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/x11/gnome-shell/files/org.freedesktop.ConsoleKit.Manager.xml	Fri Oct  9 20:10:19 2020	(r551815)
@@ -0,0 +1,25 @@
+<!-- $OpenBSD: org.freedesktop.ConsoleKit.Manager.xml,v 1.1 2019/01/17 19:00:46 ajacoutot Exp $ -->
+
+<node>
+  <interface name="org.freedesktop.ConsoleKit.Manager">
+    <method name="Suspend">                                                     
+      <arg type="b" direction="in"/>                                            
+    </method>                                                                   
+    <method name="CanSuspend">                                                  
+      <arg type="s" direction="out"/>                                           
+    </method>                                                                   
+    <method name="Inhibit">                                                     
+      <arg type="s" direction="in"/>                                            
+      <arg type="s" direction="in"/>                                            
+      <arg type="s" direction="in"/>                                            
+      <arg type="s" direction="in"/>                                            
+      <arg type="h" direction="out"/>                                           
+    </method>                                                                   
+    <signal name="PrepareForSleep">                                             
+      <arg type="b" direction="out"/>                                           
+    </signal>                                                                   
+    <method name="GetCurrentSession">
+      <arg type="o" direction="out"/>
+    </method>
+  </interface>                                                                  
+</node>

Added: head/x11/gnome-shell/files/org.freedesktop.ConsoleKit.Session.xml
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/x11/gnome-shell/files/org.freedesktop.ConsoleKit.Session.xml	Fri Oct  9 20:10:19 2020	(r551815)
@@ -0,0 +1,11 @@
+<!-- $OpenBSD: org.freedesktop.ConsoleKit.Session.xml,v 1.1 2019/01/17 19:00:46 ajacoutot Exp $ -->
+
+<node>
+  <interface name="org.freedesktop.ConsoleKit.Session">
+    <signal name="Lock" />
+    <signal name="Unlock" />
+      <method name="SetLockedHint">                                               
+        <arg type="b" direction="in"/>                                            
+      </method>
+    </interface>
+</node>

Added: head/x11/gnome-shell/files/patch-data_gnome-shell-dbus-interfaces.gresource.xml
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/x11/gnome-shell/files/patch-data_gnome-shell-dbus-interfaces.gresource.xml	Fri Oct  9 20:10:19 2020	(r551815)
@@ -0,0 +1,11 @@
+--- data/gnome-shell-dbus-interfaces.gresource.xml.orig	2020-09-07 20:29:58 UTC
++++ data/gnome-shell-dbus-interfaces.gresource.xml
+@@ -12,6 +12,8 @@
+     <file preprocess="xml-stripblanks">org.freedesktop.impl.portal.Access.xml</file>
+     <file preprocess="xml-stripblanks">org.freedesktop.impl.portal.PermissionStore.xml</file>
+     <file preprocess="xml-stripblanks">org.freedesktop.impl.portal.Request.xml</file>
++    <file preprocess="xml-stripblanks">org.freedesktop.ConsoleKit.Manager.xml</file>
++    <file preprocess="xml-stripblanks">org.freedesktop.ConsoleKit.Session.xml</file>
+     <file preprocess="xml-stripblanks">org.freedesktop.login1.Manager.xml</file>
+     <file preprocess="xml-stripblanks">org.freedesktop.login1.Session.xml</file>
+     <file preprocess="xml-stripblanks">org.freedesktop.login1.User.xml</file>

Added: head/x11/gnome-shell/files/patch-js_misc_loginManager_js
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/x11/gnome-shell/files/patch-js_misc_loginManager_js	Fri Oct  9 20:10:19 2020	(r551815)
@@ -0,0 +1,119 @@
+$OpenBSD: patch-js_misc_loginManager_js,v 1.10 2020/05/14 15:28:46 jasper Exp $
+
+Index: js/misc/loginManager.js
+--- js/misc/loginManager.js.orig
++++ js/misc/loginManager.js
+@@ -14,6 +14,12 @@ const SystemdLoginManager = Gio.DBusProxy.makeProxyWra
+ const SystemdLoginSession = Gio.DBusProxy.makeProxyWrapper(SystemdLoginSessionIface);
+ const SystemdLoginUser = Gio.DBusProxy.makeProxyWrapper(SystemdLoginUserIface);
+ 
++const ConsoleKitManagerIface = loadInterfaceXML('org.freedesktop.ConsoleKit.Manager');
++const ConsoleKitSessionIface = loadInterfaceXML('org.freedesktop.ConsoleKit.Session');
++
++const ConsoleKitManager = Gio.DBusProxy.makeProxyWrapper(ConsoleKitManagerIface);
++const ConsoleKitSession = Gio.DBusProxy.makeProxyWrapper(ConsoleKitSessionIface);
++
+ function haveSystemd() {
+     return GLib.access("/run/systemd/seats", 0) >= 0;
+ }
+@@ -43,7 +49,7 @@ function canLock() {
+                                                -1, null);
+ 
+         let version = result.deep_unpack()[0].deep_unpack();
+-        return haveSystemd() && versionCompare('3.5.91', version);
++        return versionCompare('3.5.91', version);
+     } catch (e) {
+         return false;
+     }
+@@ -84,7 +90,7 @@ function getLoginManager() {
+         if (haveSystemd())
+             _loginManager = new LoginManagerSystemd();
+         else
+-            _loginManager = new LoginManagerDummy();
++            _loginManager = new LoginManagerConsoleKit();
+     }
+ 
+     return _loginManager;
+@@ -199,6 +205,82 @@ var LoginManagerSystemd = class {
+     }
+ };
+ Signals.addSignalMethods(LoginManagerSystemd.prototype);
++
++var LoginManagerConsoleKit = class {
++    constructor () {
++        this._proxy = new ConsoleKitManager(Gio.DBus.system,
++                                            'org.freedesktop.ConsoleKit',
++                                            '/org/freedesktop/ConsoleKit/Manager');
++        this._proxy.connectSignal('PrepareForSleep',
++                                  this._prepareForSleep.bind(this));
++    }
++
++    // Having this function is a bit of a hack since the Systemd and ConsoleKit
++    // session objects have different interfaces - but in both cases there are
++    // Lock/Unlock signals, and that's all we count upon at the moment.
++
++
++    getCurrentSessionProxy(callback) {
++        if (this._currentSession) {
++            callback (this._currentSession);
++            return;
++        }
++
++        this._proxy.GetCurrentSessionRemote((result, error) => {
++            if (error) {
++                logError(error, 'Could not get a proxy for the current session');
++            } else {
++                this._currentSession = new ConsoleKitSession(Gio.DBus.system,
++                                                             'org.freedesktop.ConsoleKit',
++                                                             result[0]);
++                callback(this._currentSession);
++            }
++        });
++    }
++
++    canSuspend(asyncCallback) {
++        this._proxy.CanSuspendRemote((result, error) => {
++            if (error) {
++                asyncCallback(false, false);
++            } else {
++                asyncCallback(result[0], false);
++            }
++        });
++    }
++
++    listSessions(asyncCallback) {
++        asyncCallback([]);
++    }
++
++    suspend() {
++        this._proxy.SuspendRemote(true);
++    }
++
++    inhibit(reason, callback) {
++        let inVariant = GLib.Variant.new('(ssss)',
++                                         ['sleep',
++                                          'GNOME Shell',
++                                          reason,
++                                          'delay']);
++        this._proxy.call_with_unix_fd_list('Inhibit', inVariant, 0, -1, null, null,
++            (proxy, result) => {
++                let fd = -1;
++                try {
++                    let [outVariant, fdList] = proxy.call_with_unix_fd_list_finish(result);
++                    fd = fdList.steal_fds()[0];
++                    callback(new Gio.UnixInputStream({ fd: fd }));
++                } catch(e) {
++                    logError(e, "Error getting ConsoleKit inhibitor");
++                    callback(null);
++                }
++            });
++    }
++
++    _prepareForSleep(proxy, sender, [aboutToSuspend]) {
++        this.emit('prepare-for-sleep', aboutToSuspend);
++    }
++}
++Signals.addSignalMethods(LoginManagerConsoleKit.prototype);
+ 
+ var LoginManagerDummy = class {
+     getCurrentSessionProxy(_callback) {

Added: head/x11/gnome-shell/files/patch-js_ui_status_keyboard_js
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/x11/gnome-shell/files/patch-js_ui_status_keyboard_js	Fri Oct  9 20:10:19 2020	(r551815)
@@ -0,0 +1,27 @@
+$OpenBSD: patch-js_ui_status_keyboard_js,v 1.6 2020/05/14 15:28:46 jasper Exp $
+
+https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=235009
+
+Index: js/ui/status/keyboard.js
+--- js/ui/status/keyboard.js.orig
++++ js/ui/status/keyboard.js
+@@ -242,6 +242,19 @@ var InputSourceSystemSettings = class extends InputSou
+                 id += '+%s'.format(variants[i]);
+             sourcesList.push({ type: INPUT_SOURCE_TYPE_XKB, id });
+         }
++
++        // fallback: retrieve input source from current locale if we don't
++        // support the org.freedesktop.locale1 interface
++        if (sourcesList.length == 0) {
++            let _keyboardManagerLayout = KeyboardManager.getKeyboardManager()._getLocaleLayout();
++            if (_keyboardManagerLayout) {
++                let _kMLid = _keyboardManagerLayout.layout;
++                if (!!_keyboardManagerLayout.variant)
++                    _kMLid = _kMLid + '+' + _keyboardManagerLayout.variant;
++                sourcesList.push({ type: INPUT_SOURCE_TYPE_XKB, id: _kMLid });
++            }
++        }
++
+         return sourcesList;
+     }
+ 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202010092010.099KAJwQ024299>