Commit 2f193869 authored by Sebastian Ramacher's avatar Sebastian Ramacher
Browse files

Merge remote-tracking branch 'knuesel/feature/physical-size' into develop

parents dfc31a3f f1ebe9e5
......@@ -8,7 +8,7 @@ Requirements
------------
meson (>= 0.43)
gtk3 (>= 3.10)
gtk3 (>= 3.22)
glib (>= 2.50)
girara (>= 0.2.8)
sqlite3 (optional, >= 3.5.9)
......
......@@ -41,7 +41,7 @@ girara = dependency('girara-gtk3', version: '>=0.2.8')
glib = dependency('glib-2.0', version: '>=2.50')
gthread = dependency('gthread-2.0', version: '>=2.50')
gmodule = dependency('gmodule-no-export-2.0', version: '>=2.50')
gtk3 = dependency('gtk+-3.0', version: '>=3.10')
gtk3 = dependency('gtk+-3.0', version: '>=3.22')
build_dependencies = [libm, girara, glib, gthread, gmodule, gtk3]
......
......@@ -13,6 +13,7 @@ page_calc_height_width(zathura_document_t* document, double height,
g_return_val_if_fail(document != NULL && page_height != NULL && page_width != NULL, 0.0);
double scale = zathura_document_get_scale(document);
if (rotate == true && zathura_document_get_rotation(document) % 180 != 0) {
*page_width = round(height * scale);
*page_height = round(width * scale);
......
......@@ -8,7 +8,7 @@
#include "document.h"
/**
* Calculate the page size according to the corrent scaling and rotation if
* Calculate the page size according to the current scaling and rotation if
* desired.
*
* @param document the document
......
......@@ -216,6 +216,57 @@ cb_refresh_view(GtkWidget* GIRARA_UNUSED(view), gpointer data)
statusbar_page_number_update(zathura);
}
void
cb_monitors_changed(GdkScreen* screen, gpointer data)
{
girara_debug("signal received");
zathura_t* zathura = data;
if (screen == NULL || zathura == NULL) {
return;
}
zathura_update_view_ppi(zathura);
}
void
cb_widget_screen_changed(GtkWidget* widget, GdkScreen* previous_screen, gpointer data)
{
girara_debug("called");
zathura_t* zathura = data;
if (widget == NULL || zathura == NULL) {
return;
}
/* disconnect previous screen handler if present */
if (previous_screen != NULL && zathura->signals.monitors_changed_handler > 0) {
g_signal_handler_disconnect(previous_screen, zathura->signals.monitors_changed_handler);
zathura->signals.monitors_changed_handler = 0;
}
if (gtk_widget_has_screen(widget)) {
GdkScreen* screen = gtk_widget_get_screen(widget);
/* connect to new screen */
zathura->signals.monitors_changed_handler = g_signal_connect(G_OBJECT(screen),
"monitors-changed", G_CALLBACK(cb_monitors_changed), zathura);
}
zathura_update_view_ppi(zathura);
}
void
cb_widget_configured(GtkWidget* UNUSED(widget), GdkEvent* UNUSED(event), gpointer data)
{
zathura_t* zathura = data;
if (zathura == NULL) {
return;
}
zathura_update_view_ppi(zathura);
}
void
cb_scale_factor(GObject* object, GParamSpec* UNUSED(pspec), gpointer data)
{
......@@ -235,6 +286,7 @@ cb_scale_factor(GObject* object, GParamSpec* UNUSED(pspec), gpointer data)
fabs(new_factor - current.y) >= DBL_EPSILON) {
zathura_document_set_device_factors(zathura->document, new_factor, new_factor);
girara_debug("New device scale factor: %d", new_factor);
zathura_update_view_ppi(zathura);
render_all(zathura);
}
}
......
......@@ -79,6 +79,46 @@ void cb_view_vadjustment_changed(GtkAdjustment *adjustment, gpointer data);
*/
void cb_refresh_view(GtkWidget* view, gpointer data);
/**
* This function gets called when the monitors associated with the GdkScreen
* change.
*
* It checks for a change of monitor PPI, storing the new value and triggering
* a refresh if appropriate.
*
* @param screen The GDK screen
* @param gpointer The zathura instance
*/
void cb_monitors_changed(GdkScreen* screen, gpointer data);
/**
* This function gets called when the screen associated with the view widget
* changes.
*
* It updates the connection on the monitors-changed signal and checks for a
* change of monitor PPI, storing the new value and triggering a refresh if
* appropriate.
*
* @param widget The view widget
* @param previous_screen The widget's previous screen
* @param gpointer The zathura instance
*/
void cb_widget_screen_changed(GtkWidget* widget, GdkScreen* previous_screen, gpointer data);
/**
* This function gets called when the main window's size, position or stacking
* changes.
*
* It checks for a change of monitor PPI (due to the window moving between
* different monitors), storing the new value and triggering a refresh if
* appropriate.
*
* @param widget The main window widget
* @param event The configure event
* @param gpointer The zathura instance
*/
void cb_widget_configured(GtkWidget* widget, GdkEvent* event, gpointer data);
/**
* This function gets called when the view widget scale factor changes (e.g.
* when moving from a regular to a HiDPI screen).
......
......@@ -24,7 +24,7 @@
#define KEY_PAGE "page"
#define KEY_OFFSET "offset"
#define KEY_SCALE "scale"
#define KEY_ZOOM "zoom"
#define KEY_ROTATE "rotate"
#define KEY_PAGES_PER_ROW "pages-per-row"
#define KEY_FIRST_PAGE_COLUMN "first-page-column"
......@@ -550,7 +550,7 @@ plain_set_fileinfo(zathura_database_t* db, const char* file, zathura_fileinfo_t*
g_key_file_set_integer(priv->history, name, KEY_PAGE, file_info->current_page);
g_key_file_set_integer(priv->history, name, KEY_OFFSET, file_info->page_offset);
g_key_file_set_double (priv->history, name, KEY_SCALE, file_info->scale);
g_key_file_set_double (priv->history, name, KEY_ZOOM, file_info->zoom);
g_key_file_set_integer(priv->history, name, KEY_ROTATE, file_info->rotation);
g_key_file_set_integer(priv->history, name, KEY_PAGES_PER_ROW, file_info->pages_per_row);
g_key_file_set_string(priv->history, name, KEY_FIRST_PAGE_COLUMN, file_info->first_page_column_list);
......@@ -586,7 +586,7 @@ plain_get_fileinfo(zathura_database_t* db, const char* file, zathura_fileinfo_t*
file_info->current_page = g_key_file_get_integer(priv->history, name, KEY_PAGE, NULL);
file_info->page_offset = g_key_file_get_integer(priv->history, name, KEY_OFFSET, NULL);
file_info->scale = g_key_file_get_double (priv->history, name, KEY_SCALE, NULL);
file_info->zoom = g_key_file_get_double (priv->history, name, KEY_ZOOM, NULL);
file_info->rotation = g_key_file_get_integer(priv->history, name, KEY_ROTATE, NULL);
/* the following flags got introduced at a later point */
......
......@@ -147,7 +147,7 @@ sqlite_db_init(ZathuraSQLDatabase* db, const char* path)
"file TEXT PRIMARY KEY,"
"page INTEGER,"
"offset INTEGER,"
"scale FLOAT,"
"zoom FLOAT,"
"rotation INTEGER,"
"pages_per_row INTEGER,"
"first_page_column TEXT,"
......@@ -184,6 +184,10 @@ sqlite_db_init(ZathuraSQLDatabase* db, const char* path)
static const char SQL_FILEINFO_ALTER3[] =
"ALTER TABLE fileinfo ADD COLUMN time TIMESTAMP;";
/* update fileinfo table (part 4) */
static const char SQL_FILEINFO_ALTER4[] =
"ALTER TABLE fileinfo ADD COLUMN zoom FLOAT;";
/* update bookmark table */
static const char SQL_BOOKMARK_ALTER[] =
"ALTER TABLE bookmarks ADD COLUMN hadj_ratio FLOAT;"
......@@ -234,6 +238,15 @@ sqlite_db_init(ZathuraSQLDatabase* db, const char* path)
}
}
ret1 = check_column(session, "fileinfo", "zoom", &res1);
if (ret1 == true && res1 == false) {
girara_debug("old database table layout detected; updating ...");
if (sqlite3_exec(session, SQL_FILEINFO_ALTER4, NULL, 0, NULL) != SQLITE_OK) {
girara_warning("failed to update database table layout");
}
}
ret1 = check_column(session, "bookmarks", "hadj_ratio", &res1);
ret2 = check_column(session, "bookmarks", "vadj_ratio", &res2);
......@@ -625,7 +638,7 @@ sqlite_set_fileinfo(zathura_database_t* db, const char* file,
zathura_sqldatabase_private_t* priv = ZATHURA_SQLDATABASE_GET_PRIVATE(db);
static const char SQL_FILEINFO_SET[] =
"REPLACE INTO fileinfo (file, page, offset, scale, rotation, pages_per_row, first_page_column, position_x, position_y, time) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, DATETIME('now'));";
"REPLACE INTO fileinfo (file, page, offset, zoom, rotation, pages_per_row, first_page_column, position_x, position_y, time) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, DATETIME('now'));";
sqlite3_stmt* stmt = prepare_statement(priv->session, SQL_FILEINFO_SET);
if (stmt == NULL) {
......@@ -635,7 +648,7 @@ sqlite_set_fileinfo(zathura_database_t* db, const char* file,
if (sqlite3_bind_text(stmt, 1, file, -1, NULL) != SQLITE_OK ||
sqlite3_bind_int(stmt, 2, file_info->current_page) != SQLITE_OK ||
sqlite3_bind_int(stmt, 3, file_info->page_offset) != SQLITE_OK ||
sqlite3_bind_double(stmt, 4, file_info->scale) != SQLITE_OK ||
sqlite3_bind_double(stmt, 4, file_info->zoom) != SQLITE_OK ||
sqlite3_bind_int(stmt, 5, file_info->rotation) != SQLITE_OK ||
sqlite3_bind_int(stmt, 6, file_info->pages_per_row) != SQLITE_OK ||
sqlite3_bind_text(stmt, 7, file_info->first_page_column_list, -1, NULL)
......@@ -664,7 +677,7 @@ sqlite_get_fileinfo(zathura_database_t* db, const char* file,
zathura_sqldatabase_private_t* priv = ZATHURA_SQLDATABASE_GET_PRIVATE(db);
static const char SQL_FILEINFO_GET[] =
"SELECT page, offset, scale, rotation, pages_per_row, first_page_column, position_x, position_y FROM fileinfo WHERE file = ?;";
"SELECT page, offset, zoom, rotation, pages_per_row, first_page_column, position_x, position_y FROM fileinfo WHERE file = ?;";
sqlite3_stmt* stmt = prepare_statement(priv->session, SQL_FILEINFO_GET);
if (stmt == NULL) {
......@@ -685,7 +698,7 @@ sqlite_get_fileinfo(zathura_database_t* db, const char* file,
file_info->current_page = sqlite3_column_int(stmt, 0);
file_info->page_offset = sqlite3_column_int(stmt, 1);
file_info->scale = sqlite3_column_double(stmt, 2);
file_info->zoom = sqlite3_column_double(stmt, 2);
file_info->rotation = sqlite3_column_int(stmt, 3);
file_info->pages_per_row = sqlite3_column_int(stmt, 4);
file_info->first_page_column_list = g_strdup((const char*) sqlite3_column_text(stmt, 5));
......
......@@ -12,7 +12,7 @@
typedef struct zathura_fileinfo_s {
unsigned int current_page;
unsigned int page_offset;
double scale;
double zoom;
unsigned int rotation;
unsigned int pages_per_row;
char* first_page_column_list;
......
......@@ -28,15 +28,16 @@ struct zathura_document_s {
const char* password; /**< Password of the document */
unsigned int current_page_number; /**< Current page number */
unsigned int number_of_pages; /**< Number of pages */
double scale; /**< Scale value */
double zoom; /**< Zoom value */
unsigned int rotate; /**< Rotation */
void* data; /**< Custom data */
zathura_adjust_mode_t adjust_mode; /**< Adjust mode (best-fit, width) */
int page_offset; /**< Page offset */
double cell_width; /**< width of a page cell in the document (not ransformed by scale and rotation) */
double cell_height; /**< height of a page cell in the document (not ransformed by scale and rotation) */
double cell_width; /**< width of a page cell in the document (not transformed by scale and rotation) */
double cell_height; /**< height of a page cell in the document (not transformed by scale and rotation) */
unsigned int view_width; /**< width of current viewport */
unsigned int view_height; /**< height of current viewport */
double view_ppi; /**< PPI of the current viewport */
zathura_device_factors_t device_factors; /**< x and y device scale factors (for e.g. HiDPI) */
unsigned int pages_per_row; /**< number of pages in a row */
unsigned int first_page_column; /**< column of the first page */
......@@ -127,13 +128,14 @@ zathura_document_open(zathura_t* zathura, const char* path, const char* uri,
g_object_unref(gf);
}
document->password = password;
document->scale = 1.0;
document->zoom = 1.0;
document->plugin = plugin;
document->adjust_mode = ZATHURA_ADJUST_NONE;
document->cell_width = 0.0;
document->cell_height = 0.0;
document->view_height = 0;
document->view_width = 0;
document->view_ppi = 0.0;
document->device_factors.x = 1.0;
document->device_factors.y = 1.0;
document->position_x = 0.0;
......@@ -389,23 +391,40 @@ zathura_document_set_position_y(zathura_document_t* document, double position_y)
}
double
zathura_document_get_scale(zathura_document_t* document)
zathura_document_get_zoom(zathura_document_t* document)
{
if (document == NULL) {
return 0;
}
return document->scale;
return document->zoom;
}
void
zathura_document_set_scale(zathura_document_t* document, double scale)
zathura_document_set_zoom(zathura_document_t* document, double zoom)
{
if (document == NULL) {
return;
}
document->scale = scale;
document->zoom = zoom;
}
double
zathura_document_get_scale(zathura_document_t* document)
{
if (document == NULL) {
return 0;
}
double ppi = document->view_ppi;
if (ppi < DBL_EPSILON) {
/* No PPI information -> use a typical value */
ppi = 100;
}
/* scale = pixels per point, and there are 72 points in one inch */
return document->zoom * ppi / 72.0;
}
unsigned int
......@@ -495,6 +514,15 @@ zathura_document_set_viewport_height(zathura_document_t* document, unsigned int
document->view_height = height;
}
void
zathura_document_set_viewport_ppi(zathura_document_t* document, double ppi)
{
if (document == NULL) {
return;
}
document->view_ppi = ppi;
}
void
zathura_document_get_viewport_size(zathura_document_t* document,
unsigned int *height, unsigned int* width)
......@@ -504,6 +532,15 @@ zathura_document_get_viewport_size(zathura_document_t* document,
*width = document->view_width;
}
double
zathura_document_get_viewport_ppi(zathura_document_t* document)
{
if (document == NULL) {
return 0.0;
}
return document->view_ppi;
}
void
zathura_document_set_device_factors(zathura_document_t* document,
double x_factor, double y_factor)
......
......@@ -142,20 +142,29 @@ void zathura_document_set_position_x(zathura_document_t* document, double positi
void zathura_document_set_position_y(zathura_document_t* document, double position_y);
/**
* Returns the current scale value of the document
* Returns the current zoom value of the document
*
* @param document The document
* @return The current scale value
* @return The current zoom value
*/
double zathura_document_get_zoom(zathura_document_t* document);
/**
* Returns the current scale value of the document (based on zoom and screen
* PPI)
*
* @param document The document
* @return The current scale value, in pixels per point
*/
double zathura_document_get_scale(zathura_document_t* document);
/**
* Sets the new scale value of the document
* Sets the new zoom value of the document
*
* @param document The document
* @param scale The new scale value
* @param zoom The new zoom value
*/
void zathura_document_set_scale(zathura_document_t* document, double scale);
void zathura_document_set_zoom(zathura_document_t* document, double zoom);
/**
* Returns the rotation value of zathura (0..360)
......@@ -249,6 +258,26 @@ void
zathura_document_get_viewport_size(zathura_document_t* document,
unsigned int *height, unsigned int* width);
/**
Sets the viewport PPI (pixels per inch: the resolution of the monitor, after
scaling with the device factor).
*
* @param[in] document The document instance
* @param[in] height The viewport PPI
*/
void
zathura_document_set_viewport_ppi(zathura_document_t* document, double ppi);
/**
* Return the viewport PPI (pixels per inch: the resolution of the monitor,
* after scaling with the device factor).
*
* @param[in] document The document instance
* @return The viewport PPI
*/
double
zathura_document_get_viewport_ppi(zathura_document_t* document);
/**
* Set the device scale factors (e.g. for HiDPI). These are generally integers
* and equal for x and y. These scaling factors are only used when rendering to
......
......@@ -114,7 +114,7 @@ zathura_link_target_t
zathura_link_get_target(zathura_link_t* link)
{
if (link == NULL) {
zathura_link_target_t target = { 0, NULL, 0, 0, 0, 0, 0, 0 };
zathura_link_target_t target = { 0, NULL, 0, 0, 0, 0, 0, { 0 } };
return target;
}
......@@ -134,9 +134,9 @@ zathura_link_evaluate(zathura_t* zathura, zathura_link_t* link)
switch (link->type) {
case ZATHURA_LINK_GOTO_DEST:
if (link->target.destination_type != ZATHURA_LINK_DESTINATION_UNKNOWN) {
if (link->target.scale >= DBL_EPSILON && link_zoom) {
zathura_document_set_scale(zathura->document,
zathura_correct_scale_value(zathura->ui.session, link->target.scale));
if (link->target.zoom >= DBL_EPSILON && link_zoom) {
zathura_document_set_zoom(zathura->document,
zathura_correct_zoom_value(zathura->ui.session, link->target.zoom));
render_all(zathura);
}
......
......@@ -24,7 +24,7 @@ struct zathura_mark_s {
double position_x; /**> Horizontal adjustment */
double position_y; /**> Vertical adjustment */
unsigned int page; /**> Page number */
double scale; /**> Zoom level */
double zoom; /**> Zoom level */
};
bool
......@@ -202,7 +202,7 @@ mark_add(zathura_t* zathura, int key)
double position_x = zathura_document_get_position_x(zathura->document);
double position_y = zathura_document_get_position_y(zathura->document);
double scale = zathura_document_get_scale(zathura->document);
double zoom = zathura_document_get_zoom(zathura->document);
/* search for existing mark */
GIRARA_LIST_FOREACH_BODY_WITH_ITER(zathura->global.marks, zathura_mark_t*, iter, mark,
......@@ -210,7 +210,7 @@ mark_add(zathura_t* zathura, int key)
mark->page = page_id;
mark->position_x = position_x;
mark->position_y = position_y;
mark->scale = scale;
mark->zoom = zoom;
girara_list_iterator_free(iter);
return;
}
......@@ -226,7 +226,7 @@ mark_add(zathura_t* zathura, int key)
mark->page = page_id;
mark->position_x = position_x;
mark->position_y = position_y;
mark->scale = scale;
mark->zoom = zoom;
girara_list_append(zathura->global.marks, mark);
}
......@@ -241,8 +241,8 @@ mark_evaluate(zathura_t* zathura, int key)
/* search for existing mark */
GIRARA_LIST_FOREACH_BODY(zathura->global.marks, zathura_mark_t*, mark,
if (mark != NULL && mark->key == key) {
zathura_document_set_scale(zathura->document,
zathura_correct_scale_value(zathura->ui.session, mark->scale));
zathura_document_set_zoom(zathura->document,
zathura_correct_zoom_value(zathura->ui.session, mark->zoom));
render_all(zathura);
zathura_jumplist_add(zathura);
......
......@@ -317,8 +317,8 @@ set_font_from_property(cairo_t* cairo, zathura_t* zathura, cairo_font_weight_t w
const char* family = pango_font_description_get_family(descr);
/* get font size: can be points or absolute.
* absolute units: value = 10*PANGO_SCALE = 10 (unscaled) device units (logical pixels)
* point units: value = 10*PANGO_SCALE = 10 points = 10*(font dpi config / 72) device units */
* absolute units: example: value 10*PANGO_SCALE = 10 (unscaled) device units (logical pixels)
* point units: example: value 10*PANGO_SCALE = 10 points = 10*(font dpi config / 72) device units */
double size = pango_font_description_get_size(descr) / PANGO_SCALE;
/* convert point size to device units */
......@@ -496,7 +496,6 @@ zathura_page_widget_get_property(GObject* object, guint prop_id, GValue* value,
}
}
#if CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1,14,0)
static zathura_device_factors_t
get_safe_device_factors(cairo_surface_t* surface)
{
......@@ -512,13 +511,6 @@ get_safe_device_factors(cairo_surface_t* surface)
return factors;
}
#else
static zathura_device_factors_t
get_safe_device_factors(cairo_surface_t* UNUSED(surface))
{
return (zathura_device_factors_t){1.0, 1.0};
}
#endif
static gboolean
zathura_page_widget_draw(GtkWidget* widget, cairo_t* cairo)
......@@ -690,9 +682,9 @@ zathura_page_widget_redraw_canvas(ZathuraPage* pageview)
}
/* smaller than max to be replaced by actual renders */
#define THUMBNAIL_INITIAL_SCALE 0.5
#define THUMBNAIL_INITIAL_ZOOM 0.5
/* small enough to make bilinear downscaling fast */
#define THUMBNAIL_MAX_SCALE 0.5
#define THUMBNAIL_MAX_ZOOM 0.5
static bool
surface_small_enough(cairo_surface_t* surface, size_t max_size, cairo_surface_t* old)
......@@ -712,7 +704,7 @@ surface_small_enough(cairo_surface_t* surface, size_t max_size, cairo_surface_t*
const unsigned int width_old = cairo_image_surface_get_width(old);
const unsigned int height_old = cairo_image_surface_get_height(old);
const size_t old_size = width_old * height_old;
if (new_size < old_size && new_size >= old_size * THUMBNAIL_MAX_SCALE * THUMBNAIL_MAX_SCALE) {
if (new_size < old_size && new_size >= old_size * THUMBNAIL_MAX_ZOOM * THUMBNAIL_MAX_ZOOM) {
return false;
}
}
......@@ -725,9 +717,9 @@ draw_thumbnail_image(cairo_surface_t* surface, size_t max_size)
{
unsigned int width = cairo_image_surface_get_width(surface);
unsigned int height = cairo_image_surface_get_height(surface);
double scale = sqrt((double)max_size / (width * height)) * THUMBNAIL_INITIAL_SCALE;
if (scale > THUMBNAIL_MAX_SCALE) {
scale = THUMBNAIL_MAX_SCALE;
double scale = sqrt((double)max_size / (width * height)) * THUMBNAIL_INITIAL_ZOOM;
if (scale > THUMBNAIL_MAX_ZOOM) {
scale = THUMBNAIL_MAX_ZOOM;
}
width = width * scale;
height = height * scale;
......
......@@ -740,25 +740,25 @@ render(render_job_t* job, ZathuraRenderRequest* request, ZathuraRenderer* render
const double height = zathura_page_get_height(page);
const double width = zathura_page_get_width(page);
/* page size in user pixels base on document zoom: 100% results in 1 pixel per point */
/* page size in user pixels based on document zoom: if PPI information is
* correct, 100% zoom will result in 72 documents points per inch of screen
* (i.e. document size on screen matching the physical paper size). */
const double real_scale = page_calc_height_width(document, height, width,
&page_height, &page_width,
false);
#if CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1,14,0)
zathura_device_factors_t device_factors = zathura_document_get_device_factors(document);
page_width *= device_factors.x;
page_height *= device_factors.y;
#endif
cairo_surface_t* surface = cairo_image_surface_create(CAIRO_FORMAT_RGB24,
page_width, page_height);
if (surface == NULL) {
return false;
}
#if CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1,14,0)
cairo_surface_set_device_scale(surface, device_factors.x, device_factors.y);
#endif
if (cairo_surface_status(surface) != CAIRO_STATUS_SUCCESS) {
cairo_surface_destroy(surface);
return false;
......@@ -868,8 +868,10 @@ render_all(zathura_t* zathura)
girara_debug("Queuing resize for page %u to %u x %u (%f x %f).", page_id, page_width, page_height, width, height);
GtkWidget* widget = zathura_page_get_widget(zathura, page);
gtk_widget_set_size_request(widget, page_width, page_height);
gtk_widget_queue_resize(widget);
if (widget != NULL) {
gtk_widget_set_size_request(widget, page_width, page_height);
gtk_widget_queue_resize(widget);
}
}
}
......
......@@ -1304,8 +1304,8 @@ sc_toggle_presentation(girara_session_t* session, girara_argument_t*
/* set full screen */
gtk_window_unfullscreen(GTK_WINDOW(session->gtk.window));
/* reset scale */
zathura_document_set_scale(zathura->document, zathura->shortcut.toggle_presentation_mode.zoom);
/* reset zoom */
zathura_document_set_zoom(zathura->document, zathura->shortcut.toggle_presentation_mode.zoom);
render_all(zathura);
refresh_view(zathura);