Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/libview
diff options
context:
space:
mode:
authorCarlos Garcia Campos <carlosgc@gnome.org>2010-03-13 14:45:02 (GMT)
committer Carlos Garcia Campos <carlosgc@gnome.org>2010-03-13 14:45:02 (GMT)
commitcb2ba938b053f63558bfba2d6cde2d66d7583ca6 (patch)
treeb2905a95a5ee8406d84fefe4e0d275f84bc33665 /libview
parent9aa54d8bf6ca229d5dc473b73336d799c8bf448f (diff)
[presentation] Fix scale calculation on rotated monitors
Spotted by José Aliste.
Diffstat (limited to 'libview')
-rw-r--r--libview/ev-view-presentation.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/libview/ev-view-presentation.c b/libview/ev-view-presentation.c
index 7d72541..17491ae 100644
--- a/libview/ev-view-presentation.c
+++ b/libview/ev-view-presentation.c
@@ -62,6 +62,7 @@ struct _EvViewPresentation
guint rotation;
EvPresentationState state;
gdouble scale;
+ gint monitor_width;
gint monitor_height;
/* Cursors */
@@ -168,9 +169,14 @@ ev_view_presentation_get_scale_for_page (EvViewPresentation *pview,
gdouble width, height;
ev_document_get_page_size (pview->document, page, &width, &height);
- pview->scale = (pview->rotation == 90 || pview->rotation == 270) ?
- pview->monitor_height / width :
- pview->monitor_height / height;
+ if (pview->rotation == 90 || pview->rotation == 270) {
+ gdouble tmp;
+
+ tmp = width;
+ width = height;
+ height = tmp;
+ }
+ pview->scale = MIN (pview->monitor_width / width, pview->monitor_height / height);
}
return pview->scale;
@@ -1195,6 +1201,7 @@ init_presentation (GtkWidget *widget)
monitor_num = gdk_screen_get_monitor_at_window (screen, widget->window);
gdk_screen_get_monitor_geometry (screen, monitor_num, &monitor);
+ pview->monitor_width = monitor.width;
pview->monitor_height = monitor.height;
ev_view_presentation_update_current_page (pview, pview->current_page);