From 70f8e20e19a5a291d2290229f7c8bbd8083a7020 Mon Sep 17 00:00:00 2001 From: Sebastian Ramacher Date: Fri, 14 Feb 2014 12:11:12 +0100 Subject: [PATCH] Use the actual mode in mode toggle calls --- shortcuts.c | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/shortcuts.c b/shortcuts.c index c453fbb..0705afb 100644 --- a/shortcuts.c +++ b/shortcuts.c @@ -1234,19 +1234,17 @@ sc_toggle_fullscreen(girara_session_t* session, girara_argument_t* return false; } - static bool fullscreen = false; - if (fullscreen == true) { + const girara_mode_t old_mode = girara_mode_get(session); + if (old_mode == zathura->modes.fullscreen) { gtk_window_unfullscreen(GTK_WINDOW(session->gtk.window)); refresh_view(zathura); girara_mode_set(session, zathura->modes.normal); - } else { + } else if (old_mode == zathura->modes.normal) { gtk_window_fullscreen(GTK_WINDOW(session->gtk.window)); refresh_view(zathura); girara_mode_set(session, zathura->modes.fullscreen); } - fullscreen = !fullscreen; - return false; } @@ -1263,12 +1261,12 @@ sc_toggle_presentation(girara_session_t* session, girara_argument_t* return false; } - static bool fullscreen = false; static int pages_per_row = 1; static int first_page_column = 1; static double zoom = 1.0; - if (fullscreen == true) { + const girara_mode_t old_mode = girara_mode_get(session); + if (old_mode == zathura->modes.presentation) { /* reset pages per row */ girara_setting_set(session, "pages-per-row", &pages_per_row); @@ -1288,7 +1286,7 @@ sc_toggle_presentation(girara_session_t* session, girara_argument_t* /* setm ode */ girara_mode_set(session, zathura->modes.normal); - } else { + } else if (old_mode == zathura->modes.normal) { /* backup pages per row */ girara_setting_get(session, "pages-per-row", &pages_per_row); @@ -1318,8 +1316,6 @@ sc_toggle_presentation(girara_session_t* session, girara_argument_t* girara_mode_set(session, zathura->modes.presentation); } - fullscreen = !fullscreen; - return false; }