gnome-settings-daemon/gsd-screen-changed.patch
2009-11-09 21:00:09 +00:00

108 lines
4.1 KiB
Diff

diff -up gnome-settings-daemon-2.28.1/plugins/background/gsd-background-manager.c.screen-change gnome-settings-daemon-2.28.1/plugins/background/gsd-background-manager.c
--- gnome-settings-daemon-2.28.1/plugins/background/gsd-background-manager.c.screen-change 2009-05-03 14:15:30.000000000 -0400
+++ gnome-settings-daemon-2.28.1/plugins/background/gsd-background-manager.c 2009-11-09 15:38:32.005583997 -0500
@@ -47,6 +47,8 @@
#include "gnome-settings-profile.h"
#include "gsd-background-manager.h"
+#define NAUTILUS_SHOW_DESKTOP_KEY "/apps/nautilus/preferences/show_desktop"
+
#define GSD_BACKGROUND_MANAGER_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GSD_TYPE_BACKGROUND_MANAGER, GsdBackgroundManagerPrivate))
struct GsdBackgroundManagerPrivate
@@ -330,6 +332,67 @@ draw_background_after_session_loads (Gsd
manager->priv->dbus_connection = connection;
}
+static void
+on_screen_size_changed (GdkScreen *screen,
+ GsdBackgroundManager *manager)
+{
+ gboolean nautilus_show_desktop;
+
+ nautilus_show_desktop = gconf_client_get_bool (manager->priv->client,
+ NAUTILUS_SHOW_DESKTOP_KEY,
+ NULL);
+
+ if (!nautilus_is_running () || !nautilus_show_desktop) {
+ if (manager->priv->bg == NULL) {
+ setup_bg (manager);
+ }
+ draw_background (manager, FALSE);
+ }
+}
+
+static void
+disconnect_screen_signals (GsdBackgroundManager *manager)
+{
+ GdkDisplay *display;
+ int i;
+ int n_screens;
+
+ display = gdk_display_get_default ();
+ n_screens = gdk_display_get_n_screens (display);
+
+ for (i = 0; i < n_screens; ++i) {
+ GdkScreen *screen;
+ screen = gdk_display_get_screen (display, i);
+ g_signal_handlers_disconnect_by_func (screen,
+ G_CALLBACK (on_screen_size_changed),
+ manager);
+ }
+}
+
+static void
+connect_screen_signals (GsdBackgroundManager *manager)
+{
+ GdkDisplay *display;
+ int i;
+ int n_screens;
+
+ display = gdk_display_get_default ();
+ n_screens = gdk_display_get_n_screens (display);
+
+ for (i = 0; i < n_screens; ++i) {
+ GdkScreen *screen;
+ screen = gdk_display_get_screen (display, i);
+ g_signal_connect (screen,
+ "monitors-changed",
+ G_CALLBACK (on_screen_size_changed),
+ manager);
+ g_signal_connect (screen,
+ "size-changed",
+ G_CALLBACK (on_screen_size_changed),
+ manager);
+ }
+}
+
gboolean
gsd_background_manager_start (GsdBackgroundManager *manager,
GError **error)
@@ -349,7 +412,7 @@ gsd_background_manager_start (GsdBackgro
* nautilus overwrite it.
*/
nautilus_show_desktop = gconf_client_get_bool (manager->priv->client,
- "/apps/nautilus/preferences/show_desktop",
+ NAUTILUS_SHOW_DESKTOP_KEY,
NULL);
if (!nautilus_show_desktop) {
@@ -358,6 +421,8 @@ gsd_background_manager_start (GsdBackgro
draw_background_after_session_loads (manager);
}
+ connect_screen_signals (manager);
+
gnome_settings_profile_end (NULL);
return TRUE;
@@ -370,6 +435,8 @@ gsd_background_manager_stop (GsdBackgrou
g_debug ("Stopping background manager");
+ disconnect_screen_signals (manager);
+
if (manager->priv->dbus_connection != NULL) {
dbus_connection_remove_filter (manager->priv->dbus_connection,
on_bus_message,