Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/libview/ev-view.c
diff options
context:
space:
mode:
authorCarlos Garcia Campos <carlosgc@gnome.org>2010-05-09 10:58:39 (GMT)
committer Carlos Garcia Campos <carlosgc@gnome.org>2010-05-10 11:58:30 (GMT)
commit6ab3c9184c95446e436bf6e71b9b8228644b1960 (patch)
treedb0d063d979d65de84cc9f1b0171f77d50a6c5e8 /libview/ev-view.c
parenteb80ecd1f7aa6ff57d2a3324c691274745ca4ed0 (diff)
[libview] Keep our own GtkRequisition and use it to set adjusment values
Diffstat (limited to 'libview/ev-view.c')
-rw-r--r--libview/ev-view.c42
1 files changed, 31 insertions, 11 deletions
diff --git a/libview/ev-view.c b/libview/ev-view.c
index ac8b949..c766dd2 100644
--- a/libview/ev-view.c
+++ b/libview/ev-view.c
@@ -465,12 +465,12 @@ ev_view_get_scrollbar_size (EvView *view,
return 0;
if (orientation == GTK_ORIENTATION_VERTICAL) {
- if (widget->allocation.height >= widget->requisition.height)
+ if (widget->allocation.height >= view->requisition.height)
sb = gtk_scrolled_window_get_vscrollbar (GTK_SCROLLED_WINDOW (swindow));
else
return 0;
} else {
- if (widget->allocation.width >= widget->requisition.width)
+ if (widget->allocation.width >= view->requisition.width)
sb = gtk_scrolled_window_get_hscrollbar (GTK_SCROLLED_WINDOW (swindow));
else
return 0;
@@ -555,11 +555,11 @@ view_set_adjustment_values (EvView *view,
gint new_value;
if (orientation == GTK_ORIENTATION_HORIZONTAL) {
- requisition = widget->requisition.width;
+ requisition = view->requisition.width;
allocation = widget->allocation.width;
adjustment = view->hadjustment;
} else {
- requisition = widget->requisition.height;
+ requisition = view->requisition.height;
allocation = widget->allocation.height;
adjustment = view->vadjustment;
}
@@ -2835,19 +2835,35 @@ ev_view_size_request (GtkWidget *widget,
EvView *view = EV_VIEW (widget);
if (view->document == NULL) {
- requisition->width = 1;
- requisition->height = 1;
+ view->requisition.width = 1;
+ view->requisition.height = 1;
+
+ *requisition = view->requisition;
+
return;
}
+ /* Get zoom for size here when not called from
+ * ev_view_size_allocate()
+ */
+ if (!view->internal_size_request &&
+ (view->sizing_mode == EV_SIZING_FIT_WIDTH ||
+ view->sizing_mode == EV_SIZING_BEST_FIT)) {
+ ev_view_zoom_for_size (view,
+ widget->allocation.width,
+ widget->allocation.height);
+ }
+
if (view->continuous && view->dual_page)
- ev_view_size_request_continuous_dual_page (view, requisition);
+ ev_view_size_request_continuous_dual_page (view, &view->requisition);
else if (view->continuous)
- ev_view_size_request_continuous (view, requisition);
+ ev_view_size_request_continuous (view, &view->requisition);
else if (view->dual_page)
- ev_view_size_request_dual_page (view, requisition);
+ ev_view_size_request_dual_page (view, &view->requisition);
else
- ev_view_size_request_single_page (view, requisition);
+ ev_view_size_request_single_page (view, &view->requisition);
+
+ *requisition = view->requisition;
}
static void
@@ -2862,10 +2878,14 @@ ev_view_size_allocate (GtkWidget *widget,
if (view->sizing_mode == EV_SIZING_FIT_WIDTH ||
view->sizing_mode == EV_SIZING_BEST_FIT) {
+ GtkRequisition req;
+
ev_view_zoom_for_size (view,
allocation->width,
allocation->height);
- ev_view_size_request (widget, &widget->requisition);
+ view->internal_size_request = TRUE;
+ ev_view_size_request (widget, &req);
+ view->internal_size_request = FALSE;
}
view_set_adjustment_values (view, GTK_ORIENTATION_HORIZONTAL);