[gnome-screensaver] Fix background scaling on multi-monitor setups



commit b451865470836cb90dc1fc41546cf999e03a2a74
Author: Martin SchmÃlzer <martin schmoelzer student tuwien ac at>
Date:   Sun Oct 16 16:08:41 2011 +0200

    Fix background scaling on multi-monitor setups
    
    https://bugzilla.gnome.org/show_bug.cgi?id=648193
    
    apply_background_to_window() in gs-manager.c uses the screen width and height to calculate the background size, which causes the background to be scaled incorrectly in multi-monitor setups.
    
    This fixes the calculation of the background size. However, spanned backgrounds require additional work.
    
    Signed-off-by: Martin SchmÃlzer <martin schmoelzer student tuwien ac at>

 src/gs-manager.c |   12 +++++++++---
 1 files changed, 9 insertions(+), 3 deletions(-)
---
diff --git a/src/gs-manager.c b/src/gs-manager.c
index 5dfbb42..f658fc3 100644
--- a/src/gs-manager.c
+++ b/src/gs-manager.c
@@ -799,6 +799,9 @@ apply_background_to_window (GSManager *manager,
 {
         cairo_surface_t *surface;
         GdkScreen       *screen;
+        GdkWindow       *gdk_window;
+        gint             monitor;
+        GdkRectangle     monitor_geometry;
         int              width;
         int              height;
 
@@ -808,11 +811,14 @@ apply_background_to_window (GSManager *manager,
         }
 
         screen = gs_window_get_screen (window);
-        width = gdk_screen_get_width (screen);
-        height = gdk_screen_get_height (screen);
+        gdk_window = gs_window_get_gdk_window (window);
+        monitor = gdk_screen_get_monitor_at_window (screen, gdk_window);
+        gdk_screen_get_monitor_geometry (screen, monitor, &monitor_geometry);
+        width = monitor_geometry.width;
+        height = monitor_geometry.height;
         gs_debug ("Creating background w:%d h:%d", width, height);
         surface = gnome_bg_create_surface (manager->priv->bg,
-                                           gs_window_get_gdk_window (window),
+                                           gdk_window,
                                            width,
                                            height,
                                            FALSE);



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