mirror of
https://git.pwmt.org/pwmt/zathura.git
synced 2024-11-10 23:24:24 +01:00
Limit decimal part
This commit is contained in:
parent
63ef90697e
commit
6976707376
@ -549,7 +549,7 @@ zathura_document_set_device_factors(zathura_document_t* document,
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (fabs(x_factor) < DBL_EPSILON || fabs(y_factor) < DBL_EPSILON) {
|
if (fabs(x_factor) < DBL_EPSILON || fabs(y_factor) < DBL_EPSILON) {
|
||||||
girara_debug("Ignoring new device factors %f and %f: too small",
|
girara_debug("Ignoring new device factors %0.2f and %0.2f: too small",
|
||||||
x_factor, y_factor);
|
x_factor, y_factor);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -847,7 +847,7 @@ render_all(zathura_t* zathura)
|
|||||||
const double width = zathura_page_get_width(page);
|
const double width = zathura_page_get_width(page);
|
||||||
page_calc_height_width(zathura->document, height, width, &page_height, &page_width, true);
|
page_calc_height_width(zathura->document, height, width, &page_height, &page_width, true);
|
||||||
|
|
||||||
girara_debug("Queuing resize for page %u to %u x %u (%f x %f).", page_id, page_width, page_height, width, height);
|
girara_debug("Queuing resize for page %u to %u x %u (%0.2f x %0.2f).", page_id, page_width, page_height, width, height);
|
||||||
GtkWidget* widget = zathura_page_get_widget(zathura, page);
|
GtkWidget* widget = zathura_page_get_widget(zathura, page);
|
||||||
if (widget != NULL) {
|
if (widget != NULL) {
|
||||||
gtk_widget_set_size_request(widget, page_width, page_height);
|
gtk_widget_set_size_request(widget, page_width, page_height);
|
||||||
|
@ -1383,22 +1383,22 @@ sc_zoom(girara_session_t* session, girara_argument_t* argument, girara_event_t*
|
|||||||
|
|
||||||
/* specify new zoom value */
|
/* specify new zoom value */
|
||||||
if (argument->n == ZOOM_IN) {
|
if (argument->n == ZOOM_IN) {
|
||||||
girara_debug("Increasing zoom by %f.", zoom_step - 1.0);
|
girara_debug("Increasing zoom by %0.2f.", zoom_step - 1.0);
|
||||||
zathura_document_set_zoom(zathura->document, old_zoom * zoom_step);
|
zathura_document_set_zoom(zathura->document, old_zoom * zoom_step);
|
||||||
} else if (argument->n == ZOOM_OUT) {
|
} else if (argument->n == ZOOM_OUT) {
|
||||||
girara_debug("Decreasing zoom by %f.", zoom_step - 1.0);
|
girara_debug("Decreasing zoom by %0.2f.", zoom_step - 1.0);
|
||||||
zathura_document_set_zoom(zathura->document, old_zoom / zoom_step);
|
zathura_document_set_zoom(zathura->document, old_zoom / zoom_step);
|
||||||
} else if (argument->n == ZOOM_SPECIFIC) {
|
} else if (argument->n == ZOOM_SPECIFIC) {
|
||||||
if (t == 0) {
|
if (t == 0) {
|
||||||
girara_debug("Setting zoom to 1.");
|
girara_debug("Setting zoom to 1.");
|
||||||
zathura_document_set_zoom(zathura->document, 1.0);
|
zathura_document_set_zoom(zathura->document, 1.0);
|
||||||
} else {
|
} else {
|
||||||
girara_debug("Setting zoom to %f.", t / 100.0);
|
girara_debug("Setting zoom to %0.2f.", t / 100.0);
|
||||||
zathura_document_set_zoom(zathura->document, t / 100.0);
|
zathura_document_set_zoom(zathura->document, t / 100.0);
|
||||||
}
|
}
|
||||||
} else if (argument->n == ZOOM_SMOOTH) {
|
} else if (argument->n == ZOOM_SMOOTH) {
|
||||||
const double dy = (event != NULL) ? event->y : 1.0;
|
const double dy = (event != NULL) ? event->y : 1.0;
|
||||||
girara_debug("Increasing zoom by %f.", zoom_step * dy - 1.0);
|
girara_debug("Increasing zoom by %0.2f.", zoom_step * dy - 1.0);
|
||||||
zathura_document_set_zoom(zathura->document, old_zoom + zoom_step * dy);
|
zathura_document_set_zoom(zathura->document, old_zoom + zoom_step * dy);
|
||||||
} else {
|
} else {
|
||||||
girara_debug("Setting zoom to 1.");
|
girara_debug("Setting zoom to 1.");
|
||||||
@ -1411,11 +1411,11 @@ sc_zoom(girara_session_t* session, girara_argument_t* argument, girara_event_t*
|
|||||||
|
|
||||||
const double new_zoom = zathura_document_get_zoom(zathura->document);
|
const double new_zoom = zathura_document_get_zoom(zathura->document);
|
||||||
if (fabs(new_zoom - old_zoom) <= DBL_EPSILON) {
|
if (fabs(new_zoom - old_zoom) <= DBL_EPSILON) {
|
||||||
girara_debug("New and old zoom level are too close: %f vs. %f, diff = %f", new_zoom, old_zoom, fabs(new_zoom - old_zoom));
|
girara_debug("New and old zoom level are too close: %0.2f vs. %0.2f", new_zoom, old_zoom);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
girara_debug("Re-rendering with new zoom level %f.", new_zoom);
|
girara_debug("Re-rendering with new zoom level %0.2f.", new_zoom);
|
||||||
render_all(zathura);
|
render_all(zathura);
|
||||||
refresh_view(zathura);
|
refresh_view(zathura);
|
||||||
|
|
||||||
|
@ -314,7 +314,7 @@ synctex_highlight_rects(zathura_t* zathura, unsigned int page,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* move to position */
|
/* move to position */
|
||||||
girara_debug("Jumping to page %u position (%f, %f).", page, pos_x, pos_y);
|
girara_debug("Jumping to page %u position (%0.2f, %0.2f).", page, pos_x, pos_y);
|
||||||
zathura_jumplist_add(zathura);
|
zathura_jumplist_add(zathura);
|
||||||
position_set(zathura, pos_x, pos_y);
|
position_set(zathura, pos_x, pos_y);
|
||||||
zathura_jumplist_add(zathura);
|
zathura_jumplist_add(zathura);
|
||||||
|
@ -194,7 +194,7 @@ zathura_update_view_ppi(zathura_t* zathura)
|
|||||||
|
|
||||||
double current_ppi = zathura_document_get_viewport_ppi(zathura->document);
|
double current_ppi = zathura_document_get_viewport_ppi(zathura->document);
|
||||||
if (fabs(ppi - current_ppi) > DBL_EPSILON) {
|
if (fabs(ppi - current_ppi) > DBL_EPSILON) {
|
||||||
girara_debug("monitor width: %d mm, pixels: %d, ppi: %f", width_mm, monitor_geom.width, ppi);
|
girara_debug("monitor width: %d mm, pixels: %d, ppi: %0.2f", width_mm, monitor_geom.width, ppi);
|
||||||
zathura_document_set_viewport_ppi(zathura->document, ppi);
|
zathura_document_set_viewport_ppi(zathura->document, ppi);
|
||||||
render_all(zathura);
|
render_all(zathura);
|
||||||
refresh_view(zathura);
|
refresh_view(zathura);
|
||||||
|
Loading…
Reference in New Issue
Block a user