Commit 09fd4a99 authored by Birte Kristina Friesel's avatar Birte Kristina Friesel
Browse files

Remove --action-hold-slide, add per-action method instead.

When executing an action starting with a semicolon, feh will
not skip to the next slide. The semicolon is not passed on to
the executing shell, of course. This is kinda ugly, but at least
it makes action handling somewhat more flexible.
parent dabc31d5
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -4,10 +4,11 @@ git HEAD
    * Removed rather obscure --bg-seamless mode
    * Short option -Y for --hide-pointer
    * Panning via keys: Make it behave like scrolling (inverted directions)
    * Patch by Levi Smith: Add --action-hold-slide option
    * Workaround for Xinerama fuckups: Set XINERAMA_SCREEN to the correct
      xinerama screen number
    * Add --info option to display custom image information
    * Do not change to the next slide when executing an action with ; as first
      character (this character is stripped when executing the action)

Tue, 24 Aug 2010 19:23:36 +0200  Daniel Friesel <derf@chaosdorf.de>

+17 −19
Original line number Diff line number Diff line
@@ -29,21 +29,19 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "winwidget.h"
#include "options.h"

void feh_event_invoke_action(winwidget winwid, char *action)
void feh_event_invoke_action(winwidget winwid, unsigned char action)
{
	D(("action is '%s'\n", action));
	D(("winwid is '%p'\n", winwid));
	if (action) {
	if (opt.actions[action]) {
		if (opt.slideshow) {
		    feh_action_run(FEH_FILE(winwid->file->data), action);
			feh_action_run(FEH_FILE(winwid->file->data), opt.actions[action]);
			winwidget_update_caption(winwid);

		    if (! opt.action_hold_slide)
			if (! opt.hold_actions[action])
				slideshow_change_image(winwid, SLIDE_NEXT);

		} else if ((winwid->type == WIN_TYPE_SINGLE)
				|| (winwid->type == WIN_TYPE_THUMBNAIL_VIEWER)) {
			feh_action_run(FEH_FILE(winwid->file->data), action);
			feh_action_run(FEH_FILE(winwid->file->data), opt.actions[action]);
			winwidget_destroy(winwid);
		} else if (winwid->type == WIN_TYPE_THUMBNAIL) {
			printf("actions from the main thumb window aren't currentl supported!\n");
@@ -215,43 +213,43 @@ void feh_event_handle_keypress(XEvent * ev)
	case XK_KP_Enter:
	case XK_0:
	case XK_KP_0:
		feh_event_invoke_action(winwid, opt.actions[0]);
		feh_event_invoke_action(winwid, 0);
		break;
	case XK_1:
	case XK_KP_1:
		feh_event_invoke_action(winwid, opt.actions[1]);
		feh_event_invoke_action(winwid, 1);
		break;
	case XK_2:
	case XK_KP_2:
		feh_event_invoke_action(winwid, opt.actions[2]);
		feh_event_invoke_action(winwid, 2);
		break;
	case XK_3:
	case XK_KP_3:
		feh_event_invoke_action(winwid, opt.actions[3]);
		feh_event_invoke_action(winwid, 3);
		break;
	case XK_4:
	case XK_KP_4:
		feh_event_invoke_action(winwid, opt.actions[4]);
		feh_event_invoke_action(winwid, 4);
		break;
	case XK_5:
	case XK_KP_5:
		feh_event_invoke_action(winwid, opt.actions[5]);
		feh_event_invoke_action(winwid, 5);
		break;
	case XK_6:
	case XK_KP_6:
		feh_event_invoke_action(winwid, opt.actions[6]);
		feh_event_invoke_action(winwid, 6);
		break;
	case XK_7:
	case XK_KP_7:
		feh_event_invoke_action(winwid, opt.actions[7]);
		feh_event_invoke_action(winwid, 7);
		break;
	case XK_8:
	case XK_KP_8:
		feh_event_invoke_action(winwid, opt.actions[8]);
		feh_event_invoke_action(winwid, 8);
		break;
	case XK_9:
	case XK_KP_9:
		feh_event_invoke_action(winwid, opt.actions[9]);
		feh_event_invoke_action(winwid, 9);
		break;
	case XK_KP_Left:
		winwid->im_x += 10;
+8 −5
Original line number Diff line number Diff line
@@ -71,7 +71,6 @@ void init_parse_options(int argc, char **argv)
	opt.next_button = 5;

	opt.draw_actions = 0;
	opt.action_hold_slide = 0;

	opt.rotate_button = 2;
	opt.no_rotate_ctrl_mask = 0;
@@ -422,12 +421,12 @@ static void feh_parse_option_array(int argc, char **argv)
		{"index-size"    , 1, 0, 231},
		{"index-dim"     , 1, 0, 232},
		{"thumb-redraw"  , 1, 0, 'J'},
		{"action-hold-slide", 0, 0, 233},
		{"info"          , 1, 0, 234},

		{0, 0, 0, 0}
	};
	int optch = 0, cmdx = 0;
	int i = 0;

	/* Now to pass some optionarinos */
	while ((optch = getopt_long(argc, argv, stropts, lopts, &cmdx)) != EOF) {
@@ -770,9 +769,6 @@ static void feh_parse_option_array(int argc, char **argv)
		case 'J':
			opt.thumb_redraw = atoi(optarg);
			break;
		case 233:
			opt.action_hold_slide = 1;
			break;
		case 234:
			opt.info_cmd = estrdup(optarg);
			break;
@@ -790,6 +786,13 @@ static void feh_parse_option_array(int argc, char **argv)
		}
	}

	for (i = 0; i < 10; i++) {
		if (opt.actions[i] && !opt.hold_actions[i] && (opt.actions[i][0] == ';')) {
			opt.hold_actions[i] = 1;
			opt.actions[i] = &opt.actions[i][1];
		}
	}

	/* So that we can safely be called again */
	optind = 1;
	return;
+1 −1
Original line number Diff line number Diff line
@@ -66,9 +66,9 @@ struct __fehoptions {
	unsigned char screen_clip;
	unsigned char hide_pointer;
	unsigned char draw_actions;
	unsigned char action_hold_slide;
	unsigned char cache_thumbnails;
	unsigned char cycle_once;
	unsigned char hold_actions[10];

	char *output_file;
	char *output_dir;