From cccd2081290bdb310aa8c75c080532ccd110bde4 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Nov 10 2009 00:20:38 +0000 Subject: copy F12 changes --- diff --git a/gnome-desktop.spec b/gnome-desktop.spec index 4097235..11c6dc6 100644 --- a/gnome-desktop.spec +++ b/gnome-desktop.spec @@ -12,7 +12,7 @@ Summary: Shared code among gnome-panel, gnome-session, nautilus, etc Name: gnome-desktop Version: 2.28.1 -Release: 3%{?dist} +Release: 4%{?dist} URL: http://www.gnome.org Source0: http://download.gnome.org/sources/gnome-desktop/2.28/%{name}-%{version}.tar.bz2 Patch1: concatenate-edid-descriptors.patch @@ -20,6 +20,8 @@ Patch1: concatenate-edid-descriptors.patch Patch2: randr-gamma.patch # https://bugzilla.gnome.org/show_bug.cgi?id=599914 Patch3: ignore-xrandr-badmatch.patch +# https://bugzilla.gnome.org/show_bug.cgi?id=147808 +Patch4: per-monitor-background.patch License: GPLv2+ and LGPLv2+ Group: System Environment/Libraries @@ -81,6 +83,7 @@ libgnomedesktop. %patch1 -p1 -b .concatenate-edid-descriptors %patch2 -p1 -b .randr-gamma %patch3 -p1 -b .ignore-xrandr-badmatch +%patch4 -p1 -b .per-monitor-background %build %configure --with-gnome-distributor="Red Hat, Inc" \ @@ -128,6 +131,9 @@ rm -rf $RPM_BUILD_ROOT %doc %{_datadir}/gtk-doc/html/gnome-desktop/ %changelog +* Mon Nov 9 2009 Matthias Clasen - 2.28.1-4 +- Draw backgrounds per-monitor (gnome #147808) + * Mon Nov 9 2009 Matthias Clasen - 2.28.1-3 - Ignore X errors when setting screen size (gnome #599914) diff --git a/per-monitor-background.patch b/per-monitor-background.patch new file mode 100644 index 0000000..022cc5f --- /dev/null +++ b/per-monitor-background.patch @@ -0,0 +1,178 @@ +diff -up gnome-desktop-2.28.1/libgnome-desktop/gnome-bg.c.per-monitor-background gnome-desktop-2.28.1/libgnome-desktop/gnome-bg.c +--- gnome-desktop-2.28.1/libgnome-desktop/gnome-bg.c.per-monitor-background 2009-08-19 11:51:03.000000000 -0400 ++++ gnome-desktop-2.28.1/libgnome-desktop/gnome-bg.c 2009-11-09 17:05:49.839583495 -0500 +@@ -168,6 +168,9 @@ static gboolean get_thumb_annotations + int *orig_height); + + /* Cache */ ++static GdkPixbuf *get_pixbuf_for_size (GnomeBG *bg, ++ int width, ++ int height); + static GdkPixbuf *get_pixbuf (GnomeBG *bg); + static void clear_cache (GnomeBG *bg); + static gboolean is_different (GnomeBG *bg, +@@ -685,12 +688,13 @@ get_scaled_pixbuf (GnomeBGPlacement plac + } + + static void +-draw_image (GnomeBGPlacement placement, +- GdkPixbuf *pixbuf, +- GdkPixbuf *dest) ++draw_image_region (GnomeBGPlacement placement, ++ GdkPixbuf *pixbuf, ++ GdkPixbuf *dest, ++ GdkRectangle *region) + { +- int dest_width = gdk_pixbuf_get_width (dest); +- int dest_height = gdk_pixbuf_get_height (dest); ++ int dest_width = region->width; ++ int dest_height = region->height; + int x, y, w, h; + GdkPixbuf *scaled; + +@@ -708,7 +712,7 @@ draw_image (GnomeBGPlacement placement, + case GNOME_BG_PLACEMENT_CENTERED: + case GNOME_BG_PLACEMENT_FILL_SCREEN: + case GNOME_BG_PLACEMENT_SCALED: +- pixbuf_blend (scaled, dest, 0, 0, w, h, x, y, 1.0); ++ pixbuf_blend (scaled, dest, 0, 0, w, h, x + region->x, y + region->y, 1.0); + break; + default: + g_assert_not_reached (); +@@ -718,15 +722,62 @@ draw_image (GnomeBGPlacement placement, + g_object_unref (scaled); + } + +-void +-gnome_bg_draw (GnomeBG *bg, GdkPixbuf *dest) ++static void ++draw_image (GnomeBGPlacement placement, ++ GdkPixbuf *pixbuf, ++ GdkPixbuf *dest) ++{ ++ GdkRectangle rect; ++ ++ rect.x = 0; ++ rect.y = 0; ++ rect.width = gdk_pixbuf_get_width (dest); ++ rect.height = gdk_pixbuf_get_height (dest); ++ ++ draw_image_region (placement, pixbuf, dest, &rect); ++} ++ ++static void ++draw_on_monitor (GnomeBG *bg, GdkPixbuf *dest, GdkRectangle *region) ++{ ++ draw_image_region (bg->placement, get_pixbuf_for_size (bg, region->width, region->height), dest, region); ++} ++ ++static void ++draw_each_monitor (GnomeBG *bg, GdkPixbuf *dest, GdkScreen *screen) ++{ ++ if (bg->placement == GNOME_BG_PLACEMENT_TILED) { ++ /* don't worry about aligning on every monitor */ ++ draw_image (bg->placement, get_pixbuf (bg), dest); ++ } else { ++ gint num_monitors; ++ GdkRectangle rect; ++ int monitor; ++ ++ num_monitors = gdk_screen_get_n_monitors (screen); ++ ++ for (monitor = 0; monitor < num_monitors; monitor++) { ++ gdk_screen_get_monitor_geometry (screen, monitor, &rect); ++ draw_on_monitor (bg, dest, &rect); ++ } ++ } ++} ++ ++static void ++draw_on_screen (GnomeBG *bg, GdkPixbuf *dest, GdkScreen *screen) + { + if (!bg) + return; + + draw_color (bg, dest); + +- draw_image (bg->placement, get_pixbuf (bg), dest); ++ draw_each_monitor (bg, dest, screen); ++} ++ ++void ++gnome_bg_draw (GnomeBG *bg, GdkPixbuf *dest) ++{ ++ draw_on_screen (bg, dest, gdk_screen_get_default ()); + } + + gboolean +@@ -883,7 +934,7 @@ gnome_bg_create_pixmap (GnomeBG *bg, + + pixbuf = gdk_pixbuf_new (GDK_COLORSPACE_RGB, FALSE, 8, + width, height); +- gnome_bg_draw (bg, pixbuf); ++ draw_on_screen (bg, pixbuf, gdk_drawable_get_screen (GDK_DRAWABLE (window))); + gdk_draw_pixbuf (pixmap, NULL, pixbuf, + 0, 0, + 0, 0, width, height, +@@ -1880,13 +1931,16 @@ find_best_size (GSList *sizes, gint widt + } + + static GdkPixbuf * +-get_pixbuf (GnomeBG *bg) ++get_pixbuf_for_size (GnomeBG *bg, gint best_width, gint best_height) + { + /* FIXME: this ref=TRUE/FALSE stuff is crazy */ +- ++ gint width, height; + guint time_until_next_change; + gboolean ref = FALSE; +- ++ ++ width = (best_width > 0) ? best_width : bg->last_pixmap_width; ++ height = (best_height > 0) ? best_height : bg->last_pixmap_height; ++ + if (!bg->pixbuf_cache && bg->filename) { + ref = TRUE; + bg->file_mtime = get_mtime (bg->filename); +@@ -1906,15 +1960,15 @@ get_pixbuf (GnomeBG *bg) + time_until_next_change = (guint)get_slide_timeout (slide); + if (slide->fixed) { + FileSize *size; +- size = find_best_size (slide->file1, bg->last_pixmap_width, bg->last_pixmap_height); ++ size = find_best_size (slide->file1, width, height); + bg->pixbuf_cache = get_as_pixbuf (bg, size->file); + } + else { + FileSize *size; + GdkPixbuf *p1, *p2; +- size = find_best_size (slide->file1, bg->last_pixmap_width, bg->last_pixmap_height); ++ size = find_best_size (slide->file1, width, height); + p1 = get_as_pixbuf (bg, size->file); +- size = find_best_size (slide->file2, bg->last_pixmap_width, bg->last_pixmap_height); ++ size = find_best_size (slide->file2, width, height); + p2 = get_as_pixbuf (bg, size->file); + + +@@ -1943,6 +1997,22 @@ get_pixbuf (GnomeBG *bg) + return bg->pixbuf_cache; + } + ++static GdkPixbuf * ++get_pixbuf (GnomeBG *bg) ++{ ++ GdkPixbuf *pixbuf; ++ GdkScreen *screen; ++ GdkRectangle rect; ++ ++ screen = gdk_screen_get_default (); ++ ++ /* default to caching the primary monitor */ ++ gdk_screen_get_monitor_geometry (screen, 0, &rect); ++ pixbuf = get_pixbuf_for_size (bg, rect.width, rect.height); ++ ++ return pixbuf; ++} ++ + static gboolean + is_different (GnomeBG *bg, + const char *filename)