Loading src/imlib.c +76 −0 Original line number Diff line number Diff line Loading @@ -322,6 +322,82 @@ int feh_load_image(Imlib_Image * im, feh_file * file) return(1); } void feh_reload_image(winwidget w, int resize, int force_new) { char *new_title; int len; Imlib_Image tmp; int old_w, old_h; if (!w->file) { im_weprintf(w, "couldn't reload, this image has no file associated with it."); winwidget_render_image(w, 0, 0); return; } D(("resize %d, force_new %d\n", resize, force_new)); free(FEH_FILE(w->file->data)->caption); FEH_FILE(w->file->data)->caption = NULL; len = strlen(w->name) + sizeof("Reloading: ") + 1; new_title = emalloc(len); snprintf(new_title, len, "Reloading: %s", w->name); winwidget_rename(w, new_title); free(new_title); old_w = gib_imlib_image_get_width(w->im); old_h = gib_imlib_image_get_height(w->im); /* * If we don't free the old image before loading the new one, Imlib2's * caching will get in our way. * However, if --reload is used (force_new == 0), we want to continue if * the new image cannot be loaded, so we must not free the old image yet. */ if (force_new) winwidget_free_image(w); if ((feh_load_image(&tmp, FEH_FILE(w->file->data))) == 0) { if (force_new) eprintf("failed to reload image\n"); else { im_weprintf(w, "Couldn't reload image. Is it still there?"); winwidget_render_image(w, 0, 0); } return; } if (!resize && ((old_w != gib_imlib_image_get_width(tmp)) || (old_h != gib_imlib_image_get_height(tmp)))) resize = 1; if (!force_new) winwidget_free_image(w); w->im = tmp; winwidget_reset_image(w); w->mode = MODE_NORMAL; if ((w->im_w != gib_imlib_image_get_width(w->im)) || (w->im_h != gib_imlib_image_get_height(w->im))) w->had_resize = 1; if (w->has_rotated) { Imlib_Image temp; temp = gib_imlib_create_rotated_image(w->im, 0.0); w->im_w = gib_imlib_image_get_width(temp); w->im_h = gib_imlib_image_get_height(temp); gib_imlib_free_image_and_decache(temp); } else { w->im_w = gib_imlib_image_get_width(w->im); w->im_h = gib_imlib_image_get_height(w->im); } winwidget_render_image(w, resize, 0); return; } static int feh_file_is_raw(char *filename) { childpid = fork(); Loading src/slideshow.c +0 −76 Original line number Diff line number Diff line Loading @@ -182,82 +182,6 @@ void cb_reload_timer(void *data) return; } void feh_reload_image(winwidget w, int resize, int force_new) { char *new_title; int len; Imlib_Image tmp; int old_w, old_h; if (!w->file) { im_weprintf(w, "couldn't reload, this image has no file associated with it."); winwidget_render_image(w, 0, 0); return; } D(("resize %d, force_new %d\n", resize, force_new)); free(FEH_FILE(w->file->data)->caption); FEH_FILE(w->file->data)->caption = NULL; len = strlen(w->name) + sizeof("Reloading: ") + 1; new_title = emalloc(len); snprintf(new_title, len, "Reloading: %s", w->name); winwidget_rename(w, new_title); free(new_title); old_w = gib_imlib_image_get_width(w->im); old_h = gib_imlib_image_get_height(w->im); /* * If we don't free the old image before loading the new one, Imlib2's * caching will get in our way. * However, if --reload is used (force_new == 0), we want to continue if * the new image cannot be loaded, so we must not free the old image yet. */ if (force_new) winwidget_free_image(w); if ((feh_load_image(&tmp, FEH_FILE(w->file->data))) == 0) { if (force_new) eprintf("failed to reload image\n"); else { im_weprintf(w, "Couldn't reload image. Is it still there?"); winwidget_render_image(w, 0, 0); } return; } if (!resize && ((old_w != gib_imlib_image_get_width(tmp)) || (old_h != gib_imlib_image_get_height(tmp)))) resize = 1; if (!force_new) winwidget_free_image(w); w->im = tmp; winwidget_reset_image(w); w->mode = MODE_NORMAL; if ((w->im_w != gib_imlib_image_get_width(w->im)) || (w->im_h != gib_imlib_image_get_height(w->im))) w->had_resize = 1; if (w->has_rotated) { Imlib_Image temp; temp = gib_imlib_create_rotated_image(w->im, 0.0); w->im_w = gib_imlib_image_get_width(temp); w->im_h = gib_imlib_image_get_height(temp); gib_imlib_free_image_and_decache(temp); } else { w->im_w = gib_imlib_image_get_width(w->im); w->im_h = gib_imlib_image_get_height(w->im); } winwidget_render_image(w, resize, 0); return; } void slideshow_change_image(winwidget winwid, int change, int render) { gib_list *last = NULL; Loading Loading
src/imlib.c +76 −0 Original line number Diff line number Diff line Loading @@ -322,6 +322,82 @@ int feh_load_image(Imlib_Image * im, feh_file * file) return(1); } void feh_reload_image(winwidget w, int resize, int force_new) { char *new_title; int len; Imlib_Image tmp; int old_w, old_h; if (!w->file) { im_weprintf(w, "couldn't reload, this image has no file associated with it."); winwidget_render_image(w, 0, 0); return; } D(("resize %d, force_new %d\n", resize, force_new)); free(FEH_FILE(w->file->data)->caption); FEH_FILE(w->file->data)->caption = NULL; len = strlen(w->name) + sizeof("Reloading: ") + 1; new_title = emalloc(len); snprintf(new_title, len, "Reloading: %s", w->name); winwidget_rename(w, new_title); free(new_title); old_w = gib_imlib_image_get_width(w->im); old_h = gib_imlib_image_get_height(w->im); /* * If we don't free the old image before loading the new one, Imlib2's * caching will get in our way. * However, if --reload is used (force_new == 0), we want to continue if * the new image cannot be loaded, so we must not free the old image yet. */ if (force_new) winwidget_free_image(w); if ((feh_load_image(&tmp, FEH_FILE(w->file->data))) == 0) { if (force_new) eprintf("failed to reload image\n"); else { im_weprintf(w, "Couldn't reload image. Is it still there?"); winwidget_render_image(w, 0, 0); } return; } if (!resize && ((old_w != gib_imlib_image_get_width(tmp)) || (old_h != gib_imlib_image_get_height(tmp)))) resize = 1; if (!force_new) winwidget_free_image(w); w->im = tmp; winwidget_reset_image(w); w->mode = MODE_NORMAL; if ((w->im_w != gib_imlib_image_get_width(w->im)) || (w->im_h != gib_imlib_image_get_height(w->im))) w->had_resize = 1; if (w->has_rotated) { Imlib_Image temp; temp = gib_imlib_create_rotated_image(w->im, 0.0); w->im_w = gib_imlib_image_get_width(temp); w->im_h = gib_imlib_image_get_height(temp); gib_imlib_free_image_and_decache(temp); } else { w->im_w = gib_imlib_image_get_width(w->im); w->im_h = gib_imlib_image_get_height(w->im); } winwidget_render_image(w, resize, 0); return; } static int feh_file_is_raw(char *filename) { childpid = fork(); Loading
src/slideshow.c +0 −76 Original line number Diff line number Diff line Loading @@ -182,82 +182,6 @@ void cb_reload_timer(void *data) return; } void feh_reload_image(winwidget w, int resize, int force_new) { char *new_title; int len; Imlib_Image tmp; int old_w, old_h; if (!w->file) { im_weprintf(w, "couldn't reload, this image has no file associated with it."); winwidget_render_image(w, 0, 0); return; } D(("resize %d, force_new %d\n", resize, force_new)); free(FEH_FILE(w->file->data)->caption); FEH_FILE(w->file->data)->caption = NULL; len = strlen(w->name) + sizeof("Reloading: ") + 1; new_title = emalloc(len); snprintf(new_title, len, "Reloading: %s", w->name); winwidget_rename(w, new_title); free(new_title); old_w = gib_imlib_image_get_width(w->im); old_h = gib_imlib_image_get_height(w->im); /* * If we don't free the old image before loading the new one, Imlib2's * caching will get in our way. * However, if --reload is used (force_new == 0), we want to continue if * the new image cannot be loaded, so we must not free the old image yet. */ if (force_new) winwidget_free_image(w); if ((feh_load_image(&tmp, FEH_FILE(w->file->data))) == 0) { if (force_new) eprintf("failed to reload image\n"); else { im_weprintf(w, "Couldn't reload image. Is it still there?"); winwidget_render_image(w, 0, 0); } return; } if (!resize && ((old_w != gib_imlib_image_get_width(tmp)) || (old_h != gib_imlib_image_get_height(tmp)))) resize = 1; if (!force_new) winwidget_free_image(w); w->im = tmp; winwidget_reset_image(w); w->mode = MODE_NORMAL; if ((w->im_w != gib_imlib_image_get_width(w->im)) || (w->im_h != gib_imlib_image_get_height(w->im))) w->had_resize = 1; if (w->has_rotated) { Imlib_Image temp; temp = gib_imlib_create_rotated_image(w->im, 0.0); w->im_w = gib_imlib_image_get_width(temp); w->im_h = gib_imlib_image_get_height(temp); gib_imlib_free_image_and_decache(temp); } else { w->im_w = gib_imlib_image_get_width(w->im); w->im_h = gib_imlib_image_get_height(w->im); } winwidget_render_image(w, resize, 0); return; } void slideshow_change_image(winwidget winwid, int change, int render) { gib_list *last = NULL; Loading