Mercurial > hg > forks > geeqie
changeset 2847:53785dd2e8c9
Bug fix: View in new window wrong size
Opening an image in "View in new window" was displayed in a window of
minimum size.
The window was opened before the image was completely loaded, and so the
window size was not known.
author | Colin Clark <colin.clark@cclark.uk> |
---|---|
date | Sun, 14 Oct 2018 10:39:17 +0100 |
parents | f508172c17fa |
children | ed4e22060177 |
files | src/image.c src/img-view.c |
diffstat | 2 files changed, 7 insertions(+), 15 deletions(-) [+] |
line wrap: on
line diff
--- a/src/image.c Sun Oct 07 12:09:17 2018 +0100 +++ b/src/image.c Sun Oct 14 10:39:17 2018 +0100 @@ -1121,6 +1121,8 @@ void image_attach_window(ImageWindow *imd, GtkWidget *window, const gchar *title, const gchar *title_right, gboolean show_zoom) { + LayoutWindow *lw; + imd->top_window = window; g_free(imd->title); imd->title = g_strdup(title); @@ -1128,7 +1130,9 @@ imd->title_right = g_strdup(title_right); imd->title_show_zoom = show_zoom; - if (!options->image.fit_window_to_image) window = NULL; + lw = layout_find_by_image(imd); + + if (!(options->image.fit_window_to_image && lw && lw->options.tools_float)) window = NULL; pixbuf_renderer_set_parent((PixbufRenderer *)imd->pr, (GtkWindow *)window);
--- a/src/img-view.c Sun Oct 07 12:09:17 2018 +0100 +++ b/src/img-view.c Sun Oct 14 10:39:17 2018 +0100 @@ -29,6 +29,7 @@ #include "filedata.h" #include "fullscreen.h" #include "image.h" +#include "image-load.h" #include "image-overlay.h" #include "layout.h" #include "layout_image.h" @@ -886,21 +887,8 @@ } /* Wait until image is loaded otherwise size is not defined */ - int count; - for (count = 10; count && !w && !h; count++) - { - image_get_image_size(vw->imd, &w, &h); - usleep(100000); - } + image_load_dimensions(fd, &w, &h); - if (image_zoom_get(vw->imd) == 0.0) - { - image_get_image_size(vw->imd, &w, &h); - } - else - { - pixbuf_renderer_get_scaled_size(PIXBUF_RENDERER(vw->imd->pr), &w, &h); - } if (options->image.limit_window_size) { gint mw = gdk_screen_width() * options->image.max_window_size / 100;