head 1.1; access; symbols pkgsrc-2026Q1:1.1.0.44 pkgsrc-2026Q1-base:1.1 pkgsrc-2025Q4:1.1.0.42 pkgsrc-2025Q4-base:1.1 pkgsrc-2025Q3:1.1.0.40 pkgsrc-2025Q3-base:1.1 pkgsrc-2025Q2:1.1.0.38 pkgsrc-2025Q2-base:1.1 pkgsrc-2025Q1:1.1.0.36 pkgsrc-2025Q1-base:1.1 pkgsrc-2024Q4:1.1.0.34 pkgsrc-2024Q4-base:1.1 pkgsrc-2024Q3:1.1.0.32 pkgsrc-2024Q3-base:1.1 pkgsrc-2024Q2:1.1.0.30 pkgsrc-2024Q2-base:1.1 pkgsrc-2024Q1:1.1.0.28 pkgsrc-2024Q1-base:1.1 pkgsrc-2023Q4:1.1.0.26 pkgsrc-2023Q4-base:1.1 pkgsrc-2023Q3:1.1.0.24 pkgsrc-2023Q3-base:1.1 pkgsrc-2023Q2:1.1.0.22 pkgsrc-2023Q2-base:1.1 pkgsrc-2023Q1:1.1.0.20 pkgsrc-2023Q1-base:1.1 pkgsrc-2022Q4:1.1.0.18 pkgsrc-2022Q4-base:1.1 pkgsrc-2022Q3:1.1.0.16 pkgsrc-2022Q3-base:1.1 pkgsrc-2022Q2:1.1.0.14 pkgsrc-2022Q2-base:1.1 pkgsrc-2022Q1:1.1.0.12 pkgsrc-2022Q1-base:1.1 pkgsrc-2021Q4:1.1.0.10 pkgsrc-2021Q4-base:1.1 pkgsrc-2021Q3:1.1.0.8 pkgsrc-2021Q3-base:1.1 pkgsrc-2021Q2:1.1.0.6 pkgsrc-2021Q2-base:1.1 pkgsrc-2021Q1:1.1.0.4 pkgsrc-2021Q1-base:1.1 pkgsrc-2020Q4:1.1.0.2 pkgsrc-2020Q4-base:1.1; locks; strict; comment @# @; 1.1 date 2020.11.10.12.06.59; author nia; state Exp; branches; next ; commitid WHg1tTUBlcf4VkvC; desc @@ 1.1 log @x11: Add gnome-shell. Based on work by Dan Cîrnaț and myself in wip. GNOME Shell provides core user interface functions for the GNOME 3 desktop, like switching to windows and launching applications. GNOME Shell takes advantage of the capabilities of modern graphics hardware and introduces innovative user interface concepts to provide a visually attractive and easy to use experience. @ text @$NetBSD$ $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 2020-10-05 18:36:07.887838800 +0000 +++ js/misc/loginManager.js @@@@ -14,6 +14,12 @@@@ const SystemdLoginManager = Gio.DBusProx 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; } @@@@ -81,7 +87,7 @@@@ function getLoginManager() { if (haveSystemd()) _loginManager = new LoginManagerSystemd(); else - _loginManager = new LoginManagerDummy(); + _loginManager = new LoginManagerConsoleKit(); } return _loginManager; @@@@ -209,6 +215,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) { // we could return a DummySession object that fakes whatever callers @