From aa22a1466e747a67fbae482d0251545ebb73318f Mon Sep 17 00:00:00 2001 From: Levi Smith Date: Sat, 4 Sep 2010 03:58:43 -0700 Subject: 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. --- src/winwidget.c | 41 +++++++++++++++++++++++++---------------- 1 file changed, 25 insertions(+), 16 deletions(-) (limited to 'src/winwidget.c') 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) -- cgit v1.2.3