[Xfce4-commits] <xfce4-settings:master> Fix buggy computation of the screen size

Nick Schermer noreply at xfce.org
Sun Oct 28 10:45:13 CET 2012


Updating branch refs/heads/master
         to 6b51b394691ddcde8bdad2c49dcc5cfe53d844b2 (commit)
       from 0de6f94cf852014bfde94eac9999903bf9f43995 (commit)

commit 6b51b394691ddcde8bdad2c49dcc5cfe53d844b2
Author: Lionel Le Folgoc <lionel at lefolgoc.net>
Date:   Thu Oct 18 14:25:14 2012 +0200

    Fix buggy computation of the screen size
    
    It's meaningless with multiple outputs, so change the code to match what's done
    in other apps (GnomeRR, chromeos).
    
    Signed-off-by: Simon Steinbeiss <simon.steinbeiss at elfenbeinturm.at>

 xfsettingsd/displays.c |   23 ++++++++---------------
 1 files changed, 8 insertions(+), 15 deletions(-)

diff --git a/xfsettingsd/displays.c b/xfsettingsd/displays.c
index b21b2bc..2517057 100644
--- a/xfsettingsd/displays.c
+++ b/xfsettingsd/displays.c
@@ -169,26 +169,19 @@ xfce_displays_helper_process_screen_size (gint  mode_width,
                                           gint *mm_width,
                                           gint *mm_height)
 {
-    gdouble dpi = 0;
-
     g_assert (width && height && mm_width && mm_height);
 
     *width = MAX (*width, crtc_pos_x + mode_width);
     *height = MAX (*height, crtc_pos_y + mode_height);
 
-    dpi = 25.4 * gdk_screen_height ();
-    dpi /= gdk_screen_height_mm ();
-
-    if (dpi <= 0)
-    {
-        *mm_width = gdk_screen_width_mm ();
-        *mm_height = gdk_screen_height_mm ();
-    }
-    else
-    {
-        *mm_width = 25.4 * (*width) / dpi;
-        *mm_height = 25.4 * (*height) / dpi;
-    }
+    /* The 'physical size' of an X screen is meaningless if that screen
+     * can consist of many monitors. So just pick a size that make the
+     * dpi 96.
+     *
+     * Firefox and Evince apparently believe what X tells them.
+     */
+    *mm_width = (*width / 96.0) * 25.4 + 0.5;
+    *mm_height = (*height / 96.0) * 25.4 + 0.5;
 }
 
 


More information about the Xfce4-commits mailing list