rpms/gnome-desktop/devel gnome-desktop-2.25.1.1-fade.patch, 1.3, 1.4 gnome-desktop.spec, 1.190, 1.191

Ray Strode rstrode at fedoraproject.org
Thu Dec 4 19:59:43 UTC 2008


Author: rstrode

Update of /cvs/pkgs/rpms/gnome-desktop/devel
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv498

Modified Files:
	gnome-desktop-2.25.1.1-fade.patch gnome-desktop.spec 
Log Message:
- Rebase fade-in patch to latest from upstream report


gnome-desktop-2.25.1.1-fade.patch:

Index: gnome-desktop-2.25.1.1-fade.patch
===================================================================
RCS file: /cvs/pkgs/rpms/gnome-desktop/devel/gnome-desktop-2.25.1.1-fade.patch,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- gnome-desktop-2.25.1.1-fade.patch	13 Nov 2008 07:23:05 -0000	1.3
+++ gnome-desktop-2.25.1.1-fade.patch	4 Dec 2008 19:59:12 -0000	1.4
@@ -1,39 +1,28 @@
-diff -up gnome-desktop-2.25.1.1/libgnome-desktop/gnome-bg.c.fade gnome-desktop-2.25.1.1/libgnome-desktop/gnome-bg.c
---- gnome-desktop-2.25.1.1/libgnome-desktop/gnome-bg.c.fade	2008-11-05 07:51:36.000000000 -0500
-+++ gnome-desktop-2.25.1.1/libgnome-desktop/gnome-bg.c	2008-11-13 01:02:30.000000000 -0500
-@@ -38,10 +38,14 @@ Author: Soren Sandmann <sandmann at redhat.
- #include <X11/Xlib.h>
- #include <X11/Xatom.h>
- 
-+#include <cairo.h>
-+#include <cairo-xlib.h>
-+
- #include <gconf/gconf-client.h>
- 
- #define GNOME_DESKTOP_USE_UNSTABLE_API
- #include <libgnomeui/gnome-bg.h>
-+#include <libgnomeui/gnome-bg-crossfade.h>
- 
- #define BG_KEY_DRAW_BACKGROUND    GNOME_BG_KEY_DIR "/draw_background"
- #define BG_KEY_PRIMARY_COLOR      GNOME_BG_KEY_DIR "/primary_color"
-@@ -98,6 +102,7 @@ struct _GnomeBG
+============================================================
+ Emit "transitioned" not "changed" for new frames
+
+  Previously, "changed" would get emitted when switching
+backgrounds AND when switching slides in an animated
+background.  The two actions are conceptually different,
+so this commit splits the signal into two signals. This
+will allow us to add a cross fade effect when switching
+backgrounds (and not add the cross fade effect when
+switching slides that have their own transition effect)
+
+diff --git a/libgnome-desktop/gnome-bg.c b/libgnome-desktop/gnome-bg.c
+--- a/libgnome-desktop/gnome-bg.c
++++ b/libgnome-desktop/gnome-bg.c
+@@ -98,7 +98,8 @@ struct _GnomeBG
  	GFileMonitor *		file_monitor;
  
  	guint                   changed_id;
+-	
 +	guint                   transitioned_id;
- 	
++
  	/* Cached information, only access through cache accessor functions */
          SlideShow *		slideshow;
-@@ -106,6 +111,8 @@ struct _GnomeBG
- 	int			timeout_id;
- 
- 	GList *		        file_cache;
-+
-+        guint                   ignore_changes : 1;
- };
- 
- struct _GnomeBGClass
-@@ -115,6 +122,7 @@ struct _GnomeBGClass
+ 	time_t			file_mtime;
+@@ -115,6 +116,7 @@ struct _GnomeBGClass
  
  enum {
  	CHANGED,
@@ -41,18 +30,7 @@
  	N_SIGNALS
  };
  
-@@ -264,6 +272,10 @@ do_changed (GnomeBG *bg)
- static void
- queue_changed (GnomeBG *bg)
- {
-+	if (bg->ignore_changes) {
-+		return;
-+	}
-+
- 	if (bg->changed_id > 0) {
- 		g_source_remove (bg->changed_id);
- 	}
-@@ -275,6 +287,30 @@ queue_changed (GnomeBG *bg)
+@@ -275,6 +277,30 @@ queue_changed (GnomeBG *bg)
  					     NULL);
  }
  
@@ -83,7 +61,7 @@
  void
  gnome_bg_load_from_preferences (GnomeBG     *bg,
  				GConfClient *client)
-@@ -414,6 +450,14 @@ gnome_bg_class_init (GnomeBGClass *klass
+@@ -419,6 +445,14 @@ gnome_bg_class_init (GnomeBGClass *klass)
  					 NULL, NULL,
  					 g_cclosure_marshal_VOID__VOID,
  					 G_TYPE_NONE, 0);
@@ -98,105 +76,90 @@
  }
  
  GnomeBG *
-@@ -547,6 +591,13 @@ gnome_bg_set_filename (GnomeBG     *bg,
- 	}
+@@ -1352,7 +1386,7 @@ on_timeout (gpointer data)
+ 
+ 	bg->timeout_id = 0;
+ 	
+-	queue_changed (bg);
++	queue_transitioned (bg);
+ 
+ 	return FALSE;
  }
