[eog] Set better window size



commit 3624b85895ef4ef2c840e4c84cf2fef0b35625bc
Author: Leonardo Donelli <learts92 gmail com>
Date:   Fri May 10 01:47:37 2013 +0200

    Set better window size
    
    Make sure the window is not too big for the screen size.
    The previous version did that in a way that didn't work
    with some images size, particularly on 16:9 displays.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=630512

 src/eog-window.c |   10 ++++------
 1 files changed, 4 insertions(+), 6 deletions(-)
---
diff --git a/src/eog-window.c b/src/eog-window.c
index ccf9564..f4f25ef 100644
--- a/src/eog-window.c
+++ b/src/eog-window.c
@@ -1244,13 +1244,11 @@ eog_window_obtain_desired_size (EogImage  *image,
                if ((img_width + deco_width > screen_width) ||
                    (img_height + deco_height > screen_height))
                {
-                       double factor;
+                       double width_factor, height_factor, factor;
 
-                       if (img_width > img_height) {
-                               factor = (screen_width * 0.75 - deco_width) / (double) img_width;
-                       } else {
-                               factor = (screen_height * 0.75 - deco_height) / (double) img_height;
-                       }
+                       width_factor = (screen_width * 0.75 - deco_width) / (double) img_width;
+                       height_factor = (screen_height * 0.75 - deco_height) / (double) img_height;
+                       factor = MIN (width_factor, height_factor);
 
                        img_width = img_width * factor;
                        img_height = img_height * factor;


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