summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobin H. Johnson <robbat2@gentoo.org>2015-08-08 13:49:04 -0700
committerRobin H. Johnson <robbat2@gentoo.org>2015-08-08 17:38:18 -0700
commit56bd759df1d0c750a065b8c845e93d5dfa6b549d (patch)
tree3f91093cdb475e565ae857f1c5a7fd339e2d781e /xfce-base/xfce4-session
downloadgentoo-56bd759df1d0c750a065b8c845e93d5dfa6b549d.tar.gz
gentoo-56bd759df1d0c750a065b8c845e93d5dfa6b549d.tar.bz2
gentoo-56bd759df1d0c750a065b8c845e93d5dfa6b549d.zip
proj/gentoo: Initial commit
This commit represents a new era for Gentoo: Storing the gentoo-x86 tree in Git, as converted from CVS. This commit is the start of the NEW history. Any historical data is intended to be grafted onto this point. Creation process: 1. Take final CVS checkout snapshot 2. Remove ALL ChangeLog* files 3. Transform all Manifests to thin 4. Remove empty Manifests 5. Convert all stale $Header$/$Id$ CVS keywords to non-expanded Git $Id$ 5.1. Do not touch files with -kb/-ko keyword flags. Signed-off-by: Robin H. Johnson <robbat2@gentoo.org> X-Thanks: Alec Warner <antarus@gentoo.org> - did the GSoC 2006 migration tests X-Thanks: Robin H. Johnson <robbat2@gentoo.org> - infra guy, herding this project X-Thanks: Nguyen Thai Ngoc Duy <pclouds@gentoo.org> - Former Gentoo developer, wrote Git features for the migration X-Thanks: Brian Harring <ferringb@gentoo.org> - wrote much python to improve cvs2svn X-Thanks: Rich Freeman <rich0@gentoo.org> - validation scripts X-Thanks: Patrick Lauer <patrick@gentoo.org> - Gentoo dev, running new 2014 work in migration X-Thanks: Michał Górny <mgorny@gentoo.org> - scripts, QA, nagging X-Thanks: All of other Gentoo developers - many ideas and lots of paint on the bikeshed
Diffstat (limited to 'xfce-base/xfce4-session')
-rw-r--r--xfce-base/xfce4-session/Manifest2
-rw-r--r--xfce-base/xfce4-session/files/xfce4-session-4.10.1-alock_support_to_xflock4.patch15
-rw-r--r--xfce-base/xfce4-session/files/xfce4-session-4.10.1-systemd.patch400
-rw-r--r--xfce-base/xfce4-session/files/xfce4-session-4.11.0-upower-0.99.0.patch448
-rw-r--r--xfce-base/xfce4-session/metadata.xml8
-rw-r--r--xfce-base/xfce4-session/xfce4-session-4.10.1-r2.ebuild71
-rw-r--r--xfce-base/xfce4-session/xfce4-session-4.12.1.ebuild71
7 files changed, 1015 insertions, 0 deletions
diff --git a/xfce-base/xfce4-session/Manifest b/xfce-base/xfce4-session/Manifest
new file mode 100644
index 000000000000..3d331dbf660c
--- /dev/null
+++ b/xfce-base/xfce4-session/Manifest
@@ -0,0 +1,2 @@
+DIST xfce4-session-4.10.1.tar.bz2 1273015 SHA256 0154fabdc398798c3445374ccc52a2f5bcb2d867fc94bc54114395b24f9cfc83 SHA512 4c6931c350957107fc13f244748287141d524a0e954f48935b5dac2c46a8125af702e1164af98414644f9ea51f5a952db6c57a96fe2a51cab21b616381aac015 WHIRLPOOL fb6193b4d769fb0cd5461a925538bbfa9224b31209d3d16b8bef2f81cbf29aa4cf1c56373335b27326cc2a9f8905a11eec975ee7bc2068168b39e06cd08e64fa
+DIST xfce4-session-4.12.1.tar.bz2 1289284 SHA256 97d7f2a2d0af7f3623b68d1f04091e02913b28f9555dab8b0d26c8a1299d08fd SHA512 d7f37dbff59acb316965ab2224674ac3b5b7cfd7262acd4426b582001cee313945acb8883be21553dd6d7a046934bbbe116f451e6d5fd35b6fa5444da94605df WHIRLPOOL 6cf4e58782ee0cfb01ada620e58b71de5f235d2d1bcce625185e3c465dc8c356403956b88ac265f00bbf71cfbff72a2ad7e2ec3c711b4a5871b1d21d83bee56f
diff --git a/xfce-base/xfce4-session/files/xfce4-session-4.10.1-alock_support_to_xflock4.patch b/xfce-base/xfce4-session/files/xfce4-session-4.10.1-alock_support_to_xflock4.patch
new file mode 100644
index 000000000000..feb020aaff03
--- /dev/null
+++ b/xfce-base/xfce4-session/files/xfce4-session-4.10.1-alock_support_to_xflock4.patch
@@ -0,0 +1,15 @@
+http://bugs.gentoo.org/501370
+http://bugzilla.xfce.org/show_bug.cgi?id=10679
+
+--- scripts/xflock4
++++ scripts/xflock4
+@@ -35,7 +35,8 @@
+ # else run another access locking utility, if installed
+ for lock_cmd in \
+ "xlock -mode blank" \
+- "slock"
++ "slock" \
++ "alock -bg blank -auth pam"
+ do
+ set -- $lock_cmd
+ if command -v -- $1 >/dev/null 2>&1; then
diff --git a/xfce-base/xfce4-session/files/xfce4-session-4.10.1-systemd.patch b/xfce-base/xfce4-session/files/xfce4-session-4.10.1-systemd.patch
new file mode 100644
index 000000000000..e174e40d0355
--- /dev/null
+++ b/xfce-base/xfce4-session/files/xfce4-session-4.10.1-systemd.patch
@@ -0,0 +1,400 @@
+http://pkgs.fedoraproject.org/cgit/xfce4-session.git/commit/xfce4-session-4.10.1-systemd.patch?id=9e8af8b3ee7e8e91817d087e80de29b1af6d4943
+
+diff --git a/configure.ac b/configure.ac
+index 46ff366..8feee0b 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -98,7 +98,7 @@ XDT_CHECK_PACKAGE([XFCONF], [libxfconf-0], [4.9.0])
+
+ dnl Check for polkit / systemd integration
+ XDT_CHECK_OPTIONAL_PACKAGE([SYSTEMD], [polkit-gobject-1], [0.100],
+- [systemd], [Systemd support (through polit)])
++ [systemd], [Systemd support (through polkit)])
+
+ dnl Check for debugging support
+ XDT_FEATURE_DEBUG([xfsm_debug_default])
+@@ -202,10 +202,10 @@ echo " * Legacy session management: yes"
+ else
+ echo " * Legacy session management: no"
+ fi
+-if test x"$GNOME_KEYRING_FOUND" = x"yes"; then
+-echo " * Gnome Keyring support: yes"
++if test x"$SYSTEMD_FOUND" = x"yes"; then
++echo " * Systemd support (through polkit): yes"
+ else
+-echo " * Gnome Keyring support: no"
++echo " * Systemd support (through polkit): no"
+ fi
+
+ echo
+diff --git a/xfce4-session/Makefile.am b/xfce4-session/Makefile.am
+index 5472b33..ea706fd 100644
+--- a/xfce4-session/Makefile.am
++++ b/xfce4-session/Makefile.am
+@@ -38,6 +38,8 @@ xfce4_session_SOURCES = \
+ xfsm-compat-gnome.h \
+ xfsm-compat-kde.c \
+ xfsm-compat-kde.h \
++ xfsm-consolekit.c \
++ xfsm-consolekit.h \
+ xfsm-dns.c \
+ xfsm-dns.h \
+ xfsm-error.c \
+@@ -67,10 +69,6 @@ if HAVE_SYSTEMD
+ xfce4_session_SOURCES += \
+ xfsm-systemd.c \
+ xfsm-systemd.h
+-else
+-xfce4_session_SOURCES += \
+- xfsm-consolekit.c \
+- xfsm-consolekit.h
+ endif
+
+ xfce4_session_CFLAGS = \
+diff --git a/xfce4-session/xfsm-shutdown.c b/xfce4-session/xfsm-shutdown.c
+index 4c483a7..329c4f6 100644
+--- a/xfce4-session/xfsm-shutdown.c
++++ b/xfce4-session/xfsm-shutdown.c
+@@ -63,6 +63,7 @@
+ #include <xfce4-session/xfsm-shutdown.h>
+ #include <xfce4-session/xfsm-compat-gnome.h>
+ #include <xfce4-session/xfsm-compat-kde.h>
++#include <xfce4-session/xfsm-consolekit.h>
+ #include <xfce4-session/xfsm-fadeout.h>
+ #include <xfce4-session/xfsm-global.h>
+ #include <xfce4-session/xfsm-legacy.h>
+@@ -70,8 +71,6 @@
+
+ #ifdef HAVE_SYSTEMD
+ #include <xfce4-session/xfsm-systemd.h>
+-#else
+-#include <xfce4-session/xfsm-consolekit.h>
+ #endif
+
+ static void xfsm_shutdown_finalize (GObject *object);
+@@ -98,9 +97,8 @@ struct _XfsmShutdown
+
+ #ifdef HAVE_SYSTEMD
+ XfsmSystemd *systemd;
+-#else
+- XfsmConsolekit *consolekit;
+ #endif
++ XfsmConsolekit *consolekit;
+ XfsmUPower *upower;
+
+ /* kiosk settings */
+@@ -139,10 +137,14 @@ xfsm_shutdown_init (XfsmShutdown *shutdown)
+ XfceKiosk *kiosk;
+
+ #ifdef HAVE_SYSTEMD
+- shutdown->systemd = xfsm_systemd_get ();
+-#else
+- shutdown->consolekit = xfsm_consolekit_get ();
++ shutdown->consolekit = NULL;
++ shutdown->systemd = NULL;
++ if (LOGIND_RUNNING())
++ shutdown->systemd = xfsm_systemd_get ();
++ else
+ #endif
++ shutdown->consolekit = xfsm_consolekit_get ();
++
+ shutdown->upower = xfsm_upower_get ();
+ shutdown->helper_state = SUDO_NOT_INITIAZED;
+ shutdown->helper_require_password = FALSE;
+@@ -162,10 +164,11 @@ xfsm_shutdown_finalize (GObject *object)
+ XfsmShutdown *shutdown = XFSM_SHUTDOWN (object);
+
+ #ifdef HAVE_SYSTEMD
+- g_object_unref (G_OBJECT (shutdown->systemd));
+-#else
+- g_object_unref (G_OBJECT (shutdown->consolekit));
++ if (shutdown->systemd != NULL)
++ g_object_unref (G_OBJECT (shutdown->systemd));
+ #endif
++ if (shutdown->consolekit != NULL)
++ g_object_unref (G_OBJECT (shutdown->consolekit));
+ g_object_unref (G_OBJECT (shutdown->upower));
+
+ /* close down helper */
+@@ -657,10 +660,11 @@ xfsm_shutdown_try_restart (XfsmShutdown *shutdown,
+ return xfsm_shutdown_sudo_try_action (shutdown, XFSM_SHUTDOWN_RESTART, error);
+ else
+ #ifdef HAVE_SYSTEMD
+- return xfsm_systemd_try_restart (shutdown->systemd, error);
+-#else
+- return xfsm_consolekit_try_restart (shutdown->consolekit, error);
++ if (shutdown->systemd != NULL)
++ return xfsm_systemd_try_restart (shutdown->systemd, error);
++ else
+ #endif
++ return xfsm_consolekit_try_restart (shutdown->consolekit, error);
+ }
+
+
+@@ -678,10 +682,11 @@ xfsm_shutdown_try_shutdown (XfsmShutdown *shutdown,
+ return xfsm_shutdown_sudo_try_action (shutdown, XFSM_SHUTDOWN_SHUTDOWN, error);
+ else
+ #ifdef HAVE_SYSTEMD
+- return xfsm_systemd_try_shutdown (shutdown->systemd, error);
+-#else
+- return xfsm_consolekit_try_shutdown (shutdown->consolekit, error);
++ if (shutdown->systemd != NULL)
++ return xfsm_systemd_try_shutdown (shutdown->systemd, error);
++ else
+ #endif
++ return xfsm_consolekit_try_shutdown (shutdown->consolekit, error);
+ }
+
+
+@@ -692,6 +697,11 @@ xfsm_shutdown_try_suspend (XfsmShutdown *shutdown,
+ {
+ g_return_val_if_fail (XFSM_IS_SHUTDOWN (shutdown), FALSE);
+
++#ifdef HAVE_SYSTEMD
++ if (shutdown->systemd != NULL)
++ return xfsm_systemd_try_suspend (shutdown->systemd, error);
++ else
++#endif
+ return xfsm_upower_try_suspend (shutdown->upower, error);
+ }
+
+@@ -703,6 +713,11 @@ xfsm_shutdown_try_hibernate (XfsmShutdown *shutdown,
+ {
+ g_return_val_if_fail (XFSM_IS_SHUTDOWN (shutdown), FALSE);
+
++#ifdef HAVE_SYSTEMD
++ if (shutdown->systemd != NULL)
++ return xfsm_systemd_try_hibernate (shutdown->systemd, error);
++ else
++#endif
+ return xfsm_upower_try_hibernate (shutdown->upower, error);
+ }
+
+@@ -722,10 +737,14 @@ xfsm_shutdown_can_restart (XfsmShutdown *shutdown,
+ }
+
+ #ifdef HAVE_SYSTEMD
+- if (xfsm_systemd_can_restart (shutdown->systemd, can_restart, error))
+-#else
+- if (xfsm_consolekit_can_restart (shutdown->consolekit, can_restart, error))
++ if (shutdown->systemd != NULL)
++ {
++ if (xfsm_systemd_can_restart (shutdown->systemd, can_restart, error))
++ return TRUE;
++ }
++ else
+ #endif
++ if (xfsm_consolekit_can_restart (shutdown->consolekit, can_restart, error))
+ return TRUE;
+
+ if (xfsm_shutdown_sudo_init (shutdown, error))
+@@ -753,10 +772,14 @@ xfsm_shutdown_can_shutdown (XfsmShutdown *shutdown,
+ }
+
+ #ifdef HAVE_SYSTEMD
+- if (xfsm_systemd_can_shutdown (shutdown->systemd, can_shutdown, error))
+-#else
+- if (xfsm_consolekit_can_shutdown (shutdown->consolekit, can_shutdown, error))
++ if (shutdown->systemd != NULL)
++ {
++ if (xfsm_systemd_can_shutdown (shutdown->systemd, can_shutdown, error))
++ return TRUE;
++ }
++ else
+ #endif
++ if (xfsm_consolekit_can_shutdown (shutdown->consolekit, can_shutdown, error))
+ return TRUE;
+
+ if (xfsm_shutdown_sudo_init (shutdown, error))
+@@ -784,6 +807,12 @@ xfsm_shutdown_can_suspend (XfsmShutdown *shutdown,
+ return TRUE;
+ }
+
++#ifdef HAVE_SYSTEMD
++ if (shutdown->systemd != NULL)
++ return xfsm_systemd_can_suspend (shutdown->systemd, can_suspend,
++ auth_suspend, error);
++ else
++#endif
+ return xfsm_upower_can_suspend (shutdown->upower, can_suspend,
+ auth_suspend, error);
+ }
+@@ -804,6 +833,12 @@ xfsm_shutdown_can_hibernate (XfsmShutdown *shutdown,
+ return TRUE;
+ }
+
++#ifdef HAVE_SYSTEMD
++ if (shutdown->systemd != NULL)
++ return xfsm_systemd_can_hibernate (shutdown->systemd, can_hibernate,
++ auth_hibernate, error);
++ else
++#endif
+ return xfsm_upower_can_hibernate (shutdown->upower, can_hibernate,
+ auth_hibernate, error);
+ }
+diff --git a/xfce4-session/xfsm-systemd.c b/xfce4-session/xfsm-systemd.c
+index 7bdd39d..f18fbf7 100644
+--- a/xfce4-session/xfsm-systemd.c
++++ b/xfce4-session/xfsm-systemd.c
+@@ -24,6 +24,7 @@
+ #include <dbus/dbus-glib.h>
+ #include <dbus/dbus-glib-lowlevel.h>
+
++#include <libxfsm/xfsm-util.h>
+ #include <xfce4-session/xfsm-systemd.h>
+
+
+@@ -33,8 +34,12 @@
+ #define SYSTEMD_DBUS_INTERFACE "org.freedesktop.login1.Manager"
+ #define SYSTEMD_REBOOT_ACTION "Reboot"
+ #define SYSTEMD_POWEROFF_ACTION "PowerOff"
++#define SYSTEMD_SUSPEND_ACTION "Suspend"
++#define SYSTEMD_HIBERNATE_ACTION "Hibernate"
+ #define SYSTEMD_REBOOT_TEST "org.freedesktop.login1.reboot"
+ #define SYSTEMD_POWEROFF_TEST "org.freedesktop.login1.power-off"
++#define SYSTEMD_SUSPEND_TEST "org.freedesktop.login1.suspend"
++#define SYSTEMD_HIBERNATE_TEST "org.freedesktop.login1.hibernate"
+
+
+
+@@ -93,6 +98,22 @@ xfsm_systemd_finalize (GObject *object)
+ }
+
+
++
++static gboolean
++xfsm_systemd_lock_screen (GError **error)
++{
++ XfconfChannel *channel;
++ gboolean ret = TRUE;
++
++ channel = xfsm_open_config ();
++ if (xfconf_channel_get_bool (channel, "/shutdown/LockScreen", FALSE))
++ ret = g_spawn_command_line_async ("xflock4", error);
++
++ return ret;
++}
++
++
++
+ static gboolean
+ xfsm_systemd_can_method (XfsmSystemd *systemd,
+ gboolean *can_method,
+@@ -205,6 +226,34 @@ xfsm_systemd_try_shutdown (XfsmSystemd *systemd,
+
+
+ gboolean
++xfsm_systemd_try_suspend (XfsmSystemd *systemd,
++ GError **error)
++{
++ if (!xfsm_systemd_lock_screen (error))
++ return FALSE;
++
++ return xfsm_systemd_try_method (systemd,
++ SYSTEMD_SUSPEND_ACTION,
++ error);
++}
++
++
++
++gboolean
++xfsm_systemd_try_hibernate (XfsmSystemd *systemd,
++ GError **error)
++{
++ if (!xfsm_systemd_lock_screen (error))
++ return FALSE;
++
++ return xfsm_systemd_try_method (systemd,
++ SYSTEMD_HIBERNATE_ACTION,
++ error);
++}
++
++
++
++gboolean
+ xfsm_systemd_can_restart (XfsmSystemd *systemd,
+ gboolean *can_restart,
+ GError **error)
+@@ -227,3 +276,39 @@ xfsm_systemd_can_shutdown (XfsmSystemd *systemd,
+ SYSTEMD_POWEROFF_TEST,
+ error);
+ }
++
++
++
++gboolean
++xfsm_systemd_can_suspend (XfsmSystemd *systemd,
++ gboolean *can_suspend,
++ gboolean *auth_suspend,
++ GError **error)
++{
++ gboolean ret = FALSE;
++
++ ret = xfsm_systemd_can_method (systemd,
++ can_suspend,
++ SYSTEMD_SUSPEND_TEST,
++ error);
++ *auth_suspend = *can_suspend;
++ return ret;
++}
++
++
++
++gboolean
++xfsm_systemd_can_hibernate (XfsmSystemd *systemd,
++ gboolean *can_hibernate,
++ gboolean *auth_hibernate,
++ GError **error)
++{
++ gboolean ret = FALSE;
++
++ ret = xfsm_systemd_can_method (systemd,
++ can_hibernate,
++ SYSTEMD_HIBERNATE_TEST,
++ error);
++ *auth_hibernate = *can_hibernate;
++ return ret;
++}
+diff --git a/xfce4-session/xfsm-systemd.h b/xfce4-session/xfsm-systemd.h
+index 8223622..c5e74b5 100644
+--- a/xfce4-session/xfsm-systemd.h
++++ b/xfce4-session/xfsm-systemd.h
+@@ -22,6 +22,8 @@
+ #ifndef __XFSM_SYSTEMD_H__
+ #define __XFSM_SYSTEMD_H__
+
++#define LOGIND_RUNNING() (access ("/run/systemd/seats/", F_OK) >= 0)
++
+ typedef struct _XfsmSystemdClass XfsmSystemdClass;
+ typedef struct _XfsmSystemd XfsmSystemd;
+
+@@ -42,6 +44,12 @@ gboolean xfsm_systemd_try_restart (XfsmSystemd *systemd,
+ gboolean xfsm_systemd_try_shutdown (XfsmSystemd *systemd,
+ GError **error);
+
++gboolean xfsm_systemd_try_suspend (XfsmSystemd *systemd,
++ GError **error);
++
++gboolean xfsm_systemd_try_hibernate (XfsmSystemd *systemd,
++ GError **error);
++
+ gboolean xfsm_systemd_can_restart (XfsmSystemd *systemd,
+ gboolean *can_restart,
+ GError **error);
+@@ -50,6 +58,16 @@ gboolean xfsm_systemd_can_shutdown (XfsmSystemd *systemd,
+ gboolean *can_shutdown,
+ GError **error);
+
++gboolean xfsm_systemd_can_suspend (XfsmSystemd *systemd,
++ gboolean *can_suspend,
++ gboolean *auth_suspend,
++ GError **error);
++
++gboolean xfsm_systemd_can_hibernate (XfsmSystemd *systemd,
++ gboolean *can_hibernate,
++ gboolean *auth_hibernate,
++ GError **error);
++
+ G_END_DECLS
+
+ #endif /* __XFSM_SYSTEMD_H__ */
diff --git a/xfce-base/xfce4-session/files/xfce4-session-4.11.0-upower-0.99.0.patch b/xfce-base/xfce4-session/files/xfce4-session-4.11.0-upower-0.99.0.patch
new file mode 100644
index 000000000000..a5e59f47f11b
--- /dev/null
+++ b/xfce-base/xfce4-session/files/xfce4-session-4.11.0-upower-0.99.0.patch
@@ -0,0 +1,448 @@
+Patch from http://bugzilla.xfce.org/show_bug.cgi?id=9952 with modification
+to edit configure.ac (release tarball) instead of configure.ac.in (git)
+
+From 38afe446cdc889266f1e553952397cc4a876ecf8 Mon Sep 17 00:00:00 2001
+From: Eric Koegel <eric.koegel@gmail.com>
+Date: Mon, 7 Jul 2014 11:30:06 +0300
+Subject: [PATCH] Add suspend/hibernate to shutdown-helper
+
+Upower 0.99 dropped support for suspend/hibernate as an obsolete
+feature in this commit:
+http://cgit.freedesktop.org/upower/commit/?id=1ee642e705a63f5ad56a6b55e4bf5c4a64c959b8
+Add that functionality into the shutdown-helper so these features
+will work again. Additionally Upower is an optional build dependency
+and the minimum required is 0.9.7 to support FreeBSD 9 and 10.
+---
+ configure.ac.in | 30 ++++++++
+ xfce4-session/Makefile.am | 4 +-
+ xfce4-session/xfsm-shutdown.c | 167 +++++++++++++++++++++++++++++++++++++++++-
+ xfce4-session/xfsm-upower.c | 8 +-
+ xfce4-session/xfsm-upower.h | 4 +
+ xfsm-shutdown-helper/main.c | 26 +++++++
+ 6 files changed, 234 insertions(+), 5 deletions(-)
+
+diff --git a/configure.ac b/configure.ac
+index 910fd35..b9c9a90 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -96,6 +96,10 @@ XDT_CHECK_PACKAGE([DBUS], [dbus-1], [1.1.0])
+ XDT_CHECK_PACKAGE([DBUS_GLIB], [dbus-glib-1], [0.84])
+ XDT_CHECK_PACKAGE([XFCONF], [libxfconf-0], [4.9.0])
+
++dnl Check for Upower
++XDT_CHECK_OPTIONAL_PACKAGE([UPOWER],[upower-glib], [0.9.7],
++ [upower],[Upower support])
++
+ dnl Check for polkit / systemd integration
+ XDT_CHECK_OPTIONAL_PACKAGE([SYSTEMD], [polkit-gobject-1], [0.100],
+ [systemd], [Systemd support (through polit)])
+@@ -157,6 +161,31 @@ if test "x$linux_ioprio_works" = "xyes"; then
+ [Defined if linux/ioprio.h not only exists, but works properly])
+ fi
+
++dnl Compile time default choice of backend
++AC_ARG_WITH([backend],
++ AS_HELP_STRING([--with-backend=<option>],
++ [Default backend to use linux, freebsd, openbsd]))
++# default to a sane option
++AC_CANONICAL_HOST
++if test x$with_backend = x; then
++ AS_CASE([$host],
++ [*-linux*], [with_backend=linux],
++ [*-*freebsd*], [with_backend=freebsd],
++ [*-openbsd*], [with_backend=openbsd])
++fi
++AC_DEFINE_UNQUOTED(BACKEND, "$with_backend", [backend])
++AC_SUBST(BACKEND, "$with_backend")
++
++if test x$with_backend = xlinux; then
++ AC_DEFINE(BACKEND_TYPE_LINUX, 1, [Linux suspend/hibernate backend])
++fi
++if test x$with_backend = xfreebsd; then
++ AC_DEFINE(BACKEND_TYPE_FREEBSD, 1, [FreeBSD suspend/hibernate backend])
++fi
++if test x$with_backend = xopenbsd; then
++ AC_DEFINE(BACKEND_TYPE_OPENBSD, 1, [OpenBSD suspend/hibernate backend])
++fi
++
+ dnl check for location Xfce glade files were installed to
+ XFCE_GLADE_CATALOG_PATH="`pkg-config --variable glade_catalogdir libxfce4ui-1`"
+ XFCE_GLADE_PIXMAP_PATH="`pkg-config --variable glade_pixmapdir libxfce4ui-1`"
+@@ -207,5 +236,6 @@ echo " * Gnome Keyring support: yes"
+ else
+ echo " * Gnome Keyring support: no"
+ fi
++echo " * Backend: ${with_backend}"
+
+ echo
+diff --git a/xfce4-session/Makefile.am b/xfce4-session/Makefile.am
+index 5472b33..6b5968e 100644
+--- a/xfce4-session/Makefile.am
++++ b/xfce4-session/Makefile.am
+@@ -83,7 +83,8 @@ xfce4_session_CFLAGS = \
+ $(SYSTEMD_CFLAGS) \
+ $(XFCONF_CFLAGS) \
+ $(GMODULE_CFLAGS) \
+- $(PLATFORM_CFLAGS)
++ $(PLATFORM_CFLAGS) \
++ $(UPOWER_CFLAGS)
+
+ xfce4_session_LDFLAGS = \
+ -no-undefined \
+@@ -102,6 +103,7 @@ xfce4_session_LDADD = \
+ $(LIBWNCK_LIBS) \
+ $(SYSTEMD_LIBS) \
+ $(XFCONF_LIBS) \
++ $(UPOWER_LIBS) \
+ -lm
+
+ xfce4_session_DEPENDENCIES = \
+diff --git a/xfce4-session/xfsm-shutdown.c b/xfce4-session/xfsm-shutdown.c
+index 4c483a7..24b548e 100644
+--- a/xfce4-session/xfsm-shutdown.c
++++ b/xfce4-session/xfsm-shutdown.c
+@@ -57,6 +57,9 @@
+ #include <dbus/dbus-glib-lowlevel.h>
+ #include <libxfce4util/libxfce4util.h>
+ #include <gtk/gtk.h>
++#ifdef HAVE_UPOWER
++#include <upower.h>
++#endif
+
+ #include <libxfsm/xfsm-util.h>
+
+@@ -76,6 +79,8 @@
+
+ static void xfsm_shutdown_finalize (GObject *object);
+ static void xfsm_shutdown_sudo_free (XfsmShutdown *shutdown);
++static gboolean xfsm_shutdown_fallback_can_hibernate (void);
++static gboolean xfsm_shutdown_fallback_can_suspend (void);
+
+
+
+@@ -403,14 +408,16 @@ xfsm_shutdown_sudo_try_action (XfsmShutdown *shutdown,
+ g_return_val_if_fail (shutdown->helper_state == SUDO_AVAILABLE, FALSE);
+ g_return_val_if_fail (shutdown->helper_outfile != NULL, FALSE);
+ g_return_val_if_fail (shutdown->helper_infile != NULL, FALSE);
+- g_return_val_if_fail (type == XFSM_SHUTDOWN_SHUTDOWN
+- || type == XFSM_SHUTDOWN_RESTART, FALSE);
+
+ /* the command we send to sudo */
+ if (type == XFSM_SHUTDOWN_SHUTDOWN)
+ action = "POWEROFF";
+ else if (type == XFSM_SHUTDOWN_RESTART)
+ action = "REBOOT";
++ else if (type == XFSM_SHUTDOWN_SUSPEND)
++ action = "SUSPEND";
++ else if (type == XFSM_SHUTDOWN_HIBERNATE)
++ action = "HIBERNATE";
+ else
+ return FALSE;
+
+@@ -692,7 +699,19 @@ xfsm_shutdown_try_suspend (XfsmShutdown *shutdown,
+ {
+ g_return_val_if_fail (XFSM_IS_SHUTDOWN (shutdown), FALSE);
+
++#ifdef HAVE_UPOWER
++#if !UP_CHECK_VERSION(0, 99, 0)
+ return xfsm_upower_try_suspend (shutdown->upower, error);
++#endif /* UP_CHECK_VERSION */
++#endif /* HAVE_UPOWER */
++
++ if (shutdown->helper_state == SUDO_AVAILABLE)
++ {
++ xfsm_upower_lock_screen (shutdown->upower, "Suspend", error);
++ return xfsm_shutdown_sudo_try_action (shutdown, XFSM_SHUTDOWN_SUSPEND, error);
++ }
++ else
++ return FALSE;
+ }
+
+
+@@ -703,7 +722,19 @@ xfsm_shutdown_try_hibernate (XfsmShutdown *shutdown,
+ {
+ g_return_val_if_fail (XFSM_IS_SHUTDOWN (shutdown), FALSE);
+
++#ifdef HAVE_UPOWER
++#if !UP_CHECK_VERSION(0, 99, 0)
+ return xfsm_upower_try_hibernate (shutdown->upower, error);
++#endif /* UP_CHECK_VERSION */
++#endif /* HAVE_UPOWER */
++
++ if (shutdown->helper_state == SUDO_AVAILABLE)
++ {
++ xfsm_upower_lock_screen (shutdown->upower, "Hibernate", error);
++ return xfsm_shutdown_sudo_try_action (shutdown, XFSM_SHUTDOWN_HIBERNATE, error);
++ }
++ else
++ return FALSE;
+ }
+
+
+@@ -784,8 +815,15 @@ xfsm_shutdown_can_suspend (XfsmShutdown *shutdown,
+ return TRUE;
+ }
+
++#ifdef HAVE_UPOWER
++#if !UP_CHECK_VERSION(0, 99, 0)
+ return xfsm_upower_can_suspend (shutdown->upower, can_suspend,
+ auth_suspend, error);
++#endif /* UP_CHECK_VERSION */
++#endif /* HAVE_UPOWER */
++
++ *can_suspend = xfsm_shutdown_fallback_can_suspend ();
++ return TRUE;
+ }
+
+
+@@ -804,8 +842,15 @@ xfsm_shutdown_can_hibernate (XfsmShutdown *shutdown,
+ return TRUE;
+ }
+
++#ifdef HAVE_UPOWER
++#if !UP_CHECK_VERSION(0, 99, 0)
+ return xfsm_upower_can_hibernate (shutdown->upower, can_hibernate,
+ auth_hibernate, error);
++#endif /* UP_CHECK_VERSION */
++#endif /* HAVE_UPOWER */
++
++ *can_hibernate = xfsm_shutdown_fallback_can_hibernate ();
++ return TRUE;
+ }
+
+
+@@ -816,3 +861,121 @@ xfsm_shutdown_can_save_session (XfsmShutdown *shutdown)
+ g_return_val_if_fail (XFSM_IS_SHUTDOWN (shutdown), FALSE);
+ return shutdown->kiosk_can_save_session;
+ }
++
++
++
++#ifdef BACKEND_TYPE_FREEBSD
++static gchar *
++get_string_sysctl (GError **err, const gchar *format, ...)
++{
++ va_list args;
++ gchar *name;
++ size_t value_len;
++ gchar *str = NULL;
++
++ g_return_val_if_fail(format != NULL, FALSE);
++
++ va_start (args, format);
++ name = g_strdup_vprintf (format, args);
++ va_end (args);
++
++ if (sysctlbyname (name, NULL, &value_len, NULL, 0) == 0) {
++ str = g_new (char, value_len + 1);
++ if (sysctlbyname (name, str, &value_len, NULL, 0) == 0)
++ str[value_len] = 0;
++ else {
++ g_free (str);
++ str = NULL;
++ }
++ }
++
++ if (!str)
++ g_set_error (err, 0, 0, "%s", g_strerror(errno));
++
++ g_free(name);
++ return str;
++}
++
++
++
++static gboolean
++freebsd_supports_sleep_state (const gchar *state)
++{
++ gboolean ret = FALSE;
++ gchar *sleep_states;
++
++ sleep_states = get_string_sysctl (NULL, "hw.acpi.supported_sleep_state");
++ if (sleep_states != NULL)
++ {
++ if (strstr (sleep_states, state) != NULL)
++ ret = TRUE;
++ }
++
++ g_free (sleep_states);
++
++ return ret;
++}
++#endif /* BACKEND_TYPE_FREEBSD */
++
++
++
++#ifdef BACKEND_TYPE_LINUX
++static gboolean
++linux_supports_sleep_state (const gchar *state)
++{
++ gboolean ret = FALSE;
++ gchar *command;
++ GError *error = NULL;
++ gint exit_status;
++
++ /* run script from pm-utils */
++ command = g_strdup_printf ("/usr/bin/pm-is-supported --%s", state);
++
++ ret = g_spawn_command_line_sync (command, NULL, NULL, &exit_status, &error);
++ if (!ret)
++ {
++ g_warning ("failed to run script: %s", error->message);
++ g_error_free (error);
++ goto out;
++ }
++ ret = (WIFEXITED(exit_status) && (WEXITSTATUS(exit_status) == EXIT_SUCCESS));
++
++out:
++ g_free (command);
++
++ return ret;
++}
++#endif /* BACKEND_TYPE_LINUX */
++
++
++static gboolean
++xfsm_shutdown_fallback_can_suspend (void)
++{
++#ifdef BACKEND_TYPE_FREEBSD
++ return freebsd_supports_sleep_state ("S3");
++#endif
++#ifdef BACKEND_TYPE_LINUX
++ return linux_supports_sleep_state ("suspend");
++#endif
++#ifdef BACKEND_TYPE_OPENBSD
++ return TRUE;
++#endif
++
++ return FALSE;
++}
++
++static gboolean
++xfsm_shutdown_fallback_can_hibernate (void)
++{
++#ifdef BACKEND_TYPE_FREEBSD
++ return freebsd_supports_sleep_state ("S4");
++#endif
++#ifdef BACKEND_TYPE_LINUX
++ return linux_supports_sleep_state ("hibernate");
++#endif
++#ifdef BACKEND_TYPE_OPENBSD
++ return FALSE;
++#endif
++
++ return FALSE;
++}
+diff --git a/xfce4-session/xfsm-upower.c b/xfce4-session/xfsm-upower.c
+index 57402ec..2960943 100644
+--- a/xfce4-session/xfsm-upower.c
++++ b/xfce4-session/xfsm-upower.c
+@@ -21,6 +21,7 @@
+
+ #include <dbus/dbus-glib.h>
+ #include <dbus/dbus-glib-lowlevel.h>
++#include <upower.h>
+
+ #include <libxfsm/xfsm-util.h>
+ #include <xfce4-session/xfsm-upower.h>
+@@ -283,14 +284,13 @@ xfsm_upower_try_method (XfsmUPower *upower,
+
+
+
+-static gboolean
++gboolean
+ xfsm_upower_lock_screen (XfsmUPower *upower,
+ const gchar *sleep_kind,
+ GError **error)
+ {
+ XfconfChannel *channel;
+ gboolean ret = TRUE;
+- GError *err = NULL;
+
+ g_return_val_if_fail (sleep_kind != NULL, FALSE);
+
+@@ -299,6 +299,9 @@ xfsm_upower_lock_screen (XfsmUPower *upower,
+ {
+ if (xfsm_upower_proxy_ensure (upower, error))
+ {
++#if !UP_CHECK_VERSION(0, 99, 0)
++ GError *err = NULL;
++
+ /* tell upower we're going to sleep, this saves some
+ * time while we sleep 1 second if xflock4 is spawned */
+ ret = dbus_g_proxy_call (upower->upower_proxy,
+@@ -312,6 +315,7 @@ xfsm_upower_lock_screen (XfsmUPower *upower,
+ g_warning ("Couldn't sent that we were about to sleep: %s", err->message);
+ g_error_free (err);
+ }
++#endif
+ }
+ else
+ {
+diff --git a/xfce4-session/xfsm-upower.h b/xfce4-session/xfsm-upower.h
+index a492f7d..4e6a53b 100644
+--- a/xfce4-session/xfsm-upower.h
++++ b/xfce4-session/xfsm-upower.h
+@@ -51,4 +51,8 @@ gboolean xfsm_upower_can_hibernate (XfsmUPower *upower,
+ gboolean *auth_hibernate,
+ GError **error);
+
++gboolean xfsm_upower_lock_screen (XfsmUPower *upower,
++ const gchar *sleep_kind,
++ GError **error);
++
+ #endif /* !__XFSM_UPOWER_HELPER_H__ */
+diff --git a/xfsm-shutdown-helper/main.c b/xfsm-shutdown-helper/main.c
+index 667f288..60c621b 100644
+--- a/xfsm-shutdown-helper/main.c
++++ b/xfsm-shutdown-helper/main.c
+@@ -57,6 +57,12 @@
+ #ifdef REBOOT_CMD
+ #undef REBOOT_CMD
+ #endif
++#ifdef UP_BACKEND_SUSPEND_COMMAND
++#undef UP_BACKEND_SUSPEND_COMMAND
++#endif
++#ifdef UP_BACKEND_HIBERNATE_COMMAND
++#undef UP_BACKEND_HIBERNATE_COMMAND
++#endif
+
+ #if defined(__DragonFly__) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__)
+ #define POWEROFF_CMD "/sbin/shutdown -p now"
+@@ -68,6 +74,18 @@
+ #define POWEROFF_CMD "/sbin/shutdown -h now"
+ #define REBOOT_CMD "/sbin/shutdown -r now"
+ #endif
++#ifdef BACKEND_TYPE_FREEBSD
++#define UP_BACKEND_SUSPEND_COMMAND "/usr/sbin/zzz"
++#define UP_BACKEND_HIBERNATE_COMMAND "/usr/sbin/acpiconf -s 4"
++#endif
++#if BACKEND_TYPE_LINUX
++#define UP_BACKEND_SUSPEND_COMMAND "/usr/sbin/pm-suspend"
++#define UP_BACKEND_HIBERNATE_COMMAND "/usr/sbin/pm-hibernate"
++#endif
++#ifdef BACKEND_TYPE_OPENBSD
++#define UP_BACKEND_SUSPEND_COMMAND "/usr/sbin/zzz"
++#define UP_BACKEND_HIBERNATE_COMMAND "/dev/null"
++#endif
+
+
+ static gboolean
+@@ -143,6 +161,14 @@ main (int argc, char **argv)
+ {
+ succeed = run (REBOOT_CMD);
+ }
++ else if (strncasecmp (action, "SUSPEND", 7) == 0)
++ {
++ succeed = run (UP_BACKEND_SUSPEND_COMMAND);
++ }
++ else if (strncasecmp (action, "HIBERNATE", 9) == 0)
++ {
++ succeed = run (UP_BACKEND_HIBERNATE_COMMAND);
++ }
+
+ if (succeed)
+ {
+--
+2.0.0
+
diff --git a/xfce-base/xfce4-session/metadata.xml b/xfce-base/xfce4-session/metadata.xml
new file mode 100644
index 000000000000..008cf479f615
--- /dev/null
+++ b/xfce-base/xfce4-session/metadata.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <maintainer>
+ <email>xfce@gentoo.org</email>
+ <name>XFCE Team</name>
+ </maintainer>
+</pkgmetadata>
diff --git a/xfce-base/xfce4-session/xfce4-session-4.10.1-r2.ebuild b/xfce-base/xfce4-session/xfce4-session-4.10.1-r2.ebuild
new file mode 100644
index 000000000000..5df211151ab0
--- /dev/null
+++ b/xfce-base/xfce4-session/xfce4-session-4.10.1-r2.ebuild
@@ -0,0 +1,71 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+EAUTORECONF=1
+inherit xfconf
+
+DESCRIPTION="A session manager for the Xfce desktop environment"
+HOMEPAGE="http://docs.xfce.org/xfce/xfce4-session/start"
+SRC_URI="mirror://xfce/src/xfce/${PN}/${PV%.*}/${P}.tar.bz2"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="alpha amd64 arm hppa ia64 ~mips ppc ppc64 sparc x86 ~x86-fbsd ~x86-freebsd ~x86-interix ~amd64-linux ~x86-linux ~x86-solaris"
+IUSE="debug nls systemd upower +xscreensaver"
+
+COMMON_DEPEND=">=dev-libs/dbus-glib-0.100
+ x11-apps/iceauth
+ x11-libs/libSM
+ >=x11-libs/libwnck-2.30:1
+ x11-libs/libX11
+ >=xfce-base/libxfce4util-4.10.1
+ >=xfce-base/libxfce4ui-4.10
+ >=xfce-base/xfconf-4.10
+ !xfce-base/xfce-utils
+ systemd? ( >=sys-auth/polkit-0.100 )"
+RDEPEND="${COMMON_DEPEND}
+ x11-apps/xrdb
+ nls? ( x11-misc/xdg-user-dirs )
+ upower? (
+ systemd? ( || ( >=sys-power/upower-0.9.23 sys-power/upower-pm-utils ) )
+ !systemd? ( sys-power/upower-pm-utils )
+ )
+ xscreensaver? ( || (
+ >=x11-misc/xscreensaver-5.26
+ gnome-extra/gnome-screensaver
+ >=x11-misc/xlockmore-5.43
+ x11-misc/slock
+ x11-misc/alock[pam]
+ ) )"
+DEPEND="${COMMON_DEPEND}
+ dev-util/intltool
+ sys-devel/gettext
+ virtual/pkgconfig"
+
+pkg_setup() {
+ PATCHES=(
+ "${FILESDIR}"/${P}-alock_support_to_xflock4.patch
+ "${FILESDIR}"/${P}-systemd.patch
+ )
+
+ XFCONF=(
+ --docdir="${EPREFIX}"/usr/share/doc/${PF}
+ $(use_enable systemd)
+ --with-xsession-prefix="${EPREFIX}"/usr
+ $(xfconf_use_debug)
+ )
+
+ DOCS=( AUTHORS BUGS ChangeLog NEWS README TODO )
+}
+
+src_install() {
+ xfconf_src_install
+
+ local sessiondir=/etc/X11/Sessions
+ echo startxfce4 > "${T}"/Xfce4
+ exeinto ${sessiondir}
+ doexe "${T}"/Xfce4
+ dosym Xfce4 ${sessiondir}/Xfce
+}
diff --git a/xfce-base/xfce4-session/xfce4-session-4.12.1.ebuild b/xfce-base/xfce4-session/xfce4-session-4.12.1.ebuild
new file mode 100644
index 000000000000..eba4548fef0e
--- /dev/null
+++ b/xfce-base/xfce4-session/xfce4-session-4.12.1.ebuild
@@ -0,0 +1,71 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+EAUTORECONF=1
+inherit xfconf
+
+DESCRIPTION="A session manager for the Xfce desktop environment"
+HOMEPAGE="http://docs.xfce.org/xfce/xfce4-session/start"
+SRC_URI="mirror://xfce/src/xfce/${PN}/${PV%.*}/${P}.tar.bz2"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="alpha amd64 arm ~arm64 hppa ia64 ~mips ppc ppc64 ~sparc x86 ~x86-fbsd ~x86-freebsd ~x86-interix ~amd64-linux ~x86-linux ~x86-solaris"
+IUSE="debug nls policykit systemd upower +xscreensaver"
+
+COMMON_DEPEND=">=dev-libs/dbus-glib-0.100:=
+ x11-apps/iceauth
+ x11-libs/libSM:=
+ >=x11-libs/libwnck-2.30:1=
+ x11-libs/libX11:=
+ >=xfce-base/libxfce4util-4.11:=
+ >=xfce-base/libxfce4ui-4.12.1:=
+ >=xfce-base/xfconf-4.10:=
+ !xfce-base/xfce-utils
+ !=xfce-base/libxfce4ui-4.12.0
+ policykit? ( >=sys-auth/polkit-0.102:= )
+ upower? ( || ( >=sys-power/upower-0.9.23 sys-power/upower-pm-utils ) )"
+RDEPEND="${COMMON_DEPEND}
+ x11-apps/xrdb
+ nls? ( x11-misc/xdg-user-dirs )
+ !systemd? ( upower? ( sys-power/pm-utils ) )
+ xscreensaver? ( || (
+ >=x11-misc/xscreensaver-5.26
+ gnome-extra/gnome-screensaver
+ >=x11-misc/xlockmore-5.43
+ x11-misc/slock
+ x11-misc/alock[pam]
+ ) )"
+DEPEND="${COMMON_DEPEND}
+ dev-util/intltool
+ sys-devel/gettext
+ virtual/pkgconfig"
+
+REQUIRED_USE="systemd? ( policykit )"
+
+pkg_setup() {
+ PATCHES=( "${FILESDIR}"/${PN}-4.10.1-alock_support_to_xflock4.patch )
+
+ XFCONF=(
+ --docdir="${EPREFIX}"/usr/share/doc/${PF}
+ $(use_enable policykit polkit)
+ --with-xsession-prefix="${EPREFIX}"/usr
+ $(xfconf_use_debug)
+ )
+
+ use upower && XFCONF+=( --enable-upower )
+
+ DOCS=( AUTHORS BUGS ChangeLog NEWS README TODO )
+}
+
+src_install() {
+ xfconf_src_install
+
+ local sessiondir=/etc/X11/Sessions
+ echo startxfce4 > "${T}"/Xfce4
+ exeinto ${sessiondir}
+ doexe "${T}"/Xfce4
+ dosym Xfce4 ${sessiondir}/Xfce
+}