+
+============================================================
+ Use gdk functions to grab server and flush client
+
+  It looks a little nicer this way.
+
+diff --git a/libgnome-desktop/gnome-bg.c b/libgnome-desktop/gnome-bg.c
+--- a/libgnome-desktop/gnome-bg.c
++++ b/libgnome-desktop/gnome-bg.c
+@@ -1056,7 +1056,7 @@ gnome_bg_create_thumbnail (GnomeBG               *bg,
  
-+void
-+gnome_bg_ignore_changes (GnomeBG *bg,
-+                         gboolean should_ignore)
-+{
-+	bg->ignore_changes = should_ignore;
-+}
+ 
+ /* Set the root pixmap, and properties pointing to it. We
+- * do this atomically with XGrabServer to make sure that
++ * do this atomically with a server grab to make sure that
+  * we won't leak the pixmap if somebody else it setting
+  * it at the same time. (This assumes that they follow the
+  * same conventions we do)
+@@ -1082,7 +1082,7 @@ gnome_bg_set_pixmap_as_root (GdkScreen *screen, GdkPixmap *pixmap)
+ 	data_esetroot = NULL;
+ 	display = GDK_DISPLAY_XDISPLAY (gdk_screen_get_display (screen));
+ 	
+-	XGrabServer (display);
++	gdk_x11_display_grab (gdk_screen_get_display (screen));
+ 	
+ 	result = XGetWindowProperty (
+ 		display, RootWindow (display, screen_num),
+@@ -1117,10 +1117,9 @@ gnome_bg_set_pixmap_as_root (GdkScreen *screen, GdkPixmap *pixmap)
+ 	XSetWindowBackgroundPixmap (display, RootWindow (display, screen_num),
+ 				    pixmap_id);
+ 	XClearWindow (display, RootWindow (display, screen_num));
+-	
+-	XUngrabServer (display);
+-	
+-	XFlush (display);
 +
- static void
- draw_color (GnomeBG *bg, GdkPixbuf *dest)
- {
-@@ -1015,15 +1066,75 @@ gnome_bg_create_thumbnail (GnomeBG      
- 	return result;
++	gdk_x11_display_ungrab (gdk_screen_get_display (screen));
++	gdk_display_flush (gdk_screen_get_display (screen));
  }
  
-+GdkPixmap *
-+gnome_bg_get_pixmap_from_root (GdkScreen *screen)
-+{
-+	int      result;
-+	gint     format;
-+	gulong   nitems;
-+	gulong   bytes_after;
-+	guchar  *data;
-+	Atom     type;
-+	Display *display;
-+	int      screen_num;
-+	GdkPixmap *pixmap;
-+
-+	display = GDK_DISPLAY_XDISPLAY (gdk_screen_get_display (screen));
-+	screen_num = gdk_screen_get_number (screen);
  
+
+============================================================
+ Move part of set_pixmap_as_root to set_root_pixmap_id
+
+  The meatiest part of set_pixmap_as_root takes the passed
+in pixmap and stores it on the root window in the
+ESETROOT_PMAP_ID and _XROOTPMAP_ID properties.  That
+functionality stands on its own, and should be factored
+out so it can get reused later when adding crossfade
+transitions on background changes.
+
+diff --git a/libgnome-desktop/gnome-bg.c b/libgnome-desktop/gnome-bg.c
+--- a/libgnome-desktop/gnome-bg.c
++++ b/libgnome-desktop/gnome-bg.c
+@@ -1054,15 +1054,9 @@ gnome_bg_create_thumbnail (GnomeBG               *bg,
+ 	return result;
+ }
+ 
+-
 -/* Set the root pixmap, and properties pointing to it. We
-- * do this atomically with XGrabServer to make sure that
+- * do this atomically with a server grab to make sure that
 - * we won't leak the pixmap if somebody else it setting
 - * it at the same time. (This assumes that they follow the
 - * same conventions we do)
 - */
 -void 
 -gnome_bg_set_pixmap_as_root (GdkScreen *screen, GdkPixmap *pixmap)
-+	result = XGetWindowProperty (display,
-+		RootWindow (display, screen_num),
-+		gdk_x11_get_xatom_by_name ("_XROOTPMAP_ID"),
-+		0L, 1L, False, XA_PIXMAP,
-+		&type, &format, &nitems, &bytes_after,
-+		&data);
-+	pixmap = NULL;
-+
-+	if (data != NULL) {
-+	    if (result == Success && type == XA_PIXMAP &&
-+		    format == 32 && nitems == 1) {
-+		GdkPixmap *source_pixmap;
-+		int width, height;
-+		cairo_t *cr;
-+		cairo_pattern_t *pattern;
-+
-+		source_pixmap = gdk_pixmap_foreign_new (*(Pixmap *) data);
-+		gdk_drawable_set_colormap (source_pixmap, gdk_screen_get_default_colormap (screen));
-+
-+		width = gdk_screen_get_width (screen);
-+		height = gdk_screen_get_width (screen);
-+
-+		pixmap = gdk_pixmap_new (source_pixmap != NULL? source_pixmap :
-+                                         gdk_screen_get_root_window (screen),
-+                                         width, height, -1);
-+
-+		cr = gdk_cairo_create (pixmap);
-+                if (source_pixmap != NULL) {
-+			gdk_cairo_set_source_pixmap (cr, source_pixmap, 0, 0);
-+			pattern = cairo_get_source (cr);
-+			cairo_pattern_set_extend (pattern, CAIRO_EXTEND_REPEAT);
-+                } else {
-+			cairo_set_source_rgb (cr, 0.0, 0.0, 0.0);
-+		}
-+		cairo_paint (cr);
-+
-+		if (cairo_status (cr) != CAIRO_STATUS_SUCCESS) {
-+		    g_object_unref (pixmap);
-+		    pixmap = NULL;
-+		}
-+		cairo_destroy (cr);
-+
-+		g_object_unref (source_pixmap);
-+	    }
-+	    XFree (data);
-+	}
-+
-+	return pixmap;
-+}
-+
 +static void
 +gnome_bg_set_root_pixmap_id (GdkScreen *screen,
 +			     GdkPixmap *pixmap)
  {
  	int      result;
  	gint     format;
-@@ -1034,24 +1145,19 @@ gnome_bg_set_pixmap_as_root (GdkScreen *
+@@ -1073,24 +1067,20 @@ gnome_bg_set_pixmap_as_root (GdkScreen *screen, GdkPixmap *pixmap)
  	Atom     type;
  	Display *display;
  	int      screen_num;
@@ -211,57 +174,54 @@
 +
  	display = GDK_DISPLAY_XDISPLAY (gdk_screen_get_display (screen));
 -	
--	XGrabServer (display);
+-	gdk_x11_display_grab (gdk_screen_get_display (screen));
 -	
-+
- 	result = XGetWindowProperty (
- 		display, RootWindow (display, screen_num),
- 		gdk_x11_get_xatom_by_name ("ESETROOT_PMAP_ID"),
- 		0L, 1L, False, XA_PIXMAP,
- 		&type, &format, &nitems, &bytes_after,
- 		&data_esetroot);
+-	result = XGetWindowProperty (
+-		display, RootWindow (display, screen_num),
+-		gdk_x11_get_xatom_by_name ("ESETROOT_PMAP_ID"),
+-		0L, 1L, False, XA_PIXMAP,
+-		&type, &format, &nitems, &bytes_after,
+-		&data_esetroot);
 -	
 +
++	result = XGetWindowProperty (display,
++				     RootWindow (display, screen_num),
++				     gdk_x11_get_xatom_by_name ("ESETROOT_PMAP_ID"),
++				     0L, 1L, False, XA_PIXMAP,
++				     &type, &format, &nitems,
++				     &bytes_after,
++				     &data_esetroot);
++
  	if (data_esetroot != NULL) {
  		if (result == Success && type == XA_PIXMAP &&
  		    format == 32 &&
-@@ -1063,9 +1169,9 @@ gnome_bg_set_pixmap_as_root (GdkScreen *
- 		}
- 		XFree (data_esetroot);
- 	}
--	
-+
- 	pixmap_id = GDK_WINDOW_XWINDOW (pixmap);
--	
-+
- 	XChangeProperty (display, RootWindow (display, screen_num),
- 			 gdk_x11_get_xatom_by_name ("ESETROOT_PMAP_ID"),
- 			 XA_PIXMAP, 32, PropModeReplace,
-@@ -1074,14 +1180,72 @@ gnome_bg_set_pixmap_as_root (GdkScreen *
+@@ -1113,9 +1103,33 @@ gnome_bg_set_pixmap_as_root (GdkScreen *screen, GdkPixmap *pixmap)
  			 gdk_x11_get_xatom_by_name ("_XROOTPMAP_ID"), XA_PIXMAP,
  			 32, PropModeReplace,
  			 (guchar *) &pixmap_id, 1);
+-	
 +}
 +
 +/* Set the root pixmap, and properties pointing to it. We
-+ * do this atomically with XGrabServer to make sure that
++ * do this atomically with a server grab to make sure that
 + * we won't leak the pixmap if somebody else it setting
 + * it at the same time. (This assumes that they follow the
 + * same conventions we do)
 + */
-+void 
++void
 +gnome_bg_set_pixmap_as_root (GdkScreen *screen, GdkPixmap *pixmap)
 +{
 +	Display *display;
 +	int      screen_num;
-+	
++
 +	g_return_if_fail (screen != NULL);
 +	g_return_if_fail (pixmap != NULL);
- 	
++
 +	screen_num = gdk_screen_get_number (screen);
++
 +	display = GDK_DISPLAY_XDISPLAY (gdk_screen_get_display (screen));
 +
-+	XGrabServer (display);
++	gdk_x11_display_grab (gdk_screen_get_display (screen));
 +
 +	gnome_bg_set_root_pixmap_id (screen, pixmap);
 +
@@ -269,64 +229,33 @@
 -				    pixmap_id);
 +				    GDK_PIXMAP_XID (pixmap));
  	XClearWindow (display, RootWindow (display, screen_num));
--	
--	XUngrabServer (display);
--	
-+
- 	XFlush (display);
-+
-+	XUngrabServer (display);
-+}
-+
-+GnomeBGCrossfade * 
-+gnome_bg_set_pixmap_as_root_with_crossfade (GdkScreen    *screen,
-+                                       GdkPixmap    *pixmap,
-+                                       GMainContext *context)
-+{
-+	GdkDisplay *display;
-+	GdkWindow *root_window;
-+	GdkPixmap *old_pixmap;
-+	int      width, height;
-+	GnomeBGCrossfade *fade;
-+
-+	g_return_val_if_fail (screen != NULL, 0);
-+	g_return_val_if_fail (pixmap != NULL, 0);
-+
-+	root_window = gdk_screen_get_root_window (screen);
-+
-+	width = gdk_screen_get_width (screen);
-+	height = gdk_screen_get_height (screen);
-+
-+	fade = gnome_bg_crossfade_new (width, height);
-+
-+	display = gdk_screen_get_display (screen);
-+	gdk_x11_display_grab (display);
-+	old_pixmap = gnome_bg_get_pixmap_from_root (screen);
-+	gnome_bg_set_root_pixmap_id (screen, pixmap);
-+	gnome_bg_crossfade_set_start_pixmap (fade, old_pixmap);
-+	gnome_bg_crossfade_set_end_pixmap (fade, pixmap);
-+	gdk_display_flush (display);
-+	gdk_x11_display_ungrab (display);
-+	g_object_unref (old_pixmap);
-+	gnome_bg_crossfade_start (fade, root_window, context);
-+
-+	return fade;
- }
- 
- 
-@@ -1347,7 +1511,7 @@ on_timeout (gpointer data)
- 
- 	bg->timeout_id = 0;
- 	
--	queue_changed (bg);
-+	queue_transitioned (bg);
  
- 	return FALSE;
- }
-diff -up /dev/null gnome-desktop-2.25.1.1/libgnome-desktop/gnome-bg-crossfade.c
---- /dev/null	2008-11-12 15:48:32.607088093 -0500
-+++ gnome-desktop-2.25.1.1/libgnome-desktop/gnome-bg-crossfade.c	2008-11-13 01:02:30.000000000 -0500
-@@ -0,0 +1,451 @@
+ 	gdk_x11_display_ungrab (gdk_screen_get_display (screen));
+
+============================================================
+ Add Crossfade class
+
+  This adds a helper class to manage doing crossfades on a window.
+It will be leveraged by gnome_bg and nautilus to do a fade
+transition when changing backgrounds on the desktop or in nautilus
+windows.
+
+diff --git a/libgnome-desktop/Makefile.am b/libgnome-desktop/Makefile.am
+--- a/libgnome-desktop/Makefile.am
++++ b/libgnome-desktop/Makefile.am
+@@ -22,6 +22,7 @@ libgnome_desktop_2_la_SOURCES = \
+ 	gnome-desktop-thumbnail.c \
+ 	gnome-thumbnail-pixbuf-utils.c \
+ 	gnome-bg.c		\
++	gnome-bg-crossfade.c	\
+ 	display-name.c		\
+ 	gnome-rr.c		\
+ 	gnome-rr-config.c	\
+diff --git a/libgnome-desktop/gnome-bg-crossfade.c b/libgnome-desktop/gnome-bg-crossfade.c
+new file mode 100644
+--- /dev/null
++++ b/libgnome-desktop/gnome-bg-crossfade.c
+@@ -0,0 +1,541 @@
 +/* gnome-bg-crossfade.h - fade window background between two pixmaps
 + *
 + * Copyright (C) 2008 Red Hat, Inc.
@@ -359,28 +288,26 @@
 +#include <gdk/gdkx.h>
 +#include <X11/Xlib.h>
 +#include <X11/Xatom.h>
++#include <gtk/gtk.h>
 +
 +#include <cairo.h>
 +#include <cairo-xlib.h>
 +
-+#include <gtk/gtk.h>
-+
 +#define GNOME_DESKTOP_USE_UNSTABLE_API
 +#include <libgnomeui/gnome-bg.h>
 +#include "libgnomeui/gnome-bg-crossfade.h"
 +
 +struct _GnomeBGCrossfadePrivate
 +{
-+	GObject		 parent_instance;
-+	GdkWindow	*window;
-+	int              width;
-+	int              height;
-+	GdkPixmap	*fading_pixmap;
-+	GdkPixmap	*end_pixmap;
-+	gdouble		 start_time;
-+	gdouble		 total_duration;
-+	guint		 timeout_id;
-+	guint		 is_first_frame : 1;
++	GdkWindow *window;
++	int        width;
++	int        height;
++	GdkPixmap *fading_pixmap;
++	GdkPixmap *end_pixmap;
++	gdouble    start_time;
++	gdouble    total_duration;
++	guint      timeout_id;
++	guint      is_first_frame : 1;
 +};
 +
 +enum {
@@ -489,6 +416,12 @@
 +	gobject_class->set_property = gnome_bg_crossfade_set_property;
 +	gobject_class->finalize = gnome_bg_crossfade_finalize;
 +
++	/**
++	 * GnomeBGCrossfade:width:
++	 *
++	 * When a crossfade is running, this is width of the fading
++	 * pixmap.
++	 */
 +	g_object_class_install_property (gobject_class,
 +					 PROP_WIDTH,
 +					 g_param_spec_int ("width",
@@ -497,12 +430,28 @@
 +							    0, G_MAXINT, 0,
 +							    G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE));
 +
