EggSMClient is a proposed replacement for GnomeClient, targeted for gtk or glib.

Bugzilla: 79285 Git: libegg/libegg/smclient

Current Status

See the README for an overview, including help on porting from GnomeClient.

There are four working backends: XSMP, D-Bus (for use with gnome-session >= 2.24 only), Windows, and OS X. All four backends support logout notification and cancellation. Only the XSMP backend supports state saving.

(Two additional possible backends: Windows non-GUI, and D-Bus to ksmserver, both of which would support only logout notification, without allowing cancellation.)

There is currently no way to delay session manager registration until main loop time, which is important for applications that start in early phases. (This is because we need to guarantee that we have the application's sm_client_id before the app creates any GtkWindows.) However, for apps that are started with DESKTOP_AUTOSTART_ID, we know the client id without having to register first, so we could delay registration in that case.

Problems / Disputes / Controversies / Flamewars / Holy Wars / Bikeshedding

Most of the discussion in 79285 revolves around how application state saving should work. There is not much consensus beyond "in the general case, it has never worked right in GNOME, although it worked well enough for certain people to be happy with it" and "if we had a working GtkApplicationClass it would make this argument easier". It is possible that the current brokenness of gnome-session wrt saved sessions will resolve the debate for us.

The allow-any-app-to-interact-at-logout-time nature of XSMP (and by extension, EggSMClient) does not work well with scenarios like fast user switching, where a user may want to reboot the machine when another user is logged in but switched-away-from. In this case, a more inhibit-like approach would work better (where apps would have to proactively tell the session manager that they do not want to be logged out, which would then let the session manager communicate this to gdm, which could communicate it to the other session). This is also the preferred API in Windows Vista. If EggSMClient switched to an inhibit-based API, it could still work with non-inhibit-based systems (XSMP and OS X) by just blocking logout the way it does now if the application has told it to inhibit.

Migrating EggSMClient from libegg to the real world

It's not totally clear where EggSMClient wants to go. There is some argument for putting it in glib; its public API does not depend on anything beyond gobject, and there are applications that do not link against gtk, but that want to be signaled when the session is about to end so they can exit cleanly. (This is the reason for the new gnome-session D-Bus SessionOver signal. Windows also has a separate API that can be used by non-GUI apps that want logout notification.)

OTOH, having the EggSMClient signals do gdk_threads_enter/leave automatically is nice, and if we put EggSMClientDBus into glib, we'd have to add extra gunk to be able to register additional backends (XSMP, Win32, OSX) from gtk. So it's probably simplest to put it in Gtk.

We may want to dlopen libSM rather than linking to it? It should also probably be possible to compile without XSMP or without D-Bus, for environments where only one or the other is useful. (Of course, if glib doesn't pick up a D-Bus dependency, then we'll need to dlopen libdbus too.)

Putting XSMP/ICE handling into gtk (or glib) will potentially cause problems with other implementations of XSMP (notably GnomeClient, but also various other apps, including some XFCE stuff). There are various annoying hoops we must jump through to prevent crashes in this case. Another possibility would be to make GtkSMClient default to not connecting to the session manager at all, and require the application to explicitly request it. (This is less problematic if we are not supporting any sort of session saving, though there may still be reasons it's nice to have all apps connect to the session manager; eg, to be able to show the current session in the session capplet, and tell it to make a certain app be autostarted.)

Projects/SessionManagement/EggSMClient (last edited 2013-11-22 17:55:55 by WilliamJonMcCann)