summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Friesel <derf@finalrewind.org>2018-05-11 17:03:34 +0200
committerDaniel Friesel <derf@finalrewind.org>2018-05-11 17:03:34 +0200
commit185e861b4975bf2e5505ac7237f6946ee4def608 (patch)
tree95ec2358ea5ee3f9e4d4485111b8ca2ce57541ac
parent3d71b4746c1cea6e45a65c0c1b2285dfbfcc905b (diff)
Show correct filelist position in windows opened from thumbnail mode
Addresses part of issue #75
-rw-r--r--src/thumbnail.c15
-rw-r--r--src/winwidget.c2
2 files changed, 12 insertions, 5 deletions
diff --git a/src/thumbnail.c b/src/thumbnail.c
index 003c7b4..3e99bfb 100644
--- a/src/thumbnail.c
+++ b/src/thumbnail.c
@@ -766,17 +766,26 @@ int feh_thumbnail_get_generated(Imlib_Image * image, feh_file * file,
void feh_thumbnail_show_fullsize(feh_file *thumbfile)
{
winwidget thumbwin = NULL;
+ gib_list *l;
+
+ for (l = filelist; l; l = l->next) {
+ if (FEH_FILE(l->data) == thumbfile) {
+ break;
+ }
+ }
+ if (!l) {
+ eprintf("Cannot find %s in filelist, wtf", thumbfile->filename);
+ }
thumbwin = winwidget_get_first_window_of_type(WIN_TYPE_THUMBNAIL_VIEWER);
if (!thumbwin) {
thumbwin = winwidget_create_from_file(
- gib_list_add_front(NULL, thumbfile),
+ l,
WIN_TYPE_THUMBNAIL_VIEWER);
if (thumbwin)
winwidget_show(thumbwin);
} else if (FEH_FILE(thumbwin->file->data) != thumbfile) {
- free(thumbwin->file);
- thumbwin->file = gib_list_add_front(NULL, thumbfile);
+ thumbwin->file = l;
feh_reload_image(thumbwin, 1, 1);
}
}
diff --git a/src/winwidget.c b/src/winwidget.c
index beae9fa..7aae191 100644
--- a/src/winwidget.c
+++ b/src/winwidget.c
@@ -773,8 +773,6 @@ void winwidget_destroy(winwidget winwid)
free(winwid->name);
if (winwid->gc)
XFreeGC(disp, winwid->gc);
- if ((winwid->type == WIN_TYPE_THUMBNAIL_VIEWER) && (winwid->file != NULL))
- gib_list_free(winwid->file);
if (winwid->im)
gib_imlib_free_image_and_decache(winwid->im);
free(winwid);