++	/**
++	 * GnomeBGCrossfade:height:
++	 *
++	 * When a crossfade is running, this is height of the fading
++	 * pixmap.
++	 */
 +	g_object_class_install_property (gobject_class,
 +					 PROP_HEIGHT,
 +					 g_param_spec_int ("height", "Window Height",
 +						           "Height of window to fade on",
 +							   0, G_MAXINT, 0,
 +							   G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE));
++
++	/**
++	 * GnomeBGCrossfade::finished:
++	 * @fade: the #GnomeBGCrossfade that received the signal
++	 * @window: the #GdkWindow the crossfade happend on.
++	 *
++	 * When a crossfade finishes, @window will have a copy
++	 * of the end pixmap as its background, and this signal will
++	 * get emitted.
++	 */
 +	signals[FINISHED] = g_signal_new ("finished",
 +					  G_OBJECT_CLASS_TYPE (gobject_class),
 +					  G_SIGNAL_RUN_LAST, 0, NULL, NULL,
@@ -516,8 +465,22 @@
 +gnome_bg_crossfade_init (GnomeBGCrossfade *fade)
 +{
 +	fade->priv = GNOME_BG_CROSSFADE_GET_PRIVATE (fade);
++
++	fade->priv->fading_pixmap = NULL;
++	fade->priv->end_pixmap = NULL;
++	fade->priv->timeout_id = 0;
 +}
 +
++/**
++ * gnome_bg_crossfade_new:
++ * @width: The width of the crossfading window
++ * @height: The height of the crossfading window
++ *
++ * Creates a new object to manage crossfading a
++ * window background between two #GdkPixmap drawables.
++ *
++ * Return value: the new #GnomeBGCrossfade
++ **/
 +GnomeBGCrossfade *
 +gnome_bg_crossfade_new (int width,
 +			int height)
@@ -565,6 +528,18 @@
 +	return copy;
 +}
 +
