Hi Michael,

Michael Biebl [2008-07-19  3:48 +0200]:
> Could you please provide a link to the gdm patch.

Attached.

> I'm still not sure, why this is a consolekit bug at all and not
> solely a  gdm issue. Could you please elaborate, why this requires a
> fix in  consolekit?

It's not really a bug, it's an additional feature to support the way
the old gdm (2.20, as we have in Debian/Ubuntu) works. That does not
run a real desktop session for the greeter/password UI, so you cannot
e. g. switch virtual consoles under gdm without the CK/gdm patches. VT
I also remember problems with returning to the gdm screen once an
user session ended, but that was not 100% reproducible (VT switch race
condition with ConsoleKit, I guess).

It's been a while since we applied this, and the patches were
definitively necessary at that time. gdm didn't change a lot since
then, but CK did. If you don't have these kind of VT switching
problems at all in Debian, then please feel free to ignore those.

James Westby [2008-07-21 14:00 +0100]:
> This is more of a workaround I think. I'm not sure approach was
> taken in the new gdm to mean that this is not needed.

The new gdm (2.22) runs a real GNOME session for its UI, including
gnome-power-manager and all that. As such, it automatically gets a
proper ConsoleKit session, unlike gdm itself, which has to register
one for itself manually.

Disclaimer: I didn't write these patches myself, so I never really
understood them fully. It might be enough to just add a CK registering
call to gdm without that CK patch.

Thanks,

Martin

-- 
Martin Pitt                        | http://www.piware.de
Ubuntu Developer (www.ubuntu.com)  | Debian Developer  (www.debian.org)
diff --exclude=rules -ru orig/gdm-2.19.4/daemon/gdmconsolekit.c gdm-2.19.4/daemon/gdmconsolekit.c
--- orig/gdm-2.19.4/daemon/gdmconsolekit.c	2007-07-10 00:16:14.000000000 +0100
+++ gdm-2.19.4/daemon/gdmconsolekit.c	2007-07-31 19:37:22.000000000 +0100
@@ -31,6 +31,7 @@
 #include <dbus/dbus-glib-lowlevel.h>
 
 #include "gdm-log.h" /* for gdm_debug */
+#include "slave.h"
 #include "gdmconsolekit.h"
 
 
@@ -348,6 +349,68 @@
 }
 
 void
+notify_ck_parking_place (GdmDisplay *d)
+{
+	DBusError       error;
+	DBusConnection *connection = NULL;
+	gchar          *device_name = NULL;
+	DBusMessage    *message = NULL;
+	DBusMessage    *reply = NULL;
+	DBusMessageIter iter;
+
+	dbus_error_init (&error);
+
+	if (d->name == NULL) goto xit;
+	if (!d->attached) goto xit;
+	if (d->vtnum == -1) goto xit;
+
+	device_name = gdm_slave_get_display_device (d);
+	if (device_name == NULL) goto xit;
+
+	connection = dbus_bus_get_private (DBUS_BUS_SYSTEM, &error);
+	if (connection == NULL) {
+		gdm_debug ("ConsoleKit: Failed to connect to the D-Bus daemon for SetX11ParkingPlace: %s", error.message);
+		goto xit;
+	}
+
+	dbus_connection_set_exit_on_disconnect (connection, FALSE);
+	dbus_connection_setup_with_g_main (connection, NULL);
+	
+	message = dbus_message_new_method_call (CK_NAME,
+						CK_MANAGER_PATH,
+						CK_MANAGER_INTERFACE,
+						"SetX11ParkingPlace");
+	if (message == NULL) {
+		gdm_debug ("ConsoleKit: Couldn't allocate the D-Bus message"
+			   " for SetX11ParkingPlace");
+		goto xit;
+	}
+
+	dbus_message_iter_init_append (message, &iter);
+	dbus_message_iter_append_basic (&iter,
+					DBUS_TYPE_STRING,
+					&d->name);
+	dbus_message_iter_append_basic (&iter,
+					DBUS_TYPE_STRING,
+					&device_name);
+	reply = dbus_connection_send_with_reply_and_block (connection,
+							   message,
+							   -1, &error);
+	if (dbus_error_is_set (&error)) {
+		gdm_debug ("ConsoleKit: %s raised by SetX11ParkingPlace:\n %s\n\n", error.name, error.message);
+		reply = NULL;
+	}
+
+xit:
+	if (connection) dbus_connection_flush (connection);
+	if (message) dbus_message_unref (message);
+	if (reply) dbus_message_unref (reply);
+	dbus_error_free (&error);
+        if (connection) dbus_connection_close (connection);
+	g_free (device_name);
+}
+
+void
 unlock_ck_session (const char *user,
 		   const char *x11_display)
 {
Only in gdm-2.19.4/daemon: gdmconsolekit.c~
diff --exclude=rules -ru orig/gdm-2.19.4/daemon/gdmconsolekit.h gdm-2.19.4/daemon/gdmconsolekit.h
--- orig/gdm-2.19.4/daemon/gdmconsolekit.h	2007-07-10 00:16:14.000000000 +0100
+++ gdm-2.19.4/daemon/gdmconsolekit.h	2007-07-31 19:06:35.000000000 +0100
@@ -34,6 +34,7 @@
 void        close_ck_session      (const char    *cookie);
 void        unlock_ck_session     (const char    *user,
                                    const char    *x11_display);
+void        notify_ck_parking_place (GdmDisplay *display);
 
 G_END_DECLS
 
Only in gdm-2.19.4/daemon: gdmconsolekit.h~
diff --exclude=rules -ru orig/gdm-2.19.4/daemon/slave.c gdm-2.19.4/daemon/slave.c
--- orig/gdm-2.19.4/daemon/slave.c	2007-07-10 00:16:14.000000000 +0100
+++ gdm-2.19.4/daemon/slave.c	2007-07-31 18:18:50.000000000 +0100
@@ -2594,6 +2594,10 @@
 	const char *gdmlang;
 
 	gdm_debug ("gdm_slave_greeter: Running greeter on %s", d->name);
+#ifdef WITH_CONSOLE_KIT
+	if (d->type == TYPE_STATIC)
+		notify_ck_parking_place (d);
+#endif
 
 	/* Run the init script. gdmslave suspends until script has terminated */
 	gdm_slave_exec_script (d, gdm_daemon_config_get_value_string (GDM_KEY_DISPLAY_INIT_DIR),
Only in gdm-2.19.4/daemon: slave.c~
Only in gdm-2.19.4/debian: rules~

Attachment: signature.asc
Description: Digital signature

Reply via email to