summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLeonardo Donelli <learts92@gmail.com>2013-05-10 01:47:37 +0200
committerFelix Riemann <friemann@gnome.org>2013-05-10 14:48:13 +0200
commit3624b85895ef4ef2c840e4c84cf2fef0b35625bc (patch)
treec5bd7ee63ca4c9ba819350f3a170d6a45fd67ddc
parent988697cfdd6d46fc05afa9b62088833c5a3f6335 (diff)
downloadeog-3624b85895ef4ef2c840e4c84cf2fef0b35625bc.tar.gz
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
-rw-r--r--src/eog-window.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/src/eog-window.c b/src/eog-window.c
index ccf95645..f4f25efd 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;