update monitor aspect ratio patch

This commit is contained in:
Matthias Clasen 2009-12-10 23:54:49 +00:00
parent 943274a4f1
commit 0c129aa17a
2 changed files with 186 additions and 7 deletions

View File

@ -1,8 +1,37 @@
From cd770f34590de85b7ea0f0feccf5657590550918 Mon Sep 17 00:00:00 2001
From: William Jon McCann <jmccann@redhat.com>
Date: Thu, 3 Dec 2009 23:52:08 -0500
Subject: [PATCH] Fixes to enable per-monitor backgrounds
https://bugzilla.gnome.org/show_bug.cgi?id=147808
---
eel/eel-background.c | 81 +++++++++++++++++++++----------------------------
1 files changed, 35 insertions(+), 46 deletions(-)
diff --git a/eel/eel-background.c b/eel/eel-background.c
index 9c40629..2854a07 100644
index 9c40629..4d9e8e8 100644
--- a/eel/eel-background.c
+++ b/eel/eel-background.c
@@ -94,6 +94,8 @@ struct EelBackgroundDetails {
@@ -50,8 +50,8 @@ static void eel_background_init (gpointer objec
static void eel_background_finalize (GObject *object);
static GdkPixmap *eel_background_get_pixmap_and_color (EelBackground *background,
GdkWindow *window,
- GdkColor *color,
- gboolean *changes_with_size);
+ GdkColor *color);
+
static void set_image_properties (EelBackground *background);
static void init_fade (EelBackground *background, GtkWidget *widget);
@@ -80,7 +80,6 @@ struct EelBackgroundDetails {
GtkWidget *widget;
/* Realized data: */
- gboolean background_changes_with_size;
GdkPixmap *background_pixmap;
gboolean background_pixmap_is_unset_root_pixmap;
GnomeBGCrossfade *fade;
@@ -94,6 +93,8 @@ struct EelBackgroundDetails {
gboolean is_desktop;
/* Desktop screen size watcher */
gulong screen_size_handler;
@ -11,7 +40,134 @@ index 9c40629..2854a07 100644
/* Can we use common pixmap for root window and desktop window */
gboolean use_common_pixmap;
guint change_idle_id;
@@ -869,7 +871,6 @@ screen_size_changed (GdkScreen *screen, EelBackground *background)
@@ -365,14 +366,6 @@ eel_background_ensure_realized (EelBackground *background, GdkWindow *window)
gdk_rgb_find_color (style->colormap, &(background->details->default_color));
}
- /* If the pixmap doesn't change with the window size, never update
- * it again.
- */
- if (background->details->background_pixmap != NULL &&
- !background->details->background_changes_with_size) {
- return FALSE;
- }
-
/* If the window size is the same as last time, don't update */
if (entire_width == background->details->background_entire_width &&
entire_height == background->details->background_entire_height) {
@@ -385,7 +378,6 @@ eel_background_ensure_realized (EelBackground *background, GdkWindow *window)
set_image_properties (background);
- background->details->background_changes_with_size = gnome_bg_changes_with_size (background->details->bg);
background->details->background_pixmap = gnome_bg_create_pixmap (background->details->bg,
window,
entire_width, entire_height,
@@ -408,8 +400,7 @@ eel_background_ensure_realized (EelBackground *background, GdkWindow *window)
static GdkPixmap *
eel_background_get_pixmap_and_color (EelBackground *background,
GdkWindow *window,
- GdkColor *color,
- gboolean *changes_with_size)
+ GdkColor *color)
{
int entire_width;
int entire_height;
@@ -419,7 +410,6 @@ eel_background_get_pixmap_and_color (EelBackground *background,
eel_background_ensure_realized (background, window);
*color = background->details->default_color;
- *changes_with_size = background->details->background_changes_with_size;
if (background->details->background_pixmap != NULL) {
return g_object_ref (background->details->background_pixmap);
@@ -434,7 +424,6 @@ eel_background_expose (GtkWidget *widget,
GdkColor color;
int window_width;
int window_height;
- gboolean changes_with_size;
GdkPixmap *pixmap;
GdkGC *gc;
GdkGCValues gc_values;
@@ -452,19 +441,8 @@ eel_background_expose (GtkWidget *widget,
pixmap = eel_background_get_pixmap_and_color (background,
widget->window,
- &color,
- &changes_with_size);
-
- if (!changes_with_size) {
- /* The background was already drawn by X, since we set
- * the GdkWindow background/back_pixmap.
- * No need to draw it again. */
- if (pixmap) {
- g_object_unref (pixmap);
- }
- return;
- }
-
+ &color);
+
if (pixmap) {
gc_values.tile = pixmap;
gc_values.ts_x_origin = 0;
@@ -670,12 +648,10 @@ set_root_pixmap (EelBackground *background,
GdkPixmap *pixmap, *root_pixmap;
GdkScreen *screen;
GdkColor color;
- gboolean changes_with_size;
pixmap = eel_background_get_pixmap_and_color (background,
window,
- &color,
- &changes_with_size);
+ &color);
screen = gdk_drawable_get_screen (window);
if (background->details->use_common_pixmap) {
@@ -730,7 +706,6 @@ eel_background_set_up_widget (EelBackground *background, GtkWidget *widget)
int window_height;
GdkWindow *window;
- gboolean changes_with_size;
gboolean in_fade;
if (!GTK_WIDGET_REALIZED (widget)) {
@@ -741,8 +716,7 @@ eel_background_set_up_widget (EelBackground *background, GtkWidget *widget)
pixmap = eel_background_get_pixmap_and_color (background,
widget->window,
- &color,
- &changes_with_size);
+ &color);
style = gtk_widget_get_style (widget);
@@ -761,17 +735,14 @@ eel_background_set_up_widget (EelBackground *background, GtkWidget *widget)
}
if (!in_fade) {
- if (!changes_with_size || background->details->is_desktop) {
- gdk_window_set_back_pixmap (window, pixmap, FALSE);
- } else {
- gdk_window_set_back_pixmap (window, NULL, FALSE);
- gdk_window_set_background (window, &color);
- }
+ if (background->details->is_desktop) {
+ gdk_window_set_back_pixmap (window, pixmap, FALSE);
+ } else {
+ gdk_window_set_back_pixmap (window, NULL, FALSE);
+ gdk_window_set_background (window, &color);
+ }
}
- background->details->background_changes_with_size =
- gnome_bg_changes_with_size (background->details->bg);
-
if (background->details->is_desktop && !in_fade) {
set_root_pixmap (background, window);
}
@@ -869,7 +840,6 @@ screen_size_changed (GdkScreen *screen, EelBackground *background)
g_signal_emit (background, signals[APPEARANCE_CHANGED], 0);
}
@ -19,7 +175,7 @@ index 9c40629..2854a07 100644
static void
widget_realized_setup (GtkWidget *widget, gpointer data)
{
@@ -891,6 +892,13 @@ widget_realized_setup (GtkWidget *widget, gpointer data)
@@ -891,6 +861,13 @@ widget_realized_setup (GtkWidget *widget, gpointer data)
background->details->screen_size_handler =
g_signal_connect (screen, "size_changed",
G_CALLBACK (screen_size_changed), background);
@ -33,7 +189,7 @@ index 9c40629..2854a07 100644
root_window = gdk_screen_get_root_window(screen);
@@ -928,6 +936,11 @@ widget_unrealize_cb (GtkWidget *widget, gpointer data)
@@ -928,6 +905,11 @@ widget_unrealize_cb (GtkWidget *widget, gpointer data)
background->details->screen_size_handler);
background->details->screen_size_handler = 0;
}
@ -45,3 +201,22 @@ index 9c40629..2854a07 100644
background->details->use_common_pixmap = FALSE;
}
@@ -1022,7 +1004,14 @@ eel_get_widget_background (GtkWidget *widget)
gboolean
eel_background_is_dark (EelBackground *background)
{
- return gnome_bg_is_dark (background->details->bg);
+ GdkScreen *screen;
+ GdkRectangle rect;
+
+ /* only check for the background on the 0th monitor */
+ screen = gdk_screen_get_default ();
+ gdk_screen_get_monitor_geometry (screen, 0, &rect);
+
+ return gnome_bg_is_dark (background->details->bg, rect.width, rect.height);
}
/* handle dropped colors */
--
1.6.5.2

View File

@ -4,7 +4,7 @@
%define gnome_icon_theme_version 1.1.5
%define libxml2_version 2.4.20
%define desktop_file_utils_version 0.7
%define gnome_desktop_version 2.25.5
%define gnome_desktop_version 2.29.3-2
%define redhat_menus_version 0.25
%define startup_notification_version 0.5
%define libexif_version 0.5.12
@ -15,7 +15,7 @@
Name: nautilus
Summary: File manager for GNOME
Version: 2.28.2
Release: 2%{?dist}
Release: 3%{?dist}
License: GPLv2+
Group: User Interface/Desktops
Source: http://download.gnome.org/sources/%{name}/2.28/%{name}-%{version}.tar.bz2
@ -59,6 +59,7 @@ BuildRequires: gtk-doc
Requires(pre): GConf2 >= %{gconf_version}
Requires(preun): GConf2 >= %{gconf_version}
Requires(post): GConf2 >= %{gconf_version}
Requires: gnome-desktop >= %{gnome_desktop_version}
Obsoletes: nautilus-extras
Obsoletes: nautilus-suggested
@ -269,6 +270,9 @@ fi
%changelog
* Thu Dec 10 2009 Jon McCann <jmccann@redhat.com> - 2.28.2-3
- Update the monitor changes patch (gnome #147808)
* Tue Dec 8 2009 Tomas Bzatek <tbzatek@redhat.com> - 2.28.2-2
- Fix some memory leaks