From ed66487a4bb197fd042a188044248f7dbd760f14 Mon Sep 17 00:00:00 2001 From: David Herrmann Date: Tue, 2 Oct 2012 13:46:47 +0200 Subject: [PATCH] wlt: add --grab-zoom-in/out command-line options These options allow to modify the hard-coded shortcuts for font zooming. Signed-off-by: David Herrmann --- src/wlt_main.c | 16 ++++++++++++++++ src/wlt_main.h | 4 ++++ src/wlt_terminal.c | 8 ++++---- 3 files changed, 24 insertions(+), 4 deletions(-) diff --git a/src/wlt_main.c b/src/wlt_main.c index a73e647..07c34a4 100644 --- a/src/wlt_main.c +++ b/src/wlt_main.c @@ -236,6 +236,10 @@ static void print_help() "\t Shortcut to scroll page down\n" "\t --grab-fullscreen [F11]\n" "\t Shortcut to toggle fullscreen mode\n" + "\t --grab-zoom-in [plus]\n" + "\t Shortcut to increase font size\n" + "\t --grab-zoom-out [minus]\n" + "\t Shortcut to decrease font size\n" "\n" "Font Options:\n" "\t --font-engine [pango]\n" @@ -329,6 +333,16 @@ static struct conf_grab def_grab_fullscreen = { .keysym = XKB_KEY_F11, }; +static struct conf_grab def_grab_zoom_in = { + .mods = SHL_CONTROL_MASK, + .keysym = XKB_KEY_plus, +}; + +static struct conf_grab def_grab_zoom_out = { + .mods = SHL_CONTROL_MASK, + .keysym = XKB_KEY_minus, +}; + struct conf_option options[] = { CONF_OPTION_BOOL('h', "help", aftercheck_help, &wlt_conf.help, false), CONF_OPTION_BOOL('v', "verbose", NULL, &wlt_conf.verbose, false), @@ -345,6 +359,8 @@ struct conf_option options[] = { CONF_OPTION_GRAB(0, "grab-page-up", NULL, &wlt_conf.grab_page_up, &def_grab_page_up), CONF_OPTION_GRAB(0, "grab-page-down", NULL, &wlt_conf.grab_page_down, &def_grab_page_down), CONF_OPTION_GRAB(0, "grab-fullscreen", NULL, &wlt_conf.grab_fullscreen, &def_grab_fullscreen), + CONF_OPTION_GRAB(0, "grab-zoom-in", NULL, &wlt_conf.grab_zoom_in, &def_grab_zoom_in), + CONF_OPTION_GRAB(0, "grab-zoom-out", NULL, &wlt_conf.grab_zoom_out, &def_grab_zoom_out), CONF_OPTION_STRING(0, "font-engine", NULL, &wlt_conf.font_engine, "pango"), CONF_OPTION_UINT(0, "font-size", NULL, &wlt_conf.font_size, 12), diff --git a/src/wlt_main.h b/src/wlt_main.h index e18fff5..0608079 100644 --- a/src/wlt_main.h +++ b/src/wlt_main.h @@ -67,6 +67,10 @@ struct wlt_conf_t { struct conf_grab *grab_page_down; /* fullscreen grab */ struct conf_grab *grab_fullscreen; + /* font-zoom-in grab */ + struct conf_grab *grab_zoom_in; + /* font-zoom-out grab */ + struct conf_grab *grab_zoom_out; /* font engine */ char *font_engine; diff --git a/src/wlt_terminal.c b/src/wlt_terminal.c index 5c8609d..45856fb 100644 --- a/src/wlt_terminal.c +++ b/src/wlt_terminal.c @@ -346,8 +346,8 @@ static bool widget_key(struct wlt_widget *widget, unsigned int mask, return true; } - if (SHL_HAS_BITS(mask, SHL_CONTROL_MASK) && - sym == XKB_KEY_plus) { + if (SHL_HAS_BITS(mask, wlt_conf.grab_zoom_in->mods) && + sym == wlt_conf.grab_zoom_in->keysym) { if (term->font_attr.points + 1 < term->font_attr.points) return true; @@ -364,8 +364,8 @@ static bool widget_key(struct wlt_widget *widget, unsigned int mask, } return true; } - if (SHL_HAS_BITS(mask, SHL_CONTROL_MASK) && - sym == XKB_KEY_minus) { + if (SHL_HAS_BITS(mask, wlt_conf.grab_zoom_out->mods) && + sym == wlt_conf.grab_zoom_out->keysym) { if (term->font_attr.points - 1 < 1) return true; -- 2.7.4