summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorANogin <github@nogin.org>2013-12-08 12:21:45 -0800
committerDaniel Friesel <derf@finalrewind.org>2017-01-12 16:57:56 +0100
commita961c8b322cd961dee845840c3fbebaff75402b8 (patch)
tree92f80a50b6ca4f14e1d53525c6449839478dff61 /src
parent44d33fc2a05415cf20af360ee9f8bffd0d40460d (diff)
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).
Diffstat (limited to 'src')
-rw-r--r--src/events.c2
-rw-r--r--src/feh.h2
-rw-r--r--src/keyevents.c6
-rw-r--r--src/list.c6
-rw-r--r--src/slideshow.c4
5 files changed, 10 insertions, 10 deletions
diff --git a/src/events.c b/src/events.c
index 4a894e8..b20fd4f 100644
--- a/src/events.c
+++ b/src/events.c
@@ -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 {
diff --git a/src/feh.h b/src/feh.h
index 65e8393..b66f908 100644
--- a/src/feh.h
+++ b/src/feh.h
@@ -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, ...);
diff --git a/src/keyevents.c b/src/keyevents.c
index 7bfacc8..e4b7c7b 100644
--- a/src/keyevents.c
+++ b/src/keyevents.c
@@ -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);
diff --git a/src/list.c b/src/list.c
index fcb41ac..6f317c4 100644
--- a/src/list.c
+++ b/src/list.c
@@ -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)
diff --git a/src/slideshow.c b/src/slideshow.c
index b15c360..b57d5c5 100644
--- a/src/slideshow.c
+++ b/src/slideshow.c
@@ -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);