++/**
++ * gnome_bg_crossfade_set_start_pixmap:
++ * @fade: a #GnomeBGCrossfade
++ * @pixmap: The #GdkPixmap to fade from
++ *
++ * Before initiating a crossfade with gnome_bg_crossfade_start()
++ * a start and end pixmap have to be set.  This function sets
++ * the pixmap shown at the beginning of the crossfade effect.
++ *
++ * Return value: %TRUE if successful, or %FALSE if the pixmap
++ * could not be copied.
++ **/
 +gboolean
 +gnome_bg_crossfade_set_start_pixmap (GnomeBGCrossfade *fade,
 +				     GdkPixmap        *pixmap)
@@ -583,6 +558,18 @@
 +	return fade->priv->fading_pixmap != NULL;
 +}
 +
++/**
++ * gnome_bg_crossfade_set_end_pixmap:
++ * @fade: a #GnomeBGCrossfade
++ * @pixmap: The #GdkPixmap to fade to
++ *
++ * Before initiating a crossfade with gnome_bg_crossfade_start()
++ * a start and end pixmap have to be set.  This function sets
++ * the pixmap shown at the end of the crossfade effect.
++ *
++ * Return value: %TRUE if successful, or %FALSE if the pixmap
++ * could not be copied.
++ **/
 +gboolean
 +gnome_bg_crossfade_set_end_pixmap (GnomeBGCrossfade *fade,
 +				   GdkPixmap        *pixmap)
