summaryrefslogtreecommitdiff
path: root/gui/index.c
diff options
context:
space:
mode:
authorWerner Almesberger <werner@almesberger.net>2016-08-24 02:47:34 -0300
committerWerner Almesberger <werner@almesberger.net>2016-08-24 02:47:34 -0300
commitbe96ca3b1ee3b6ca9c681fb800c0e5545acc3646 (patch)
tree111c829b0c73cd2e31cc117d250c4affa88ea82e /gui/index.c
parent2989ad7ff3a8cf315c2acc5749651ede43cc0119 (diff)
downloadeeshow-be96ca3b1ee3b6ca9c681fb800c0e5545acc3646.tar.gz
eeshow-be96ca3b1ee3b6ca9c681fb800c0e5545acc3646.tar.bz2
eeshow-be96ca3b1ee3b6ca9c681fb800c0e5545acc3646.zip
gui/index.c (index_resize): politely bow out if asked for impossible size
Diffstat (limited to 'gui/index.c')
-rw-r--r--gui/index.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/gui/index.c b/gui/index.c
index 570d085..62968b8 100644
--- a/gui/index.c
+++ b/gui/index.c
@@ -136,7 +136,7 @@ static bool thumb_hover(void *user, bool on, int dx, int dy)
/* ----- Rendering to cache ------------------------------------------------ */
-static void best_ratio(const struct gui_ctx *ctx)
+static bool best_ratio(const struct gui_ctx *ctx)
{
GtkAllocation alloc;
const struct gui_sheet *sheet;
@@ -178,6 +178,8 @@ static void best_ratio(const struct gui_ctx *ctx)
thumb_h = h;
}
}
+
+ return best_size;
}
@@ -307,8 +309,10 @@ static const struct input_ops index_input_ops = {
void index_resize(struct gui_ctx *ctx)
{
overlay_remove_all(&ctx->thumb_overlays);
- best_ratio(ctx);
- index_render_sheets(ctx);
+ if (best_ratio(ctx))
+ index_render_sheets(ctx);
+ else
+ close_index(ctx);
redraw(ctx);
}