From 85821865c9cc3824469d96a34f29b0983f8cfdc7 Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Sat, 13 Feb 2010 13:49:25 +0100 Subject: Rework button options --- feh.1 | 31 +++++++++++++++++++---------- src/events.c | 14 ++++++------- src/options.c | 64 +++++++++++++++++++++++++++++++++++++---------------------- src/options.h | 4 +++- 4 files changed, 70 insertions(+), 43 deletions(-) diff --git a/feh.1 b/feh.1 index f618500..b98be39 100644 --- a/feh.1 +++ b/feh.1 @@ -322,32 +322,41 @@ Use TITLE as window title in slideshow mode. .B -0, --reload-button B Use button B to reload the current image (default: 0) .TP 5 -.B -1, --next-button B -Use button B to advance to the next image in slideshow -mode (defaults to 1, usually the left button). +.B -1, --pan-button B +Use button B to pan the image (hold button down and move mouse to move the image). +When the mouse is not moved, advances to the next image in slideshow mode +(defaults to 1, usually the left button). .TP 5 .B -2, --zoom-button B Use button B to zoom the current image in any mode (defaults to 2, usually the middle button). .TP 5 -.B -4, --menu-button B -Use CTRL+Button B to activate the menu in any mode. Set to 0 to use any -button. This option is disabled if the \-N or \-\-no\-menus option is set +.B -3, --menu-button B +Use button B to activate the menu in any mode. +This option is disabled if the \-N or \-\-no\-menus option is set (defaults to 3, usually the right button). .TP 5 -.B -5, --menu-ctrl-mask +.B --menu-ctrl-mask Require CTRL+Button for menu activation in any mode (default=off). .TP 5 -.B -6, --rotate-button B +.B -4, --prev-button B +Use button B to switch to the previous image in slideshow mode +(defaults to 4, usually ). +.TP 5 +.B -5, --next-button B +Use button B to switch to the next image in slideshow mode +(defaults to 5, usually ). +.TP 5 +.B -8, --rotate-button B Use CTRL+Button B to rotate the current image in any mode (default=2). .TP 5 -.B -7, --no-rotate-ctrl-mask +.B --no-rotate-ctrl-mask Don't require CTRL+Button for rotation in any mode -- just use the button (default=off). .TP 5 -.B -8, --blur-button B +.B -9, --blur-button B Use CTRL+Button B to blur the current image in any mode (default=1). .TP 5 -.B -9, --no-blur-ctrl-mask +.B --no-blur-ctrl-mask Don't require CTRL+Button for blurring in any mode -- just use the button (default=off). .TP 5 .B --no-xinerama diff --git a/src/events.c b/src/events.c index ad78fbe..610178c 100644 --- a/src/events.c +++ b/src/events.c @@ -117,9 +117,9 @@ feh_event_handle_ButtonPress(XEvent * ev) D(3, ("blur starting at %d, %d\n", ev->xbutton.x, ev->xbutton.y)); } } - else if (ev->xbutton.button == opt.next_button) + else if (ev->xbutton.button == opt.pan_button) { - D(3, ("Next Button Press event\n")); + D(3, ("Pan Button Press event\n")); if (winwid != NULL) { D(3, ("Next button, but could be pan mode\n")); @@ -189,15 +189,15 @@ feh_event_handle_ButtonPress(XEvent * ev) if (winwid != NULL) feh_reload_image(winwid, 0, 0); } - else if (ev->xbutton.button == 4 /* this is bad */ ) + else if (ev->xbutton.button == opt.prev_button ) { - D(3, ("Button 4 Press event\n")); + D(3, ("Prev Button Press event\n")); if ((winwid != NULL) && (winwid->type == WIN_TYPE_SLIDESHOW)) slideshow_change_image(winwid, SLIDE_PREV); } - else if (ev->xbutton.button == 5 /* this is bad */ ) + else if (ev->xbutton.button == opt.next_button ) { - D(3, ("Button 5 Press event\n")); + D(3, ("Next Button 5 Press event\n")); if ((winwid != NULL) && (winwid->type == WIN_TYPE_SLIDESHOW)) slideshow_change_image(winwid, SLIDE_NEXT); } @@ -246,7 +246,7 @@ feh_event_handle_ButtonRelease(XEvent * ev) || ((ev->xbutton.state & ControlMask) && (opt.menu_ctrl_mask))))) && (opt.no_menus)) winwidget_destroy_all(); - else if (ev->xbutton.button == opt.next_button) + else if (ev->xbutton.button == opt.pan_button) { if (opt.mode == MODE_PAN) { diff --git a/src/options.c b/src/options.c index 3955ef9..23df59f 100644 --- a/src/options.c +++ b/src/options.c @@ -60,11 +60,13 @@ init_parse_options(int argc, char **argv) opt.menu_style = estrdup(PREFIX "/share/feh/fonts/menu.style"); opt.menu_border = 4; - opt.next_button = 1; + opt.reload_button = 0; + opt.pan_button = 1; opt.zoom_button = 2; opt.menu_button = 3; opt.menu_ctrl_mask = 0; - opt.reload_button = 0; + opt.prev_button = 4; + opt.next_button = 5; opt.rotate_button = 2; opt.no_rotate_ctrl_mask = 0; @@ -317,7 +319,7 @@ static void feh_parse_option_array(int argc, char **argv) { static char stropts[] = - "a:A:b:B:cC:dD:e:E:f:Fg:GhH:iIj:klL:mM:nNo:O:pqQrR:sS:tT:uUvVwW:xXy:zZ1:2:4:56:78:90:.@:^:~:):|:_:+:"; + "a:A:b:B:cC:dD:e:E:f:Fg:GhH:iIj:klL:mM:nNo:O:pqQrR:sS:tT:uUvVwW:xXy:zZ0:1:2:4:5:8:9:.@:^:~:):|:_:+:"; static struct option lopts[] = { /* actions */ {"help", 0, 0, 'h'}, /* okay */ @@ -348,10 +350,10 @@ feh_parse_option_array(int argc, char **argv) {"thumbnails", 0, 0, 't'}, {"wget-timestamp", 0, 0, 'G'}, {"builtin", 0, 0, 'Q'}, - {"menu-ctrl-mask", 0, 0, '5'}, /* okay */ + {"menu-ctrl-mask", 0, 0, 228}, /* okay */ {"scale-down", 0, 0, '.'}, /* okay */ - {"no-rotate-ctrl-mask", 0, 0, '7'}, - {"no-blur-ctrl-mask", 0, 0, '9'}, + {"no-rotate-ctrl-mask", 0, 0, 226}, + {"no-blur-ctrl-mask", 0, 0, 227}, {"no-xinerama", 0, 0, 225}, {"no-jump-on-resort",0,0,220}, {"hide-pointer",0,0,221}, @@ -381,11 +383,13 @@ feh_parse_option_array(int argc, char **argv) {"menu-bg", 1, 0, ')'}, {"image-bg", 1, 0, 'B'}, {"reload-button", 1, 0, '0'}, - {"next-button", 1, 0, '1'}, + {"pan-button", 1, 0, '1'}, {"zoom-button", 1, 0, '2'}, - {"menu-button", 1, 0, '4'}, - {"rotate-button", 1, 0, '6'}, - {"blur-button", 1, 0, '8'}, + {"menu-button", 1, 0, '3'}, + {"prev-button", 1, 0, '4'}, + {"next-button", 1, 0, '5'}, + {"rotate-button", 1, 0, '8'}, + {"blur-button", 1, 0, '9'}, {"start-at", 1, 0, '|'}, {"rcfile", 1, 0, '_'}, {"debug-level", 1, 0, '+'}, @@ -630,27 +634,33 @@ feh_parse_option_array(int argc, char **argv) opt.reload_button = atoi(optarg); break; case '1': - opt.next_button = atoi(optarg); + opt.pan_button = atoi(optarg); break; case '2': opt.zoom_button = atoi(optarg); break; - case '4': + case '3': opt.menu_button = atoi(optarg); break; + case '4': + opt.prev_button = atoi(optarg); + break; case '5': + opt.next_button = atoi(optarg); + break; + case 228: opt.menu_ctrl_mask = 1; break; - case '6': + case '8': opt.rotate_button = atoi(optarg); break; - case '7': + case 226: opt.no_rotate_ctrl_mask = 1; break; - case '8': + case '9': opt.blur_button = atoi(optarg); break; - case '9': + case 227: opt.no_blur_ctrl_mask = 1; break; case '|': @@ -1017,23 +1027,29 @@ show_usage(void) " Accepted values: white, black, default\n" " -N, --no-menus Don't load or show any menus.\n" " -0, --reload-button B Use button B to reload the image (defaults to 0)\n" -" -1, --next-button B Use button B to advance to the next image in any\n" -" mode (defaults to 1, usually the left button).\n" +" -1, --pan-button B Use button B pan the image (hold button down, move\n" +" the mouse to move the image around. Advancesto the\n" +" next image when the mouse is not moved (defaults to\n" +" 1, usually the left button).\n" " -2, --zoom-button B Use button B to zoom the current image in any\n" " mode (defaults to 2, usually the middle button).\n" -" -4, --menu-button B Use CTRL+Button B to activate the menu in any\n" +" -3, --menu-button B Use CTRL+Button B to activate the menu in any\n" " mode. Set to 0 for any button. This option\n" " is disabled if the -N or --no-menus option is set\n" " (defaults to 3, usually the right button).\n" -" -5, --menu-ctrl-mask Require CTRL+Button for menu activation in\n" +" --menu-ctrl-mask Require CTRL+Button for menu activation in\n" " any mode (default=off).\n" -" -6, --rotate-button B Use CTRL+Button B to rotate the current image in\n" +" -4, --prev-button B Use button B to switch to the previous image\n" +" (defaults to 4, which usually is ).\n" +" -5, --next-button B Use button B to switch to the next image\n" +" (defaults to 5, which usually is ).\n" +" -8, --rotate-button B Use CTRL+Button B to rotate the current image in\n" " any mode (default=2).\n" -" -7, --no-rotate-ctrl-mask Don't require CTRL+Button for rotation in\n" +" --no-rotate-ctrl-mask Don't require CTRL+Button for rotation in\n" " any mode -- just use the button (default=off).\n" -" -8, --blur-button B Use CTRL+Button B to blur the current image in\n" +" -9, --blur-button B Use CTRL+Button B to blur the current image in\n" " any mode (default=1).\n" -" -9, --no-blur-ctrl-mask Don't require CTRL+Button for blurring in\n" +" --no-blur-ctrl-mask Don't require CTRL+Button for blurring in\n" " any mode -- just use the button (default=off).\n" " --no-xinerama Disable Xinerama support. Only useful if\n" " you have Xinerama compiled in.\n" diff --git a/src/options.h b/src/options.h index 0c60c9b..ba88fc8 100644 --- a/src/options.h +++ b/src/options.h @@ -92,10 +92,12 @@ struct __fehoptions gib_style *menu_style_l; - unsigned char next_button; + unsigned char pan_button; unsigned char zoom_button; unsigned char menu_button; unsigned char menu_ctrl_mask; + unsigned char prev_button; + unsigned char next_button; unsigned char rotate_button; unsigned char blur_button; -- cgit v1.2.3