React to screen changes when rendering the desktop

This commit is contained in:
Matthias Clasen 2009-11-09 21:00:09 +00:00
parent 495077b127
commit edbc1e3cf4
3 changed files with 171 additions and 9 deletions

View File

@ -0,0 +1,35 @@
From c05c9b8c19f4c735ac1809f8bc61a3c13ea42c12 Mon Sep 17 00:00:00 2001
From: Bastien Nocera <hadess@hadess.net>
Date: Thu, 5 Nov 2009 22:21:52 +0000
Subject: [PATCH] Avoid volumes going over 100%
Because we don't handle that.
https://bugzilla.gnome.org/show_bug.cgi?id=600770
---
plugins/media-keys/gsd-media-keys-manager.c | 6 ++++--
1 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/plugins/media-keys/gsd-media-keys-manager.c b/plugins/media-keys/gsd-media-keys-manager.c
index b10fc64..86cb9d4 100644
--- a/plugins/media-keys/gsd-media-keys-manager.c
+++ b/plugins/media-keys/gsd-media-keys-manager.c
@@ -618,11 +618,13 @@ update_dialog (GsdMediaKeysManager *manager,
guint vol,
gboolean muted)
{
+ vol = (int) (100 * (double) vol / PA_VOLUME_NORM);
+ vol = CLAMP (vol, 0, 100);
+
dialog_init (manager);
gsd_media_keys_window_set_volume_muted (GSD_MEDIA_KEYS_WINDOW (manager->priv->dialog),
muted);
- gsd_media_keys_window_set_volume_level (GSD_MEDIA_KEYS_WINDOW (manager->priv->dialog),
- (int) (100 * (double)vol / PA_VOLUME_NORM));
+ gsd_media_keys_window_set_volume_level (GSD_MEDIA_KEYS_WINDOW (manager->priv->dialog), vol);
gsd_media_keys_window_set_action (GSD_MEDIA_KEYS_WINDOW (manager->priv->dialog),
GSD_MEDIA_KEYS_WINDOW_ACTION_VOLUME);
dialog_show (manager);
--
1.6.5.2

View File

@ -1,6 +1,6 @@
Name: gnome-settings-daemon Name: gnome-settings-daemon
Version: 2.28.1 Version: 2.28.1
Release: 5%{?dist} Release: 7%{?dist}
Summary: The daemon sharing settings from GNOME to GTK+/KDE applications Summary: The daemon sharing settings from GNOME to GTK+/KDE applications
Group: System Environment/Daemons Group: System Environment/Daemons
@ -35,14 +35,16 @@ BuildRequires: libcanberra-devel
# https://bugzilla.gnome.org/show_bug.cgi?id=596136 # https://bugzilla.gnome.org/show_bug.cgi?id=596136
Patch0: 0002-Use-a-rounded-instead-of-curved-rectangle.patch Patch0: 0002-Use-a-rounded-instead-of-curved-rectangle.patch
Patch1: 0003-Improve-the-media-keys-overlay-design.patch Patch1: 0003-Improve-the-media-keys-overlay-design.patch
# https://bugzilla.gnome.org/show_bug.cgi?id=567249
Patch4: 0001-Fix-bluriness-in-level-bar-and-popup.patch
# https://bugzilla.redhat.com/show_bug.cgi?id=498249 # https://bugzilla.redhat.com/show_bug.cgi?id=498249
Patch2: left-handed-touchpad.patch Patch2: left-handed-touchpad.patch
# change font rendering # change font rendering
Patch3: slight-hinting.patch Patch3: slight-hinting.patch
# https://bugzilla.gnome.org/show_bug.cgi?id=567249
Patch4: 0001-Fix-bluriness-in-level-bar-and-popup.patch
# https://bugzilla.gnome.org/show_bug.cgi?id=600770
Patch5: 0001-Avoid-volumes-going-over-100.patch
# https://bugzilla.gnome.org/show_bug.cgi?id=601203
Patch6: gsd-screen-changed.patch
%description %description
A daemon to share settings from GNOME to other applications. It also A daemon to share settings from GNOME to other applications. It also
@ -66,6 +68,8 @@ developing applications that use %{name}.
%patch1 -p1 -b .osd-visual-refresh %patch1 -p1 -b .osd-visual-refresh
%patch2 -p1 -b .left-handed-touchpad %patch2 -p1 -b .left-handed-touchpad
%patch3 -p1 -b .slight-hinting %patch3 -p1 -b .slight-hinting
%patch5 -p1 -b .too-high-volume
%patch6 -p1 -b .screen-change
%build %build
%configure --enable-static=no --enable-profiling --disable-esd %configure --enable-static=no --enable-profiling --disable-esd
@ -177,14 +181,30 @@ fi
%{_libdir}/pkgconfig/gnome-settings-daemon.pc %{_libdir}/pkgconfig/gnome-settings-daemon.pc
%changelog %changelog
* Mon Nov 9 2009 Matthias Clasen <mclasen@redhat.com> 2.28.1-7
- React to screen changes when showing the background (gnome 601203)
* Thu Nov 05 2009 Bastien Nocera <bnocera@redhat.com> 2.28.1-6
- Fix the volume going over 100% in the OSD
* Wed Oct 28 2009 Bastien Nocera <bnocera@redhat.com> 2.28.1-5 * Wed Oct 28 2009 Bastien Nocera <bnocera@redhat.com> 2.28.1-5
- Tweak OSD blurinness again - Update OSD code again
* Tue Oct 27 2009 Bastien Nocera <bnocera@redhat.com> 2.28.1-4 * Tue Oct 27 2009 Bastien Nocera <bnocera@redhat.com> 2.28.1-4
- Update from F-12 branch - Fix bluriness in OSD
* Tue Oct 27 2009 Bastien Nocera <bnocera@redhat.com> 2.28.0-4 * Mon Oct 26 2009 Matthias Clasen <mclasen@redhat.com> - 2.28.1-3
- Fix blurriness in the OSD display - Change default font rendering to use slight hinting
* Mon Oct 26 2009 Peter Hutterer <peter.hutterer@redhat.com> 2.28.1-2
- left-handed-touchpad.patch: change physical touchpad buttons to
left-handed, not tapping though (#498249)
* Mon Oct 19 2009 Matthias Clasen <mclasen@redhat.com> - 2.28.1-1
- Update to 2.28.1
* Thu Oct 1 2009 Matthias Clasen <mclasen@redhat.com> - 2.28.0-4
- Fix keyboard variant handling
* Fri Sep 25 2009 Matthias Clasen <mclasen@redhat.com> - 2.28.0-3 * Fri Sep 25 2009 Matthias Clasen <mclasen@redhat.com> - 2.28.0-3
- Align the OSD visuals with the notification theme - Align the OSD visuals with the notification theme

107
gsd-screen-changed.patch Normal file
View File

@ -0,0 +1,107 @@
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,