summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLevi Smith <lsmith3@unbc.ca>2010-09-04 03:58:43 -0700
committerDaniel Friesel <derf@finalrewind.org>2010-09-05 16:25:35 +0200
commitaa22a1466e747a67fbae482d0251545ebb73318f (patch)
tree8bed4fe2f0f22221a82844387a946bc88c7e16ec
parentc9787e8b1750a5f58ac759579e72a53ed752026d (diff)
1) winwidget.c winwidget.h New function winwidget_update_caption using code in winwindget_render_image. This code was removed from the latter, and replaced with a call to winwidget_update_caption.
2) Image caption is updated after running action when in slideshow mode. 3) Running action in slideshow mode no longer changes the image automatically.
-rw-r--r--src/keyevents.c4
-rw-r--r--src/winwidget.c41
-rw-r--r--src/winwidget.h1
3 files changed, 29 insertions, 17 deletions
diff --git a/src/keyevents.c b/src/keyevents.c
index 08d444a..8bb85f5 100644
--- a/src/keyevents.c
+++ b/src/keyevents.c
@@ -36,7 +36,9 @@ void feh_event_invoke_action(winwidget winwid, char *action)
if (action) {
if (opt.slideshow) {
feh_action_run(FEH_FILE(winwid->file->data), action);
- slideshow_change_image(winwid, SLIDE_NEXT);
+ winwidget_update_caption(winwid);
+ /* 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);
diff --git a/src/winwidget.c b/src/winwidget.c
index beae5df..e0862f8 100644
--- a/src/winwidget.c
+++ b/src/winwidget.c
@@ -306,6 +306,29 @@ void winwidget_update_title(winwidget ret)
return;
}
+void winwidget_update_caption(winwidget winwid)
+{
+ if (opt.caption_path) {
+ /* TODO: Does someone understand the caching here. Is this the right
+ * approach now that I have broken this out into a separate function. -lsmith */
+
+ /* cache bg pixmap. during caption entry, multiple redraws are done
+ * because the caption overlay changes - the image doesn't though, so re-
+ * rendering that is a waste of time */
+ if (winwid->caption_entry) {
+ GC gc;
+ if (winwid->bg_pmap_cache)
+ XFreePixmap(disp, winwid->bg_pmap_cache);
+ winwid->bg_pmap_cache = XCreatePixmap(disp, winwid->win, winwid->w, winwid->h, depth);
+ gc = XCreateGC(disp, winwid->win, 0, NULL);
+ XCopyArea(disp, winwid->bg_pmap, winwid->bg_pmap_cache, gc, 0, 0, winwid->w, winwid->h, 0, 0);
+ XFreeGC(disp, gc);
+ }
+ feh_draw_caption(winwid);
+ }
+ return;
+}
+
void winwidget_setup_pixmaps(winwidget winwid)
{
if (winwid->full_screen) {
@@ -506,22 +529,8 @@ void winwidget_render_image(winwidget winwid, int resize, int alias)
sh, dx, dy,
dw, dh, 1,
gib_imlib_image_has_alpha(winwid->im), alias);
- if (opt.caption_path) {
- /* cache bg pixmap. during caption entry, multiple redraws are done
- * because the caption overlay changes - the image doesn't though, so re-
- * rendering that is a waste of time */
- if (winwid->caption_entry) {
- GC gc;
- if (winwid->bg_pmap_cache)
- XFreePixmap(disp, winwid->bg_pmap_cache);
- winwid->bg_pmap_cache = XCreatePixmap(disp, winwid->win, winwid->w, winwid->h, depth);
- gc = XCreateGC(disp, winwid->win, 0, NULL);
- XCopyArea(disp, winwid->bg_pmap, winwid->bg_pmap_cache, gc, 0, 0, winwid->w, winwid->h, 0, 0);
- XFreeGC(disp, gc);
- }
- feh_draw_caption(winwid);
- }
-
+ if (opt.caption_path)
+ winwidget_update_caption(winwid);
if (opt.draw_filename)
feh_draw_filename(winwid);
if (opt.draw_actions)
diff --git a/src/winwidget.h b/src/winwidget.h
index 68b2c76..012d78f 100644
--- a/src/winwidget.h
+++ b/src/winwidget.h
@@ -128,6 +128,7 @@ void winwidget_move(winwidget winwid, int x, int y);
void winwidget_resize(winwidget winwid, int w, int h);
void winwidget_setup_pixmaps(winwidget winwid);
void winwidget_update_title(winwidget ret);
+void winwidget_update_caption(winwidget winwid);
void winwidget_rerender_all(int resize, int alias);
void winwidget_destroy_xwin(winwidget winwid);