From 17b497268300c2c66b9c9830acca1820411b3dfa Mon Sep 17 00:00:00 2001 From: Moritz Lipp Date: Sat, 7 May 2011 22:00:52 +0200 Subject: [PATCH] Update modes --- config.c | 14 ++++++++++++-- shortcuts.c | 2 +- zathura.h | 15 ++++++++------- 3 files changed, 21 insertions(+), 10 deletions(-) diff --git a/config.c b/config.c index 70db7c3..1b3d650 100644 --- a/config.c +++ b/config.c @@ -17,8 +17,18 @@ config_load_default(zathura_t* zathura) char* string_value = NULL; girara_session_t* gsession = zathura->ui.session; - /* general settings */ - girara_mode_set(gsession, NORMAL); + /* mode settings */ + zathura->modes.normal = gsession->modes.normal; + zathura->modes.fullscreen = girara_mode_add(gsession, "fullscreen"); + zathura->modes.index = girara_mode_add(gsession, "index"); + zathura->modes.insert = girara_mode_add(gsession, "insert"); + +#define NORMAL zathura->modes.normal +#define INSERT zathura->modes.insert +#define INDEX zathura->modes.index +#define FULLSCREEN zathura->modes.fullscreen + + girara_mode_set(gsession, zathura->modes.normal); /* zathura settings */ int_value = 10; diff --git a/shortcuts.c b/shortcuts.c index d02c5ae..51d2f45 100644 --- a/shortcuts.c +++ b/shortcuts.c @@ -15,7 +15,7 @@ sc_abort(girara_session_t* session, girara_argument_t* argument, unsigned int t) { g_return_val_if_fail(session != NULL, false); - girara_mode_set(session, NORMAL); + girara_mode_set(session, session->modes.normal); return false; } diff --git a/zathura.h b/zathura.h index 0ded288..af14996 100644 --- a/zathura.h +++ b/zathura.h @@ -14,13 +14,6 @@ enum { NEXT, PREVIOUS, LEFT, RIGHT, UP, DOWN, BOTTOM, TOP, HIDE, HIGHLIGHT, GOTO_OFFSET, HALF_UP, HALF_DOWN, FULL_UP, FULL_DOWN, NEXT_CHAR, PREVIOUS_CHAR, DELETE_TO_LINE_START, APPEND_FILEPATH }; -/* define modes */ -#define ALL (1 << 0) -#define FULLSCREEN (1 << 1) -#define INDEX (1 << 2) -#define NORMAL (1 << 3) -#define INSERT (1 << 4) - /* forward declaration for types from document.h */ struct zathura_document_s; struct zathura_page_s; @@ -83,6 +76,14 @@ typedef struct zathura_s bool recolor; /**> Recoloring mode switch */ } global; + struct + { + girara_mode_t normal; /**> Normal mode */ + girara_mode_t fullscreen; /**> Fullscreen mode */ + girara_mode_t index; /**> Index mode */ + girara_mode_t insert; /**> Insert mode */ + } modes; + zathura_document_t* document; /**> The current document */ } zathura_t;