gnome-screensaver r1453 - in trunk: . src



Author: mccann
Date: Thu May 29 17:32:37 2008
New Revision: 1453
URL: http://svn.gnome.org/viewvc/gnome-screensaver?rev=1453&view=rev

Log:
2008-05-29  William Jon McCann  <jmccann redhat com>

	* configure.ac:
	* src/gs-manager.c (on_screen_monitors_changed),
	(gs_manager_destroy_windows), (gs_manager_finalize),
	(gs_manager_create_windows), (gs_manager_activate),
	(gs_manager_deactivate):
	Hook up to screen's monitors-changed signal and spew
	some debug.  Not doing anything useful yet.



Modified:
   trunk/ChangeLog
   trunk/configure.ac
   trunk/src/gs-manager.c

Modified: trunk/configure.ac
==============================================================================
--- trunk/configure.ac	(original)
+++ trunk/configure.ac	Thu May 29 17:32:37 2008
@@ -38,7 +38,7 @@
 DBUS_REQUIRED_VERSION=0.30
 GLIB_REQUIRED_VERSION=2.15.0
 GCONF_REQUIRED_VERSION=2.6.1
-GDK_REQUIRED_VERSION=2.7.0
+GDK_REQUIRED_VERSION=2.14.0
 GTK_REQUIRED_VERSION=2.11.5
 LIBGNOME_MENU_REQUIRED_VERSION=2.11.1
 GNOME_DESKTOP_REQUIRED_VERSION=2.23.2

Modified: trunk/src/gs-manager.c
==============================================================================
--- trunk/src/gs-manager.c	(original)
+++ trunk/src/gs-manager.c	Thu May 29 17:32:37 2008
@@ -1043,11 +1043,52 @@
         }
 }
 
+
+static void
+on_screen_monitors_changed (GdkScreen *screen,
+                            GSManager *manager)
+{
+        gs_debug ("Monitors changed for screen %d: num=%d",
+                  gdk_screen_get_number (screen),
+                  gdk_screen_get_n_monitors (screen));
+}
+
+static void
+gs_manager_destroy_windows (GSManager *manager)
+{
+        GdkDisplay  *display;
+        GSList      *l;
+        int          n_screens;
+        int          i;
+
+        g_return_if_fail (manager != NULL);
+        g_return_if_fail (GS_IS_MANAGER (manager));
+
+        if (manager->priv->windows == NULL) {
+                return;
+        }
+
+        display = gdk_display_get_default ();
+
+        n_screens = gdk_display_get_n_screens (display);
+
+        for (i = 0; i < n_screens; i++) {
+                g_signal_handlers_disconnect_by_func (gdk_display_get_screen (display, i),
+                                                      on_screen_monitors_changed,
+                                                      manager);
+        }
+
+        for (l = manager->priv->windows; l; l = l->next) {
+                gs_window_destroy (l->data);
+        }
+        g_slist_free (manager->priv->windows);
+        manager->priv->windows = NULL;
+}
+
 static void
 gs_manager_finalize (GObject *object)
 {
         GSManager *manager;
-        GSList    *l;
 
         g_return_if_fail (object != NULL);
         g_return_if_fail (GS_IS_MANAGER (object));
@@ -1083,11 +1124,7 @@
 
         manager_stop_jobs (manager);
 
-        for (l = manager->priv->windows; l; l = l->next) {
-                gs_window_destroy (l->data);
-        }
-        g_slist_free (manager->priv->windows);
-        manager->priv->windows = NULL;
+        gs_manager_destroy_windows (manager);
 
         manager->priv->active = FALSE;
         manager->priv->activate_time = 0;
@@ -1519,26 +1556,26 @@
 }
 
 static void
-gs_manager_create (GSManager *manager)
+gs_manager_create_windows (GSManager *manager)
 {
         GdkDisplay  *display;
-        GSList      *l;
         int          n_screens;
         int          i;
 
         g_return_if_fail (manager != NULL);
         g_return_if_fail (GS_IS_MANAGER (manager));
 
-        display = gdk_display_get_default ();
+        g_assert (manager->priv->windows == NULL);
 
+        display = gdk_display_get_default ();
         n_screens = gdk_display_get_n_screens (display);
 
-        for (l = manager->priv->windows; l; l = l->next) {
-                gs_window_destroy (l->data);
-        }
-        g_slist_free (manager->priv->windows);
-
         for (i = 0; i < n_screens; i++) {
+                g_signal_connect (gdk_display_get_screen (display, i),
+                                  "monitors-changed",
+                                  G_CALLBACK (on_screen_monitors_changed),
+                                  manager);
+
                 gs_manager_create_windows_for_screen (manager, gdk_display_get_screen (display, i));
         }
 }
@@ -1603,7 +1640,7 @@
         }
 
         if (manager->priv->windows == NULL) {
-                gs_manager_create (GS_MANAGER (manager));
+                gs_manager_create_windows (GS_MANAGER (manager));
         }
 
         manager->priv->jobs = g_hash_table_new_full (g_direct_hash,
@@ -1636,8 +1673,6 @@
 static gboolean
 gs_manager_deactivate (GSManager *manager)
 {
-        GSList *l;
-
         g_return_val_if_fail (manager != NULL, FALSE);
         g_return_val_if_fail (GS_IS_MANAGER (manager), FALSE);
 
@@ -1654,11 +1689,7 @@
 
         manager_stop_jobs (manager);
 
-        for (l = manager->priv->windows; l; l = l->next) {
-                gs_window_destroy (l->data);
-        }
-        g_slist_free (manager->priv->windows);
-        manager->priv->windows = NULL;
+        gs_manager_destroy_windows (manager);
 
         /* reset state */
         manager->priv->active = FALSE;



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]