From e8da0b7677c663fc90f43ea52c591ba1de2122a0 Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Sun, 28 Aug 2016 10:54:36 +0200 Subject: merge next(_img), prev(_img) and (toggle_)menu --- man/feh.pre | 6 +++--- src/events.c | 38 ++++++++++++++++---------------------- src/options.h | 3 --- 3 files changed, 19 insertions(+), 28 deletions(-) diff --git a/man/feh.pre b/man/feh.pre index 01bbd9c..a558af6 100644 --- a/man/feh.pre +++ b/man/feh.pre @@ -1506,15 +1506,15 @@ pan the current image . Zoom the current image . -.It 3 Ao right mouse button Ac Bq menu +.It 3 Ao right mouse button Ac Bq toggle_menu . Toggle menu . -.It 4 Ao mousewheel down Ac Bq prev +.It 4 Ao mousewheel down Ac Bq prev_img . Show previous image . -.It 5 Ao mousewheel up Ac Bq next +.It 5 Ao mousewheel up Ac Bq next_img . Show next image . diff --git a/src/events.c b/src/events.c index 6e4f256..61cc644 100644 --- a/src/events.c +++ b/src/events.c @@ -101,13 +101,13 @@ void init_buttonbindings(void) FILE *conf = NULL; int read = 0; - feh_set_bb(&keys.pan, 0, 1); - feh_set_bb(&keys.zoom, 0, 2); - feh_set_bb(&keys.menu, 0, 3); - feh_set_bb(&keys.prev, 0, 4); - feh_set_bb(&keys.next, 0, 5); - feh_set_bb(&keys.blur, 4, 1); - feh_set_bb(&keys.rotate, 4, 2); + feh_set_bb(&keys.pan, 0, 1); + feh_set_bb(&keys.zoom, 0, 2); + feh_set_bb(&keys.toggle_menu, 0, 3); + feh_set_bb(&keys.prev_img, 0, 4); + feh_set_bb(&keys.next_img, 0, 5); + feh_set_bb(&keys.blur, 4, 1); + feh_set_bb(&keys.rotate, 4, 2); home = getenv("HOME"); confhome = getenv("XDG_CONFIG_HOME"); @@ -147,12 +147,12 @@ void init_buttonbindings(void) cur_bb = &keys.pan; else if (!strcmp(action, "zoom")) cur_bb = &keys.zoom; - else if (!strcmp(action, "menu")) - cur_bb = &keys.menu; - else if (!strcmp(action, "prev")) - cur_bb = &keys.prev; - else if (!strcmp(action, "next")) - cur_bb = &keys.next; + else if (!strcmp(action, "menu") || !strcmp(action, "toggle_menu")) + cur_bb = &keys.toggle_menu; + else if (!strcmp(action, "prev") || !strcmp(action, "prev_img")) + cur_bb = &keys.prev_img; + else if (!strcmp(action, "next") || !strcmp(action, "next_img")) + cur_bb = &keys.next_img; else if (!strcmp(action, "blur")) cur_bb = &keys.blur; else if (!strcmp(action, "rotate")) @@ -189,10 +189,6 @@ void init_buttonbindings(void) cur_bb = &keys.scroll_up_page; else if (!strcmp(action, "scroll_down_page")) cur_bb = &keys.scroll_down_page; - else if (!strcmp(action, "prev_img")) - cur_bb = &keys.prev_img; - else if (!strcmp(action, "next_img")) - cur_bb = &keys.next_img; else if (!strcmp(action, "jump_back")) cur_bb = &keys.jump_back; else if (!strcmp(action, "jump_fwd")) @@ -265,8 +261,6 @@ void init_buttonbindings(void) cur_bb = &keys.toggle_caption; else if (!strcmp(action, "toggle_pause")) cur_bb = &keys.toggle_pause; - else if (!strcmp(action, "toggle_menu")) - cur_bb = &keys.toggle_menu; else if (!strcmp(action, "toggle_fullscreen")) cur_bb = &keys.toggle_fullscreen; else if (!strcmp(action, "reload_image")) @@ -343,7 +337,7 @@ static void feh_event_handle_ButtonPress(XEvent * ev) state = ev->xbutton.state & (ControlMask | ShiftMask | Mod1Mask | Mod4Mask); button = ev->xbutton.button; - if (!opt.no_menus && feh_is_bb(&keys.menu, button, state)) { + if (!opt.no_menus && feh_is_bb(&keys.toggle_menu, button, state)) { D(("Menu Button Press event\n")); winwidget_show_menu(winwid); @@ -443,12 +437,12 @@ static void feh_event_handle_ButtonPress(XEvent * ev) D(("Reload Button Press event\n")); feh_reload_image(winwid, 0, 1); - } else if (feh_is_bb(&keys.prev, button, state)) { + } else if (feh_is_bb(&keys.prev_img, button, state)) { D(("Prev Button Press event\n")); if (winwid->type == WIN_TYPE_SLIDESHOW) slideshow_change_image(winwid, SLIDE_PREV, 1); - } else if (feh_is_bb(&keys.next, button, state)) { + } else if (feh_is_bb(&keys.next_img, button, state)) { D(("Next Button Press event\n")); if (winwid->type == WIN_TYPE_SLIDESHOW) slideshow_change_image(winwid, SLIDE_NEXT, 1); diff --git a/src/options.h b/src/options.h index 7440749..0dee617 100644 --- a/src/options.h +++ b/src/options.h @@ -204,9 +204,6 @@ struct __fehkb { struct __fehkey pan; struct __fehkey zoom; struct __fehkey reload; - struct __fehkey prev; - struct __fehkey next; - struct __fehkey menu; struct __fehkey blur; struct __fehkey rotate; }; -- cgit v1.2.3