Commit aa22a146 authored by Levi Smith's avatar Levi Smith Committed by Birte Kristina Friesel
Browse files

1) winwidget.c winwidget.h New function winwidget_update_caption using code in...

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.
parent c9787e8b
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -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);
+25 −16
Original line number Diff line number Diff line
@@ -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)
+1 −0
Original line number Diff line number Diff line
@@ -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);