@@ -604,9 +591,9 @@
 +static gdouble
 +get_current_time (void)
 +{
-+	const double microseconds_per_second = 1000000.0;
-+	double       timestamp;
-+	GTimeVal     now;
++	const double microseconds_per_second = (double) G_USEC_PER_SEC;
++	double timestamp;
++	GTimeVal now;
 +
 +	g_get_current_time (&now);
 +
@@ -623,9 +610,7 @@
 +	GdkScreen *screen;
 +	gboolean are_enabled;
 +
-+	if (fade->priv->window == NULL) {
-+		return FALSE;
-+	}
++	g_assert (fade->priv->window != NULL);
 +
 +	screen = gdk_drawable_get_screen (fade->priv->window);
 +
@@ -666,7 +651,7 @@
 +	percent_done = CLAMP (percent_done, 0.0, 1.0);
 +
 +	/* If it's taking a long time to get to the first frame,
-+	 * then double the duration, so the user will get to see
++	 * then lengthen the duration, so the user will get to see
 +	 * the effect.
 +	 */
 +	if (fade->priv->is_first_frame && percent_done > .33) {
@@ -709,27 +694,38 @@
 +static void
 +on_finished (GnomeBGCrossfade *fade)
 +{
-+	if (fade->priv->end_pixmap != NULL) {
-+		gdk_window_set_back_pixmap (fade->priv->window,
-+					    fade->priv->end_pixmap,
-+					    FALSE);
-+		draw_background (fade);
-+	}
++	g_assert (fade->priv->end_pixmap != NULL);
 +
-+	if (fade->priv->fading_pixmap != NULL) {
-+		g_object_unref (fade->priv->fading_pixmap);
-+		fade->priv->fading_pixmap = NULL;
-+	}
++	gdk_window_set_back_pixmap (fade->priv->window,
++				    fade->priv->end_pixmap,
++				    FALSE);
++	draw_background (fade);
 +
-+	if (fade->priv->end_pixmap != NULL) {
-+		g_object_unref (fade->priv->end_pixmap);
-+		fade->priv->end_pixmap = NULL;
-+	}
++	g_object_unref (fade->priv->end_pixmap);
++	fade->priv->end_pixmap = NULL;
++
++	g_assert (fade->priv->fading_pixmap != NULL);
++
++	g_object_unref (fade->priv->fading_pixmap);
++	fade->priv->fading_pixmap = NULL;
 +
 +	fade->priv->timeout_id = 0;
 +	g_signal_emit (fade, signals[FINISHED], 0, fade->priv->window);
 +}
 +
++/**
++ * gnome_bg_crossfade_start:
++ * @fade: a #GnomeBGCrossfade
++ * @window: The #GdkWindow to draw crossfade on
++ * @context: a #GMainContext to handle animation timeouts
++ *           or %NULL for default context
++ *
++ * This function initiates a quick crossfade between two pixmaps on
++ * the background of @window.  Before initiating the crossfade both
++ * gnome_bg_crossfade_start() and gnome_bg_crossfade_end() need to
++ * be called. If animations are disabled, the crossfade is skipped,
++ * and the window background is set immediately to the end pixmap.
++ **/
 +void
 +gnome_bg_crossfade_start (GnomeBGCrossfade *fade,
 +			  GdkWindow        *window,
@@ -738,6 +734,7 @@
 +	GSource *source;
 +
 +	g_return_if_fail (GNOME_IS_BG_CROSSFADE (fade));
++	g_return_if_fail (window != NULL);
 +	g_return_if_fail (fade->priv->fading_pixmap != NULL);
 +	g_return_if_fail (fade->priv->end_pixmap != NULL);
 +	g_return_if_fail (!gnome_bg_crossfade_is_started (fade));
@@ -754,13 +751,24 @@
 +	gdk_window_set_back_pixmap (fade->priv->window,
 +				    fade->priv->fading_pixmap,
 +				    FALSE);
-+        draw_background (fade);
++	draw_background (fade);
 +
 +	fade->priv->is_first_frame = TRUE;
 +	fade->priv->total_duration = .75;
 +	fade->priv->start_time = get_current_time ();
 +}
 +
++
++/**
++ * gnome_bg_crossfade_is_started:
++ * @fade: a #GnomeBGCrossfade
++ *
++ * This function reveals whether or not @fade is currently
++ * running on a window.  See gnome_bg_crossfade_start() for
++ * information on how to initiate a crossfade.
++ *
++ * Return value: %TRUE if fading, or %FALSE if not fading
++ **/
 +gboolean
 +gnome_bg_crossfade_is_started (GnomeBGCrossfade *fade)
 +{
@@ -769,19 +777,42 @@
 +	return fade->priv->timeout_id != 0;
 +}
 +
++/**
++ * gnome_bg_crossfade_stop:
++ * @fade: a #GnomeBGCrossfade
++ *
++ * This function stops any in progress crossfades that may be
++ * happening.  It's harmless to call this function if @fade is
++ * already stopped.
++ **/
 +void
 +gnome_bg_crossfade_stop (GnomeBGCrossfade *fade)
 +{
 +	g_return_if_fail (GNOME_IS_BG_CROSSFADE (fade));
 +
-+	if (fade->priv->timeout_id != 0) {
-+		g_source_remove (fade->priv->timeout_id);
-+	}
++	if (!gnome_bg_crossfade_is_started (fade))
++		return;
++
++	g_assert (fade->priv->timeout_id != 0);
++	g_source_remove (fade->priv->timeout_id);
++	fade->priv->timeout_id = 0;
 +}
-diff -up /dev/null gnome-desktop-2.25.1.1/libgnome-desktop/libgnomeui/gnome-bg-crossfade.h
---- /dev/null	2008-11-12 15:48:32.607088093 -0500
-+++ gnome-desktop-2.25.1.1/libgnome-desktop/libgnomeui/gnome-bg-crossfade.h	2008-11-13 01:02:30.000000000 -0500
-@@ -0,0 +1,76 @@
+diff --git a/libgnome-desktop/libgnomeui/Makefile.am b/libgnome-desktop/libgnomeui/Makefile.am
+--- a/libgnome-desktop/libgnomeui/Makefile.am
++++ b/libgnome-desktop/libgnomeui/Makefile.am
+@@ -1,6 +1,7 @@
+ libgnomeui_desktopdir = $(includedir)/gnome-desktop-2.0/libgnomeui
+ libgnomeui_desktop_HEADERS =	\
+ 	gnome-bg.h		\
++	gnome-bg-crossfade.h	\
+ 	gnome-desktop-thumbnail.h \
+ 	gnome-rr.h		\
+ 	gnome-rr-config.h	\
+diff --git a/libgnome-desktop/libgnomeui/gnome-bg-crossfade.h b/libgnome-desktop/libgnomeui/gnome-bg-crossfade.h
+new file mode 100644
+--- /dev/null
++++ b/libgnome-desktop/libgnomeui/gnome-bg-crossfade.h
+@@ -0,0 +1,75 @@
 +/* gnome-bg-crossfade.h - fade window background between two pixmaps
 +
 +   Copyright 2008, Red Hat, Inc.
@@ -792,12 +823,12 @@
 +   modify it under the terms of the GNU Library General Public License as
 +   published by the Free Software Foundation; either version 2 of the
 +   License, or (at your option) any later version.
-+   
++
 +   The Gnome Library is distributed in the hope that it will be useful,
 +   but WITHOUT ANY WARRANTY; without even the implied warranty of
 +   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 +   Library General Public License for more details.
-+   
++
 +   You should have received a copy of the GNU Library General Public
 +   License along with the Gnome Library; see the file COPYING.LIB.  If not,
 +   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
@@ -813,7 +844,6 @@
 +#error    GnomeBGCrossfade is unstable API. You must define GNOME_DESKTOP_USE_UNSTABLE_API before including gnome-bg-crossfade.h
 +#endif
 +
-+
 +#include <gdk/gdk.h>
 +
 +G_BEGIN_DECLS
@@ -858,27 +888,227 @@
 +G_END_DECLS
 +
 +#endif
-diff -up gnome-desktop-2.25.1.1/libgnome-desktop/libgnomeui/gnome-bg.h.fade gnome-desktop-2.25.1.1/libgnome-desktop/libgnomeui/gnome-bg.h
---- gnome-desktop-2.25.1.1/libgnome-desktop/libgnomeui/gnome-bg.h.fade	2008-11-05 07:51:36.000000000 -0500
-+++ gnome-desktop-2.25.1.1/libgnome-desktop/libgnomeui/gnome-bg.h	2008-11-13 01:02:30.000000000 -0500
-@@ -31,6 +31,7 @@
+
+============================================================
+ Add docstring for gnome_bg_set_pixmap_as_root
+
+  I'm going to be adding a parallel api that references
+this function in the docs, so we should document this
+one as well.
+
+diff --git a/libgnome-desktop/gnome-bg.c b/libgnome-desktop/gnome-bg.c
+--- a/libgnome-desktop/gnome-bg.c
++++ b/libgnome-desktop/gnome-bg.c
+@@ -1105,12 +1105,18 @@ gnome_bg_set_root_pixmap_id (GdkScreen *screen,
+ 			 (guchar *) &pixmap_id, 1);
+ }
  
- #include <gdk/gdk.h>
+-/* Set the root pixmap, and properties pointing to it. We
++/**
++ * gnome_bg_set_pixmap_as_root:
++ * @screen: the #GdkScreen to change root background on
++ * @pixmap: the #GdkPixmap to set root background from
++ *
++ * Set the root pixmap, and properties pointing to it. We
+  * do this atomically with a server grab to make sure that
+  * we won't leak the pixmap if somebody else it setting
+  * it at the same time. (This assumes that they follow the
+- * same conventions we do)
+- */
++ * same conventions we do).  @pixmap should come from a call
++ * to gnome_bg_create_pixmap().
++ **/
+ void
+ gnome_bg_set_pixmap_as_root (GdkScreen *screen, GdkPixmap *pixmap)
+ {
+
+============================================================
+ Add gnome_bg_set_pixmap_as_root_with_crossfade
+
+  This implements a crossfade transition when switching
+backgrounds.  To actually get the fade, though, requires
+changes to gnome-settings-daemon to use this function
+instead of gnome_bg_set_pixmap_as_root.
+
+We also expose gnome_bg_get_pixmap_from_root which will
+be useful for eel when it gets changed to do fading.
+
+diff --git a/libgnome-desktop/gnome-bg.c b/libgnome-desktop/gnome-bg.c
+--- a/libgnome-desktop/gnome-bg.c
++++ b/libgnome-desktop/gnome-bg.c
+@@ -38,10 +38,13 @@ Author: Soren Sandmann <sandmann at redhat.com>
+ #include <X11/Xlib.h>
+ #include <X11/Xatom.h>
+ 
++#include <cairo.h>
++
  #include <gconf/gconf-client.h>
+ 
+ #define GNOME_DESKTOP_USE_UNSTABLE_API
+ #include <libgnomeui/gnome-bg.h>
 +#include <libgnomeui/gnome-bg-crossfade.h>
+ 
+ #define BG_KEY_DRAW_BACKGROUND    GNOME_BG_KEY_DIR "/draw_background"
+ #define BG_KEY_PRIMARY_COLOR      GNOME_BG_KEY_DIR "/primary_color"
+@@ -1054,6 +1057,91 @@ gnome_bg_create_thumbnail (GnomeBG               *bg,
+ 	return result;
+ }
+ 
++/**
++ * gnome_bg_get_pixmap_from_root:
++ * @screen: a #GdkScreen
++ *
++ * This function queries the _XROOTPMAP_ID property from
++ * the root window associated with @screen to determine
++ * the current root window background pixmap and returns
++ * a copy of it. If the _XROOTPMAP_ID is not set, then
++ * a black pixmap is returned.
++ *
++ * Return value: a #GdkPixmap if successful or %NULL
++ **/
++GdkPixmap *
++gnome_bg_get_pixmap_from_root (GdkScreen *screen)
++{
++	int result;
++	gint format;
++	gulong nitems;
++	gulong bytes_after;
++	guchar *data;
++	Atom type;
++	Display *display;
++	int screen_num;
++	GdkPixmap *pixmap;
++	GdkPixmap *source_pixmap;
++	int width, height;
++	cairo_t *cr;
++	cairo_pattern_t *pattern;
++
++	display = GDK_DISPLAY_XDISPLAY (gdk_screen_get_display (screen));
++	screen_num = gdk_screen_get_number (screen);
++
++	result = XGetWindowProperty (display,
++				     RootWindow (display, screen_num),
++				     gdk_x11_get_xatom_by_name ("_XROOTPMAP_ID"),
++				     0L, 1L, False, XA_PIXMAP,
++				     &type, &format, &nitems, &bytes_after,
++				     &data);
++	pixmap = NULL;
++	source_pixmap = NULL;
++
++	if (result != Success || type != XA_PIXMAP ||
++	    format != 32 || nitems != 1) {
++		XFree (data);
++		data = NULL;
++	}
++
++	if (data != NULL) {
++		source_pixmap = gdk_pixmap_foreign_new (*(Pixmap *) data);
++		gdk_drawable_set_colormap (source_pixmap,
++					   gdk_screen_get_default_colormap (screen));
++	}
++
++	width = gdk_screen_get_width (screen);
++	height = gdk_screen_get_width (screen);
++
++	pixmap = gdk_pixmap_new (source_pixmap != NULL? source_pixmap :
++				 gdk_screen_get_root_window (screen),
++				 width, height, -1);
++
++	cr = gdk_cairo_create (pixmap);
++	if (source_pixmap != NULL) {
++		gdk_cairo_set_source_pixmap (cr, source_pixmap, 0, 0);
++		pattern = cairo_get_source (cr);
++		cairo_pattern_set_extend (pattern, CAIRO_EXTEND_REPEAT);
++	} else {
++		cairo_set_source_rgb (cr, 0.0, 0.0, 0.0);
++	}
++	cairo_paint (cr);
++
++	if (cairo_status (cr) != CAIRO_STATUS_SUCCESS) {
++		g_object_unref (pixmap);
++		pixmap = NULL;
++	}
++	cairo_destroy (cr);
++
++	if (source_pixmap != NULL)
++		g_object_unref (source_pixmap);
++
++	if (data != NULL)
++		XFree (data);
++
++	return pixmap;
++}
++
+ static void
+ gnome_bg_set_root_pixmap_id (GdkScreen *screen,
+ 			     GdkPixmap *pixmap)
+@@ -1142,6 +1230,54 @@ gnome_bg_set_pixmap_as_root (GdkScreen *screen, GdkPixmap *pixmap)
+ 	gdk_display_flush (gdk_screen_get_display (screen));
+ }
+ 
++/**
++ * gnome_bg_set_pixmap_as_root_with_crossfade:
++ * @screen: the #GdkScreen to change root background on
++ * @pixmap: the #GdkPixmap to set root background from
++ * @context: a #GMainContext or %NULL
++ *
++ * Set the root pixmap, and properties pointing to it.
++ * This function differs from gnome_bg_set_pixmap_as_root()
++ * in that it adds a subtle crossfade animation from the
++ * current root pixmap to the new one.
++ * same conventions we do).
++ *
++ * Return value: a #GnomeBGCrossfade object
++ **/
++GnomeBGCrossfade *
++gnome_bg_set_pixmap_as_root_with_crossfade (GdkScreen    *screen,
++					    GdkPixmap    *pixmap,
++					    GMainContext *context)
++{
++	GdkDisplay *display;
++	GdkWindow *root_window;
++	GdkPixmap *old_pixmap;
++	int      width, height;
++	GnomeBGCrossfade *fade;
++
++	g_return_val_if_fail (screen != NULL, NULL);
++	g_return_val_if_fail (pixmap != NULL, NULL);
++
++	root_window = gdk_screen_get_root_window (screen);
++
++	width = gdk_screen_get_width (screen);
++	height = gdk_screen_get_height (screen);
++
++	fade = gnome_bg_crossfade_new (width, height);
++
++	display = gdk_screen_get_display (screen);
++	gdk_x11_display_grab (display);
++	old_pixmap = gnome_bg_get_pixmap_from_root (screen);
++	gnome_bg_set_root_pixmap_id (screen, pixmap);
++	gnome_bg_crossfade_set_start_pixmap (fade, old_pixmap);
++	gnome_bg_crossfade_set_end_pixmap (fade, pixmap);
++	gdk_display_flush (display);
++	gdk_x11_display_ungrab (display);
++
++	gnome_bg_crossfade_start (fade, root_window, context);
++
++	return fade;
++}
+ 
+ /* Implementation of the pixbuf cache */
+ struct _SlideShow
+diff --git a/libgnome-desktop/libgnomeui/gnome-bg.h b/libgnome-desktop/libgnomeui/gnome-bg.h
+--- a/libgnome-desktop/libgnomeui/gnome-bg.h
++++ b/libgnome-desktop/libgnomeui/gnome-bg.h
+@@ -32,6 +32,7 @@
+ #include <gdk/gdk.h>
+ #include <gconf/gconf-client.h>
  #include <libgnomeui/gnome-desktop-thumbnail.h>
++#include <libgnomeui/gnome-bg-crossfade.h>
  
  G_BEGIN_DECLS
-@@ -63,6 +64,8 @@ typedef enum {
  
- GType            gnome_bg_get_type              (void);
- GnomeBG *        gnome_bg_new                   (void);
-+void             gnome_bg_ignore_changes        (GnomeBG *bg,
-+                                                 gboolean should_ignore);
- void             gnome_bg_load_from_preferences (GnomeBG               *bg,
- 						 GConfClient           *client);
- void             gnome_bg_save_to_preferences   (GnomeBG               *bg,
-@@ -109,6 +112,10 @@ gboolean         gnome_bg_changes_with_s
+@@ -109,6 +110,10 @@ gboolean         gnome_bg_changes_with_size     (GnomeBG               *bg);
  void             gnome_bg_set_pixmap_as_root    (GdkScreen             *screen,
  						 GdkPixmap             *pixmap);
  
@@ -889,25 +1119,59 @@
  
  G_END_DECLS
  
-diff -up gnome-desktop-2.25.1.1/libgnome-desktop/libgnomeui/Makefile.am.fade gnome-desktop-2.25.1.1/libgnome-desktop/libgnomeui/Makefile.am
---- gnome-desktop-2.25.1.1/libgnome-desktop/libgnomeui/Makefile.am.fade	2008-11-13 02:21:06.000000000 -0500
-+++ gnome-desktop-2.25.1.1/libgnome-desktop/libgnomeui/Makefile.am	2008-11-13 02:21:18.000000000 -0500
-@@ -1,6 +1,7 @@
- libgnomeui_desktopdir = $(includedir)/gnome-desktop-2.0/libgnomeui
- libgnomeui_desktop_HEADERS =	\
- 	gnome-bg.h		\
-+	gnome-bg-crossfade.h	\
- 	gnome-desktop-thumbnail.h \
- 	gnome-rr.h		\
- 	gnome-rr-config.h	\
-diff -up gnome-desktop-2.25.1.1/libgnome-desktop/Makefile.am.fade gnome-desktop-2.25.1.1/libgnome-desktop/Makefile.am
---- gnome-desktop-2.25.1.1/libgnome-desktop/Makefile.am.fade	2008-11-05 07:51:36.000000000 -0500
-+++ gnome-desktop-2.25.1.1/libgnome-desktop/Makefile.am	2008-11-13 01:02:30.000000000 -0500
-@@ -22,6 +22,7 @@ libgnome_desktop_2_la_SOURCES = \
- 	gnome-desktop-thumbnail.c \
- 	gnome-thumbnail-pixbuf-utils.c \
- 	gnome-bg.c		\
-+	gnome-bg-crossfade.c	\
- 	display-name.c		\
- 	gnome-rr.c		\
- 	gnome-rr-config.c	\
+
+============================================================
+ add new gnome_bg_ignore_changes api
+
+  This will prevent the "changed" signal from getting
+emitted before gnome-settings-daemon is ready for it.
+
+diff --git a/libgnome-desktop/gnome-bg.c b/libgnome-desktop/gnome-bg.c
+--- a/libgnome-desktop/gnome-bg.c
++++ b/libgnome-desktop/gnome-bg.c
+@@ -110,6 +110,8 @@ struct _GnomeBG
+ 	int			timeout_id;
+ 
+ 	GList *		        file_cache;
++
++	guint                   ignore_changes : 1;
+ };
+ 
+ struct _GnomeBGClass
+@@ -269,6 +271,10 @@ do_changed (GnomeBG *bg)
+ static void
+ queue_changed (GnomeBG *bg)
+ {
++	if (bg->ignore_changes) {
++		return;
++	}
++
+ 	if (bg->changed_id > 0) {
+ 		g_source_remove (bg->changed_id);
+ 	}
+@@ -589,6 +595,13 @@ gnome_bg_set_filename (GnomeBG     *bg,
+ 	}
+ }
+ 
++void
++gnome_bg_ignore_changes (GnomeBG *bg,
++                         gboolean should_ignore)
++{
++	bg->ignore_changes = should_ignore;
++}
++
+ static void
+ draw_color (GnomeBG *bg, GdkPixbuf *dest)
+ {
+diff --git a/libgnome-desktop/libgnomeui/gnome-bg.h b/libgnome-desktop/libgnomeui/gnome-bg.h
+--- a/libgnome-desktop/libgnomeui/gnome-bg.h
++++ b/libgnome-desktop/libgnomeui/gnome-bg.h
+@@ -64,6 +64,8 @@ typedef enum {
+ 
+ GType            gnome_bg_get_type              (void);
+ GnomeBG *        gnome_bg_new                   (void);
++void             gnome_bg_ignore_changes        (GnomeBG *bg,
++                                                 gboolean should_ignore);
+ void             gnome_bg_load_from_preferences (GnomeBG               *bg,
+ 						 GConfClient           *client);
+ void             gnome_bg_save_to_preferences   (GnomeBG               *bg,


Index: gnome-desktop.spec
===================================================================
RCS file: /cvs/pkgs/rpms/gnome-desktop/devel/gnome-desktop.spec,v
retrieving revision 1.190
retrieving revision 1.191
diff -u -r1.190 -r1.191
--- gnome-desktop.spec	4 Dec 2008 07:33:00 -0000	1.190
+++ gnome-desktop.spec	4 Dec 2008 19:59:13 -0000	1.191
@@ -12,7 +12,7 @@
 Summary: Package containing code shared among gnome-panel, gnome-session, nautilus, etc
 Name: gnome-desktop
 Version: 2.25.2
-Release: 2%{?dist}
+Release: 3%{?dist}
 URL: http://www.gnome.org
 Source0: http://download.gnome.org/sources/gnome-desktop/2.25/%{name}-%{version}.tar.bz2
 License: GPLv2+ and LGPLv2+
@@ -127,6 +127,9 @@
 %doc %{_datadir}/gtk-doc/html/gnome-desktop/
 
 %changelog
+* Thu Dec  4 2008 Ray Strode <rstrode at redhat.com> - 2.25.2-3
+- Rebase fade-in patch to latest from upstream report
+
 * Thu Dec  4 2008 Matthias Clasen <mclasen at redhat.com> - 2.25.2-2
 - Update to 2.25.2
 




More information about the fedora-extras-commits mailing list