mirror of
https://git.pwmt.org/pwmt/zathura.git
synced 2025-01-01 01:05:59 +01:00
Reset zoom level after quiting fullscreen.
This commit is contained in:
parent
269b784c3a
commit
5fc885a66c
1 changed files with 10 additions and 1 deletions
11
shortcuts.c
11
shortcuts.c
|
@ -544,10 +544,12 @@ sc_toggle_fullscreen(girara_session_t* session, girara_argument_t*
|
||||||
UNUSED(argument), girara_event_t* UNUSED(event), unsigned int UNUSED(t))
|
UNUSED(argument), girara_event_t* UNUSED(event), unsigned int UNUSED(t))
|
||||||
{
|
{
|
||||||
g_return_val_if_fail(session != NULL, false);
|
g_return_val_if_fail(session != NULL, false);
|
||||||
|
g_return_val_if_fail(session->global.data != NULL, false);
|
||||||
|
zathura_t* zathura = session->global.data;
|
||||||
|
|
||||||
static bool fullscreen = false;
|
static bool fullscreen = false;
|
||||||
static int pages_per_row = 1;
|
static int pages_per_row = 1;
|
||||||
|
static double zoom = 1.0;
|
||||||
|
|
||||||
if (fullscreen == true) {
|
if (fullscreen == true) {
|
||||||
/* reset pages per row */
|
/* reset pages per row */
|
||||||
|
@ -558,6 +560,10 @@ sc_toggle_fullscreen(girara_session_t* session, girara_argument_t*
|
||||||
|
|
||||||
/* set full screen */
|
/* set full screen */
|
||||||
gtk_window_unfullscreen(GTK_WINDOW(session->gtk.window));
|
gtk_window_unfullscreen(GTK_WINDOW(session->gtk.window));
|
||||||
|
|
||||||
|
/* reset scale */
|
||||||
|
zathura->document->scale = zoom;
|
||||||
|
render_all(zathura);
|
||||||
} else {
|
} else {
|
||||||
/* backup pages per row */
|
/* backup pages per row */
|
||||||
int* tmp = girara_setting_get(session, "pages-per-row");
|
int* tmp = girara_setting_get(session, "pages-per-row");
|
||||||
|
@ -570,6 +576,9 @@ sc_toggle_fullscreen(girara_session_t* session, girara_argument_t*
|
||||||
int int_value = 1;
|
int int_value = 1;
|
||||||
girara_setting_set(session, "pages-per-row", &int_value);
|
girara_setting_set(session, "pages-per-row", &int_value);
|
||||||
|
|
||||||
|
/* back up zoom */
|
||||||
|
zoom = zathura->document->scale;
|
||||||
|
|
||||||
/* adjust window */
|
/* adjust window */
|
||||||
girara_argument_t argument = { ADJUST_BESTFIT, NULL };
|
girara_argument_t argument = { ADJUST_BESTFIT, NULL };
|
||||||
sc_adjust_window(session, &argument, NULL, 0);
|
sc_adjust_window(session, &argument, NULL, 0);
|
||||||
|
|
Loading…
Reference in a new issue