diff -Nru gnome-screensaver-3.6.1/debian/changelog gnome-screensaver-3.6.1/debian/changelog --- gnome-screensaver-3.6.1/debian/changelog 2014-03-13 05:57:55.000000000 +0000 +++ gnome-screensaver-3.6.1/debian/changelog 2014-04-09 14:17:16.000000000 +0000 @@ -1,3 +1,22 @@ +gnome-screensaver (3.6.1-0ubuntu13) trusty; urgency=medium + + * debian/patches/allow-replacement: Make the D-Bus interface able to be + replaced, so that Unity (or others in future) can take it over if they + want to provide their own screensaver implementations. No need to listen + to NameOwnerChanged, only NameLost — so we don't have to wake + gnome-screensaver up every time this signal goes across the bus. + + -- Iain Lane Wed, 09 Apr 2014 15:17:04 +0100 + +gnome-screensaver (3.6.1-0ubuntu12) trusty; urgency=medium + + * debian/patches/33_unity_lockscreen_on_lock.patch: + - disable this patch as unity doesn't need it anymore + * debian/patches/19_not_autostart_in_unity.patch: + - do not autostart GS in unity session + + -- Robert Bruce Park Tue, 08 Apr 2014 10:47:18 -0700 + gnome-screensaver (3.6.1-0ubuntu11) trusty; urgency=medium * debian/patches/33_unity_lockscreen_on_lock.patch: diff -Nru gnome-screensaver-3.6.1/debian/patches/19_autostart_in_unity.patch gnome-screensaver-3.6.1/debian/patches/19_autostart_in_unity.patch --- gnome-screensaver-3.6.1/debian/patches/19_autostart_in_unity.patch 2014-03-13 05:57:55.000000000 +0000 +++ gnome-screensaver-3.6.1/debian/patches/19_autostart_in_unity.patch 1970-01-01 00:00:00.000000000 +0000 @@ -1,35 +0,0 @@ -Description: Run the autostart file for Unity, too. -Author: Martin Pitt -Forwarded: No, Unity/Ubuntu specific -Last-Update: 2013-02-09 - -Index: gnome-screensaver-3.6.1/src/gnome-screensaver.desktop.in -=================================================================== ---- gnome-screensaver-3.6.1.orig/src/gnome-screensaver.desktop.in 2013-02-09 09:36:54.223452768 -0500 -+++ gnome-screensaver-3.6.1/src/gnome-screensaver.desktop.in 2013-02-09 09:37:43.567454032 -0500 -@@ -4,8 +4,8 @@ - _Comment=Launch screensaver and locker program - Icon=preferences-desktop-screensaver - Exec=gnome-screensaver --OnlyShowIn=GNOME; --AutostartCondition=GNOME3 if-session gnome-fallback -+OnlyShowIn=GNOME;Unity; -+AutostartCondition=GNOME3 unless-session gnome - NoDisplay=true - X-GNOME-Autostart-Delay=20 - X-GNOME-Autostart-Phase=Application -Index: gnome-screensaver-3.6.1/src/gnome-screensaver.desktop.in.in -=================================================================== ---- gnome-screensaver-3.6.1.orig/src/gnome-screensaver.desktop.in.in 2013-02-09 09:36:54.223452768 -0500 -+++ gnome-screensaver-3.6.1/src/gnome-screensaver.desktop.in.in 2013-02-09 09:37:41.727453984 -0500 -@@ -4,8 +4,8 @@ - _Comment=Launch screensaver and locker program - Icon=preferences-desktop-screensaver - Exec=gnome-screensaver --OnlyShowIn=GNOME; --AutostartCondition=GNOME3 if-session gnome-fallback -+OnlyShowIn=GNOME;Unity; -+AutostartCondition=GNOME3 unless-session gnome - NoDisplay=true - X-GNOME-Autostart-Delay=20 - X-GNOME-Autostart-Phase=Application diff -Nru gnome-screensaver-3.6.1/debian/patches/19_not_autostart_in_unity.patch gnome-screensaver-3.6.1/debian/patches/19_not_autostart_in_unity.patch --- gnome-screensaver-3.6.1/debian/patches/19_not_autostart_in_unity.patch 1970-01-01 00:00:00.000000000 +0000 +++ gnome-screensaver-3.6.1/debian/patches/19_not_autostart_in_unity.patch 2014-04-09 14:17:16.000000000 +0000 @@ -0,0 +1,33 @@ +Description: Do not run the autostart file in Unity +Author: Marco Trevisan +Forwarded: No, Unity/Ubuntu specific +Last-Update: 2014-04-08 + +Index: gnome-screensaver/src/gnome-screensaver.desktop.in +=================================================================== +--- gnome-screensaver.orig/src/gnome-screensaver.desktop.in 2014-04-08 03:08:23.615979682 +0200 ++++ gnome-screensaver/src/gnome-screensaver.desktop.in 2014-04-08 03:11:23.478152698 +0200 +@@ -5,7 +5,8 @@ + Icon=preferences-desktop-screensaver + Exec=gnome-screensaver + OnlyShowIn=GNOME; +-AutostartCondition=GNOME3 if-session gnome-fallback ++NotShowIn=Unity; ++AutostartCondition=GNOME3 unless-session gnome + NoDisplay=true + X-GNOME-Autostart-Delay=20 + X-GNOME-Autostart-Phase=Application +Index: gnome-screensaver/src/gnome-screensaver.desktop.in.in +=================================================================== +--- gnome-screensaver.orig/src/gnome-screensaver.desktop.in.in 2014-04-08 03:08:23.615979682 +0200 ++++ gnome-screensaver/src/gnome-screensaver.desktop.in.in 2014-04-08 03:09:03.555573988 +0200 +@@ -5,7 +5,8 @@ + Icon=preferences-desktop-screensaver + Exec=gnome-screensaver + OnlyShowIn=GNOME; +-AutostartCondition=GNOME3 if-session gnome-fallback ++NotShowIn=Unity; ++AutostartCondition=GNOME3 unless-session gnome + NoDisplay=true + X-GNOME-Autostart-Delay=20 + X-GNOME-Autostart-Phase=Application diff -Nru gnome-screensaver-3.6.1/debian/patches/33_unity_lockscreen_on_lock.patch gnome-screensaver-3.6.1/debian/patches/33_unity_lockscreen_on_lock.patch --- gnome-screensaver-3.6.1/debian/patches/33_unity_lockscreen_on_lock.patch 2014-03-13 05:57:55.000000000 +0000 +++ gnome-screensaver-3.6.1/debian/patches/33_unity_lockscreen_on_lock.patch 1970-01-01 00:00:00.000000000 +0000 @@ -1,292 +0,0 @@ -Index: gnome-screensaver-3.6.1/src/gs-manager.c -=================================================================== ---- gnome-screensaver-3.6.1.orig/src/gs-manager.c 2014-03-13 15:03:33.261264391 +1100 -+++ gnome-screensaver-3.6.1/src/gs-manager.c 2014-03-13 15:03:33.253264390 +1100 -@@ -84,6 +84,7 @@ - DEACTIVATED, - AUTH_REQUEST_BEGIN, - AUTH_REQUEST_END, -+ LOCK_REQUEST, - LAST_SIGNAL - }; - -@@ -131,9 +132,19 @@ - if (manager->priv->lock_active != lock_active) { - GSList *l; - -+ gboolean already_locked = FALSE; -+ -+ if (lock_active) { -+ g_signal_emit (manager, signals [LOCK_REQUEST], 0, &already_locked); -+ gs_debug ("Lock action handled by another client %d", already_locked); -+ } -+ - manager->priv->lock_active = lock_active; -- for (l = manager->priv->windows; l; l = l->next) { -- gs_window_set_lock_enabled (l->data, lock_active); -+ -+ if (!already_locked) { -+ for (l = manager->priv->windows; l; l = l->next) { -+ gs_window_set_lock_enabled (l->data, lock_active); -+ } - } - } - } -@@ -484,6 +495,17 @@ - G_TYPE_NONE, - 0); - -+ signals [LOCK_REQUEST] = -+ g_signal_new ("lock-request", -+ G_TYPE_FROM_CLASS (object_class), -+ G_SIGNAL_RUN_LAST, -+ G_STRUCT_OFFSET (GSManagerClass, lock_request), -+ NULL, -+ NULL, -+ NULL, -+ G_TYPE_BOOLEAN, -+ 0); -+ - g_object_class_install_property (object_class, - PROP_ACTIVE, - g_param_spec_boolean ("active", -Index: gnome-screensaver-3.6.1/src/gs-monitor.c -=================================================================== ---- gnome-screensaver-3.6.1.orig/src/gs-monitor.c 2014-03-13 15:03:33.261264391 +1100 -+++ gnome-screensaver-3.6.1/src/gs-monitor.c 2014-03-13 16:45:01.953948417 +1100 -@@ -57,6 +57,11 @@ - GSPrefs *prefs; - GSFade *fade; - GSGrab *grab; -+ GDBusProxy *unity_proxy; -+ gboolean unity_connected; -+ gboolean unity_locked; -+ gboolean use_unity_lock_screen; -+ GSettings *a11y_settings; - guint release_grab_id; - }; - -@@ -88,6 +93,24 @@ - } - - static gboolean -+manager_lock_request_cb (GSManager *manager, GSMonitor *monitor) -+{ -+ if (monitor->priv->unity_connected && monitor->priv->use_unity_lock_screen) { -+ gs_listener_set_active (monitor->priv->listener, FALSE); -+ -+ if (g_dbus_proxy_call_sync (monitor->priv->unity_proxy, "Lock", NULL, -+ G_DBUS_CALL_FLAGS_NONE, -1, NULL, NULL)) { -+ gs_debug ("Screen locked using Unity"); -+ return TRUE; -+ } -+ -+ gs_listener_set_active (monitor->priv->listener, TRUE); -+ } -+ -+ return FALSE; -+} -+ -+static gboolean - watcher_idle_cb (GSWatcher *watcher, - gboolean is_idle, - GSMonitor *monitor) -@@ -167,6 +190,15 @@ - static void - gs_monitor_lock_screen (GSMonitor *monitor) - { -+ if (monitor->priv->unity_connected && monitor->priv->use_unity_lock_screen) { -+ if (g_dbus_proxy_call_sync (monitor->priv->unity_proxy, "Lock", NULL, -+ G_DBUS_CALL_FLAGS_NONE, -1, NULL, NULL)) { -+ gs_debug ("Screen locked using Unity"); -+ gs_listener_set_active (monitor->priv->listener, FALSE); -+ return; -+ } -+ } -+ - gboolean res; - gboolean locked; - gboolean active; -@@ -194,6 +226,9 @@ - { - XResetScreenSaver (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ())); - -+ if (monitor->priv->unity_connected) -+ return; -+ - /* request that the manager unlock - - will pop up a dialog if necessary */ - gs_manager_request_unlock (monitor->priv->manager); -@@ -258,6 +293,11 @@ - gboolean ret; - gboolean idle_watch_enabled; - -+ if (active && monitor->priv->unity_locked) { -+ gs_debug ("Nothing to activate, unity is already locking"); -+ return FALSE; -+ } -+ - res = gs_manager_set_active (monitor->priv->manager, active); - if (! res) { - gs_debug ("Unable to set manager active: %d", active); -@@ -407,6 +447,7 @@ - { - g_signal_handlers_disconnect_by_func (monitor->priv->manager, manager_activated_cb, monitor); - g_signal_handlers_disconnect_by_func (monitor->priv->manager, manager_deactivated_cb, monitor); -+ g_signal_handlers_disconnect_by_func (monitor->priv->manager, manager_lock_request_cb, monitor); - } - - static void -@@ -432,6 +473,80 @@ - } - - static void -+unity_signal_cb (GDBusProxy *proxy, gchar *sender_name, gchar *signal_name, -+ GVariant *parameters, GSMonitor *monitor) -+{ -+ if (g_strcmp0 (signal_name, "Locked") == 0) { -+ monitor->priv->unity_locked = TRUE; -+ gs_debug ("Unity Locked"); -+ gs_listener_set_active (monitor->priv->listener, FALSE); -+ gs_manager_set_lock_active (monitor->priv->manager, TRUE); -+ } else if (g_strcmp0 (signal_name, "Unlocked") == 0) { -+ gs_debug ("Unity Unlocked"); -+ monitor->priv->unity_locked = FALSE; -+ gs_manager_set_lock_active (monitor->priv->manager, FALSE); -+ } -+} -+ -+static void on_unity_owner_notify (GObject *object, GParamSpec *pspec, GSMonitor *monitor) -+{ -+ gchar *name_owner = g_dbus_proxy_get_name_owner (G_DBUS_PROXY (object)); -+ monitor->priv->unity_connected = (name_owner != NULL); -+ gs_debug ("Unity owner changed to %s, connected: %d", name_owner, monitor->priv->unity_connected); -+ g_free (name_owner); -+ -+ if (!monitor->priv->unity_connected && monitor->priv->unity_locked) { -+ monitor->priv->unity_locked = FALSE; -+ gs_monitor_lock_screen (monitor); -+ gs_debug ("Unity was locked, but we lost connection with it, using native locker..."); -+ } else if (monitor->priv->unity_connected) { -+ gboolean locked; -+ gs_manager_get_lock_active (monitor->priv->manager, &locked); -+ -+ /* Let's lock things again with Unity */ -+ if (locked) { -+ gs_debug ("Unity is back, we can replace lock with unity..."); -+ gs_listener_set_active (monitor->priv->listener, FALSE); -+ gs_monitor_lock_screen (monitor); -+ } -+ } -+} -+ -+static void -+unity_proxy_connection_cb (GObject* source, GAsyncResult* res, gpointer data) -+{ -+ GSMonitor *monitor = data; -+ monitor->priv->unity_proxy = g_dbus_proxy_new_for_bus_finish(res, NULL); -+ monitor->priv->unity_connected = TRUE; -+ g_signal_connect (monitor->priv->unity_proxy, "notify::g-name-owner", -+ G_CALLBACK (on_unity_owner_notify), monitor); -+ g_signal_connect (monitor->priv->unity_proxy, "g-signal", -+ G_CALLBACK (unity_signal_cb), monitor); -+ g_signal_connect (monitor->priv->manager, "lock-request", -+ G_CALLBACK (manager_lock_request_cb), monitor); -+ gs_debug ("Connected to Unity proxy"); -+} -+ -+static void -+a11y_changed_cb (GSettings *settings, -+ const gchar *key, -+ GSMonitor *monitor) -+{ -+ if (strcmp (key, "screen-reader-enabled") == 0) { -+ gboolean value = g_settings_get_boolean (settings, key); -+ -+ if (value) { -+ monitor->priv->use_unity_lock_screen = FALSE; -+ } else { -+ monitor->priv->use_unity_lock_screen = TRUE; -+ } -+ } else { -+ g_warning ("Config key not handled: %s", key); -+ return; -+ } -+} -+ -+static void - gs_monitor_init (GSMonitor *monitor) - { - -@@ -452,6 +567,35 @@ - monitor->priv->manager = gs_manager_new (); - connect_manager_signals (monitor); - -+ monitor->priv->use_unity_lock_screen = TRUE; -+ -+ monitor->priv->a11y_settings = g_settings_new ("org.gnome.desktop.a11y.applications"); -+ g_signal_connect (monitor->priv->a11y_settings, -+ "changed", -+ G_CALLBACK (a11y_changed_cb), -+ monitor); -+ -+ gboolean value = g_settings_get_boolean (monitor->priv->a11y_settings, -+ "screen-reader-enabled"); -+ -+ if (value) { -+ monitor->priv->use_unity_lock_screen = FALSE; -+ } else { -+ monitor->priv->use_unity_lock_screen = TRUE; -+ } -+ -+ if (g_strcmp0 (g_getenv ("XDG_CURRENT_DESKTOP"), "Unity") == 0) { -+ g_dbus_proxy_new_for_bus (G_BUS_TYPE_SESSION, -+ G_DBUS_PROXY_FLAGS_NONE, -+ NULL, /* GDBusInterfaceInfo */ -+ "com.canonical.Unity", -+ "/com/canonical/Unity/Session", -+ "com.canonical.Unity.Session", -+ NULL, /* GCancellable */ -+ unity_proxy_connection_cb, -+ monitor); -+ } -+ - _gs_monitor_update_from_prefs (monitor, monitor->priv->prefs); - } - -@@ -467,6 +611,11 @@ - - g_return_if_fail (monitor->priv != NULL); - -+ if (monitor->priv->a11y_settings) { -+ g_object_unref (monitor->priv->a11y_settings); -+ monitor->priv->a11y_settings = NULL; -+ } -+ - disconnect_watcher_signals (monitor); - disconnect_listener_signals (monitor); - disconnect_manager_signals (monitor); -@@ -479,6 +628,11 @@ - g_object_unref (monitor->priv->manager); - g_object_unref (monitor->priv->prefs); - -+ if (monitor->priv->unity_proxy) { -+ g_signal_handlers_disconnect_by_data (monitor->priv->unity_proxy, monitor); -+ g_object_unref (monitor->priv->unity_proxy); -+ } -+ - G_OBJECT_CLASS (gs_monitor_parent_class)->finalize (object); - } - -Index: gnome-screensaver-3.6.1/src/gs-manager.h -=================================================================== ---- gnome-screensaver-3.6.1.orig/src/gs-manager.h 2014-03-13 15:03:33.261264391 +1100 -+++ gnome-screensaver-3.6.1/src/gs-manager.h 2014-03-13 15:03:33.257264391 +1100 -@@ -50,6 +50,7 @@ - void (* deactivated) (GSManager *manager); - void (* auth_request_begin) (GSManager *manager); - void (* auth_request_end) (GSManager *manager); -+ void (* lock_request) (GSManager *manager); - - } GSManagerClass; - diff -Nru gnome-screensaver-3.6.1/debian/patches/allow-replacement gnome-screensaver-3.6.1/debian/patches/allow-replacement --- gnome-screensaver-3.6.1/debian/patches/allow-replacement 1970-01-01 00:00:00.000000000 +0000 +++ gnome-screensaver-3.6.1/debian/patches/allow-replacement 2014-04-09 14:17:16.000000000 +0000 @@ -0,0 +1,69 @@ +Description: Allow the dbus service to be replaced, so that other implementations of the interface (e.g. Unity) can take the service over. + We quit if someone else claims the name, as D-Bus activation will restart us if that owner then goes away. +Author: Iain Lane +Forwared: not-needed + +Index: b/src/gs-listener-dbus.c +=================================================================== +--- a/src/gs-listener-dbus.c ++++ b/src/gs-listener-dbus.c +@@ -28,6 +28,7 @@ + #include + + #include ++#include + + #include + #include +@@ -1092,7 +1093,24 @@ + g_timeout_add (10000, (GSourceFunc)reinit_dbus, listener); + } else if (dbus_message_is_signal (message, + DBUS_INTERFACE_DBUS, +- "NameOwnerChanged")) { ++ "NameLost")) { ++ const char *name; ++ DBusError error; ++ dbus_error_init (&error); ++ ++ if (!dbus_message_get_args (message, &error, ++ DBUS_TYPE_STRING, &name, ++ DBUS_TYPE_INVALID)) { ++ g_warning("Got NameLost, but couldn't read name"); ++ dbus_error_free (&error); ++ } else { ++ if (strcmp (name, GS_INTERFACE) == 0) { // We've been replaced ++ g_message ("Lost the name, shutting down."); ++ dbus_connection_unref (connection); ++ listener->priv->connection = NULL; ++ gtk_main_quit (); ++ } ++ } + } else { + return listener_dbus_handle_session_message (connection, message, user_data, FALSE); + } +@@ -1317,7 +1335,6 @@ + _("not connected to the message bus")); + return FALSE; + } +- + if (screensaver_is_running (listener->priv->connection)) { + g_set_error (error, + GS_LISTENER_ERROR, +@@ -1339,7 +1356,7 @@ + + res = dbus_bus_request_name (listener->priv->connection, + GS_SERVICE, +- DBUS_NAME_FLAG_DO_NOT_QUEUE, ++ DBUS_NAME_FLAG_DO_NOT_QUEUE | DBUS_NAME_FLAG_ALLOW_REPLACEMENT, + &buserror); + if (dbus_error_is_set (&buserror)) { + g_set_error (error, +@@ -1365,7 +1382,7 @@ + "type='signal'" + ",interface='"DBUS_INTERFACE_DBUS"'" + ",sender='"DBUS_SERVICE_DBUS"'" +- ",member='NameOwnerChanged'", ++ ",member='NameLost'", + NULL); + + if (listener->priv->system_connection != NULL) { diff -Nru gnome-screensaver-3.6.1/debian/patches/series gnome-screensaver-3.6.1/debian/patches/series --- gnome-screensaver-3.6.1/debian/patches/series 2014-03-13 05:57:55.000000000 +0000 +++ gnome-screensaver-3.6.1/debian/patches/series 2014-04-09 14:17:16.000000000 +0000 @@ -10,7 +10,7 @@ 16_dont_crash_in_kvm.patch 17_remove_top_panel.patch 18_unity_dialog_layout.patch -19_autostart_in_unity.patch +19_not_autostart_in_unity.patch 24_use_user_settings.patch 25_fix_lock_command.patch #26_lightdm_greeter_on_lock.patch @@ -21,4 +21,4 @@ 31_lock_screen_on_suspend.patch 32_input_sources_switcher.patch move-not-nuke.patch -33_unity_lockscreen_on_lock.patch +allow-replacement