On Sun, May 16, 2010 at 04:50:26PM +0200, Guido Günther wrote: > Package: kdebase-workspace-bin > Version: 4:4.3.4-5+b1 > Severity: normal > > Hi, > KDisplayManager::canShutdown() doesn't know how to shutdown the system > when using gdm3. The result is that the logout-menu doesn't offer > "shutdown" so one has to logout first and shutdown via gdm. Attached patch applies the Fedora patch to 4:4.4.3-1 0. Works fine with gdm3. Please apply. Cheers, -- Guido
>From 372212b9a5ec3cbb0e8aa8891139818c80937e14 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Guido=20G=C3=BCnther?= <a...@sigxcpu.org> Date: Mon, 17 May 2010 16:26:22 +0200 Subject: [PATCH] Use ConsoleKit fur shutdown with gdm3
--- .../99-Use-ConsoleKit-fur-shutdown-with-gdm3.patch | 77 ++++++++++++++++++++ debian/patches/series | 1 + 2 files changed, 78 insertions(+), 0 deletions(-) create mode 100644 debian/patches/99-Use-ConsoleKit-fur-shutdown-with-gdm3.patch diff --git a/debian/patches/99-Use-ConsoleKit-fur-shutdown-with-gdm3.patch b/debian/patches/99-Use-ConsoleKit-fur-shutdown-with-gdm3.patch new file mode 100644 index 0000000..3f194a4 --- /dev/null +++ b/debian/patches/99-Use-ConsoleKit-fur-shutdown-with-gdm3.patch @@ -0,0 +1,77 @@ +From 9c7a4c98f3a51cdc53c3b73b124c79c4ff29fe50 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Guido=20G=C3=BCnther?= <a...@sigxcpu.org> +Date: Mon, 17 May 2010 16:24:16 +0200 +Subject: [PATCH] Use ConsoleKit fur shutdown with gdm3 + +Closes: #581841 +--- + libs/kworkspace/kdisplaymanager.cpp | 32 ++++++++++++++++++++++++++++++++ + 1 files changed, 32 insertions(+), 0 deletions(-) + +diff --git a/libs/kworkspace/kdisplaymanager.cpp b/libs/kworkspace/kdisplaymanager.cpp +index 45d6133..63defc7 100644 +--- a/libs/kworkspace/kdisplaymanager.cpp ++++ b/libs/kworkspace/kdisplaymanager.cpp +@@ -26,6 +26,7 @@ + #include <QtDBus/QtDBus> + + #include <QRegExp> ++#include <QLatin1String> + + #include <X11/Xauth.h> + #include <X11/Xlib.h> +@@ -85,6 +86,7 @@ KDisplayManager::KDisplayManager() : d(new Private) + strcpy( sa.sun_path, "/tmp/.gdm_socket" ); + if (::connect( d->fd, (struct sockaddr *)&sa, sizeof(sa) )) { + ::close( d->fd ); ++ DMType = NoDM; + d->fd = -1; + break; + } +@@ -186,6 +188,21 @@ KDisplayManager::exec( const char *cmd, QByteArray &buf ) + bool + KDisplayManager::canShutdown() + { ++ if (DMType == NoDM) { ++ // No DM or newest GDM running, we'll try shutting down through ConsoleKit. ++ // Unfortunately, ConsoleKit won't tell us if we're allowed to do that ++ // (it also depends on whether there are other users logged in on the ++ // system), so we can only check if it's running at all. ++ QDBusConnection systemBus = QDBusConnection::systemBus(); ++ if (!systemBus.isConnected()) ++ return false; ++ QDBusInterface consoleKit( QLatin1String( "org.freedesktop.ConsoleKit" ), ++ QLatin1String( "/org/freedesktop/ConsoleKit/Manager" ), ++ QLatin1String( "org.freedesktop.ConsoleKit.Manager" ), ++ systemBus ); ++ return consoleKit.isValid(); ++ } ++ + if (DMType == OldKDM) + return strstr( ctl, ",maysd" ) != 0; + +@@ -205,6 +222,21 @@ KDisplayManager::shutdown( KWorkSpace::ShutdownType shutdownType, + if (shutdownType == KWorkSpace::ShutdownTypeNone || shutdownType == KWorkSpace::ShutdownTypeLogout) + return; + ++ if (DMType == NoDM) { ++ // No DM or newest GDM running, try shutting down through ConsoleKit. ++ QDBusConnection systemBus = QDBusConnection::systemBus(); ++ if (!systemBus.isConnected()) ++ return; ++ QDBusInterface consoleKit( QLatin1String( "org.freedesktop.ConsoleKit" ), ++ QLatin1String( "/org/freedesktop/ConsoleKit/Manager" ), ++ QLatin1String( "org.freedesktop.ConsoleKit.Manager" ), ++ systemBus ); ++ if (consoleKit.isValid()) ++ consoleKit.call( QLatin1String( shutdownType == KWorkSpace::ShutdownTypeReboot ? ++ "Restart" : "Stop" ) ); ++ return; ++ } ++ + bool cap_ask; + if (DMType == NewKDM) { + QByteArray re; +-- +1.7.1 + diff --git a/debian/patches/series b/debian/patches/series index 138f89a..51fea0f 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -13,3 +13,4 @@ 26_run_kaboom_when_starting_kde.diff 97_fix_target_link_libraries.diff 27_ld_exclude_libs_qtuitools.diff +99-Use-ConsoleKit-fur-shutdown-with-gdm3.patch -- 1.7.1