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 <dh.herrmann@googlemail.com>
This commit is contained in:
parent
1072b8cb76
commit
ed66487a4b
@ -236,6 +236,10 @@ static void print_help()
|
||||
"\t Shortcut to scroll page down\n"
|
||||
"\t --grab-fullscreen <grab> [F11]\n"
|
||||
"\t Shortcut to toggle fullscreen mode\n"
|
||||
"\t --grab-zoom-in <grab> [<Ctrl>plus]\n"
|
||||
"\t Shortcut to increase font size\n"
|
||||
"\t --grab-zoom-out <grab> [<Ctrl>minus]\n"
|
||||
"\t Shortcut to decrease font size\n"
|
||||
"\n"
|
||||
"Font Options:\n"
|
||||
"\t --font-engine <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),
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user