From: Nickolay V. Shmyrev Date: Sat, 4 Jun 2005 22:53:48 +0000 (+0000) Subject: A bit different fix for rounding problem but it has no X-Git-Tag: EVINCE_0_3_3~282 X-Git-Url: https://www.fi.muni.cz/~kas/git//home/kas/public_html/git/?a=commitdiff_plain;h=8d43cc37d782fdaa65c8f68b94502ef62382fc6c;p=evince.git A bit different fix for rounding problem but it has no problems on startup. Make properties window transient to parent. --- diff --git a/ChangeLog b/ChangeLog index 4a82452b..361687ee 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2005-06-05 Nickolay V. Shmyrev + + * shell/ev-view.c: (view_set_adjustment_values): + * shell/ev-window.c: (ev_window_cmd_file_properties): + + A bit different fix for rounding problem but it has no + problems on startup. Make properties window transient to parent. + 2005-06-04 Nickolay V. Shmyrev * pdf/ev-poppler.cc: diff --git a/shell/ev-view.c b/shell/ev-view.c index 20c0eefd..4ea0fce2 100644 --- a/shell/ev-view.c +++ b/shell/ev-view.c @@ -422,16 +422,14 @@ view_set_adjustment_values (EvView *view, return; factor = 1.0; - /* We add 0.5 to the values before to average out our rounding errors. - */ switch (view->pending_scroll) { case SCROLL_TO_KEEP_POSITION: - factor = (adjustment->value + 0.5) / adjustment->upper; + factor = (adjustment->value) / adjustment->upper; break; case SCROLL_TO_CURRENT_PAGE: break; case SCROLL_TO_CENTER: - factor = (adjustment->value + adjustment->page_size * 0.5 + 0.5) / adjustment->upper; + factor = (adjustment->value + adjustment->page_size * 0.5) / adjustment->upper; break; } @@ -441,16 +439,19 @@ view_set_adjustment_values (EvView *view, adjustment->lower = 0; adjustment->upper = MAX (allocation, requisition); + /* + * We add 0.5 to the values before to average out our rounding errors. + */ switch (view->pending_scroll) { case SCROLL_TO_KEEP_POSITION: - new_value = CLAMP (adjustment->upper * factor, 0, adjustment->upper - adjustment->page_size); + new_value = CLAMP (adjustment->upper * factor + 0.5, 0, adjustment->upper - adjustment->page_size); gtk_adjustment_set_value (adjustment, (int)new_value); break; case SCROLL_TO_CURRENT_PAGE: scroll_to_current_page (view, orientation); break; case SCROLL_TO_CENTER: - new_value = CLAMP (adjustment->upper * factor - adjustment->page_size * 0.5, + new_value = CLAMP (adjustment->upper * factor - adjustment->page_size * 0.5 + 0.5, 0, adjustment->upper - adjustment->page_size); gtk_adjustment_set_value (adjustment, (int)new_value); break; diff --git a/shell/ev-window.c b/shell/ev-window.c index 2404001e..aeceba8c 100644 --- a/shell/ev-window.c +++ b/shell/ev-window.c @@ -1202,6 +1202,7 @@ ev_window_cmd_file_properties (GtkAction *action, EvWindow *ev_window) info = ev_document_get_info (document); dialog = ev_properties_new (info, fonts); + gtk_window_set_transient_for (GTK_WINDOW (dialog), GTK_WINDOW(window)); gtk_dialog_run (dialog); gtk_widget_destroy (GTK_WIDGET (dialog)); ev_document_info_free (info);