Commit a961c8b3 authored by ANogin's avatar ANogin Committed by Birte Kristina Friesel
Browse files

Pass windidget to feh_action_run, making it possible to use format specifiers

like %o and %z in slideshow actions (I would like to use this to zoom in, pan,
and then use an action to crop the window to zoomed in view).
parent 44d33fc2
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -388,7 +388,7 @@ static void feh_event_handle_ButtonRelease(XEvent * ev)
				thumbfile = feh_thumbnail_get_file_from_coords(x, y);
				if (thumbfile) {
					if (opt.actions[0]) {
						feh_action_run(thumbfile, opt.actions[0]);
						feh_action_run(thumbfile, opt.actions[0], winwid);
						if (!opt.hold_actions[0])
							feh_thumbnail_mark_removed(thumbfile, 0);
					} else {
+1 −1
Original line number Diff line number Diff line
@@ -143,7 +143,7 @@ void init_buttonbindings(void);
void feh_event_handle_keypress(XEvent * ev);
void feh_event_handle_generic(winwidget winwid, unsigned int state, KeySym keysym, unsigned int button);
fehkey *feh_str_to_kb(char * action);
void feh_action_run(feh_file * file, char *action);
void feh_action_run(feh_file * file, char *action, winwidget winwid);
char *format_size(int size);
char *feh_printf(char *str, feh_file * file, winwidget winwid);
void im_weprintf(winwidget w, char *fmt, ...);
+3 −3
Original line number Diff line number Diff line
@@ -227,7 +227,7 @@ void feh_event_invoke_action(winwidget winwid, unsigned char action)
{
	if (opt.actions[action]) {
		if (opt.slideshow) {
			feh_action_run(FEH_FILE(winwid->file->data), opt.actions[action]);
			feh_action_run(FEH_FILE(winwid->file->data), opt.actions[action], winwid);

			if (opt.hold_actions[action])
				feh_reload_image(winwid, 1, 1);
@@ -236,7 +236,7 @@ void feh_event_invoke_action(winwidget winwid, unsigned char action)

		} else if ((winwid->type == WIN_TYPE_SINGLE)
				|| (winwid->type == WIN_TYPE_THUMBNAIL_VIEWER)) {
			feh_action_run(FEH_FILE(winwid->file->data), opt.actions[action]);
			feh_action_run(FEH_FILE(winwid->file->data), opt.actions[action], winwid);

			if (opt.hold_actions[action])
				feh_reload_image(winwid, 1, 1);
@@ -247,7 +247,7 @@ void feh_event_invoke_action(winwidget winwid, unsigned char action)
			thumbfile = feh_thumbnail_get_selected_file();

			if (thumbfile) {
				feh_action_run(thumbfile, opt.actions[action]);
				feh_action_run(thumbfile, opt.actions[action], winwid);

				if (!opt.hold_actions[action])
					feh_thumbnail_mark_removed(thumbfile, 0);
+3 −3
Original line number Diff line number Diff line
@@ -54,7 +54,7 @@ void init_list_mode(void)
					file->info->has_alpha ? 'X' : '-', file->filename);
		}

		feh_action_run(file, opt.actions[0]);
		feh_action_run(file, opt.actions[0], NULL);
	}
	exit(0);
}
@@ -92,7 +92,7 @@ void real_loadables_mode(int loadable)
				if (opt.verbose)
					feh_display_status('.');
				puts(file->filename);
				feh_action_run(file, opt.actions[0]);
				feh_action_run(file, opt.actions[0], NULL);
			}
			else {
				if (opt.verbose)
@@ -106,7 +106,7 @@ void real_loadables_mode(int loadable)
				if (opt.verbose)
					feh_display_status('.');
				puts(file->filename);
				feh_action_run(file, opt.actions[0]);
				feh_action_run(file, opt.actions[0], NULL);
			}
			else {
				if (opt.verbose)
+2 −2
Original line number Diff line number Diff line
@@ -450,12 +450,12 @@ char *slideshow_create_name(feh_file * file, winwidget winwid)
	return(s);
}

void feh_action_run(feh_file * file, char *action)
void feh_action_run(feh_file * file, char *action, winwidget winwid)
{
	if (action) {
		char *sys;
		D(("Running action %s\n", action));
		sys = feh_printf(action, file, NULL);
		sys = feh_printf(action, file, winwid);

		if (opt.verbose && !opt.list && !opt.customlist)
			fprintf(stderr, "Running action -->%s<--\n", sys);