Community
Participate
Working Groups
On OS X the display's Close listener is invoked when shutting down the system. It would be nice if that also would occur for Linux.
Nikita, are you interested in providing a patch for this one?
As a note, Nikita mentioned: "GTK has g_unix_signal_add() that dispatches a callback to the GUI thread. SWT could use it to send Close and dispose the display."
I've looked into this and here's what I found: * SIGTERM only covers explicit termination via kill or Task Manager (aka System Monitor). * SIGHUP might also be used as a graceful termination signal. * GTK apps don't receive SIGHUP or SIGTERM during logout/shutdown (at least on GNOME). * The "proper" way to get logout/shutdown notifications is to register with the Session Manager. * There are two SM protocols currently in use: XSMP and GNOME SessionManager on D-Bus. * GTK2 has no direct SM support. There are two obsolete SM libraries: GnomeClient and EggSMClient. * GTK3 has direct support for D-Bus SessionManager in GtkApplication, but it doesn't signal QueryEndSession (where Display Close event should be sent from), isn't compatible with the SWT event loop and only works on GNOME and XFCE. * Qt and KDE use XSMP (via libSM). * No idea what happens on Wayland, but XSMP might be broken there. If my understanding is correct, a comprehensive solution would have to provide both D-Bus and XSMP session clients in addition to SIGTERM and SIGHUP handlers. Also, the semantics of SWT.Close event from Display need clarification. The way I see it, SWT.Close is not intended to be a cleanup hook. It exists to provide shutdown cancellation opportunity (if cancellation is possible at all). SWT must guarantee that display is disposed during logout/shutdown, then cleanup can happen in Shell Dispose or Display Dispose or after the main loop. Lars, I won't be working on this. This should be handled by someone more familiar with GTK, X and Wayland.
For the record: GTK2 support is in deep maintenance mode so don't bother with it at all.
For reference: On the SWT/gtk side we have DBus support: org.eclipse.swt.internal.GDBus It's currently used to listen to OpenFile and OpenURL method invocations from equinox launcher. It could potentially be modified to listen to "RequestStop" signal, which is emitted by systemd. Sources: [1] https://www.freedesktop.org/wiki/Software/systemd/dbus/ [2] https://github.com/systemd/systemd/blob/master/NEWS (See Controller) [3] https://www.freedesktop.org/wiki/Software/systemd/ControlGroupInterface/ (see SIGTERM)
New Gerrit change created: https://git.eclipse.org/r/140779
Tested on Ubuntu 16.04 (Gnome) - works. Tested on Ubuntu 18.10 (Gnome) - works. Tested on Fedora 29 (XFCE) - works.
Created attachment 278320 [details] Test snippet
(In reply to Alexandr Miloslavskiy from comment #8) > Created attachment 278320 [details] > Test snippet What are the steps required to test with this snippet?
Open it and try to logout.
Gerrit change https://git.eclipse.org/r/140779 was merged to [master]. Commit: http://git.eclipse.org/c/platform/eclipse.platform.swt.git/commit/?id=3d47beb6a71aa3e72762c9a55af531c0aedab8df
I think this is a good candidate for an N&N entry. Alexandr, can you please prepare one? Here is a guide: https://wiki.eclipse.org/SWT/Devel/Workflow#Writing_new_and_noteworthy_.28N.26N.29_posts You can look for my commits in that repo to see where the SWT ones go.
New Gerrit change created: https://git.eclipse.org/r/141115
New Gerrit change created: https://git.eclipse.org/r/141154
Gerrit change https://git.eclipse.org/r/141154 was merged to [master]. Commit: http://git.eclipse.org/c/platform/eclipse.platform.swt.git/commit/?id=5e26c8581c55815ebb2334588f2cb9910a57b2ba
New Gerrit change created: https://git.eclipse.org/r/141315
I observe now following errors printed to console after Eclipse startup: SWT SessionManagerDBus: Failed to connect to SessionManager (gnome: Service not present, xcfe: Service not present) I'm on KDE / RHEL 7.4.
This is expected if indeed both session managers are not available. Do you mean that the error should be silenced?
I have tested with Eclipse IBuild. With this patch, Eclipse now notices logoff and saves settings before the logout. The easiest way to test is to check whether window position is saved. 2019-03 doesn't notice the logout and window position is not saved.
(In reply to Alexandr Miloslavskiy from comment #18) > This is expected if indeed both session managers are not available. Do you > mean that the error should be silenced? So the patch only supports gnome and xfce? Is there a way to disable this patch for KDE, if KDE is not supported (or fix the patch to work with KDE too)?
Doing research for KDE is probably beyond my time allocation for this task. As for disabling it, there's no need: it disables itself when it fails to find supported GNOME / XFCE. In this case the error message is printed.
(In reply to Alexandr Miloslavskiy from comment #21) > Doing research for KDE is probably beyond my time allocation for this task. > As for disabling it, there's no need: it disables itself when it fails to > find supported GNOME / XFCE. In this case the error message is printed. OK, can we mute the message if we detect KDE?
Gerrit change https://git.eclipse.org/r/141115 was merged to [master]. Commit: http://git.eclipse.org/c/www.eclipse.org/eclipse/news.git/commit/?id=c076df0ca43564bb7ee49ca51cc2f8afdacaf3cd
(In reply to Andrey Loskutov from comment #22) > OK, can we mute the message if we detect KDE? I mean , if we detect *any* unsupported window manager / desktop environment?
Yes, I will prepare the patch.
New Gerrit change created: https://git.eclipse.org/r/141325
Gerrit change https://git.eclipse.org/r/141325 was merged to [master]. Commit: http://git.eclipse.org/c/platform/eclipse.platform.swt.git/commit/?id=3df6d246caeee99b4e0ecb27509b3124c910972d
Marking as fixed.
Verified in I20190521-0600.