From cb4ee6d5b9912e73090bfb648720b314e91b9ded Mon Sep 17 00:00:00 2001 From: Werner Almesberger Date: Sat, 6 Aug 2016 23:01:51 -0300 Subject: [PATCH] eeshow/: work around the ink_rect.y bug more elegantly Still have no clue what causes this. --- eeshow/gui-over.c | 14 +++++++++++++- eeshow/gui.c | 9 +-------- 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/eeshow/gui-over.c b/eeshow/gui-over.c index ba9955f..de664dc 100644 --- a/eeshow/gui-over.c +++ b/eeshow/gui-over.c @@ -154,7 +154,19 @@ fprintf(stderr, "%d + %d %d + %d\n", #if 0 fprintf(stderr, "%u(%d) %u %.60s\n", ty, ink_rect.y / PANGO_SCALE, ink_h, over->s); #endif - cairo_rectangle(cr, tx, ty, ink_w, ink_h); +/* + * @@@ for some mysterious reason, we get + * ink_h = ink_rect.height / PANGO_SCALE = 5 + * instead of 2 if using overlay_style_dense_selected. Strangely, changing + * overlay_style_dense_selected such that it becomes more like + * overlay_style_dense has no effect. + * + * This causes the text to be cut vertically, roughly in the middle. We hack + * around this problem by growind the clipping area vertically. This works, + * since we're currently only concerned about horizontal clipping anyway. + */ + + cairo_rectangle(cr, tx, ty, ink_w, ink_h + 20); cairo_clip(cr); } diff --git a/eeshow/gui.c b/eeshow/gui.c index e2ef477..7a7532b 100644 --- a/eeshow/gui.c +++ b/eeshow/gui.c @@ -323,19 +323,12 @@ static void show_history(struct gui_ctx *ctx) overlay_remove_all(&ctx->vcs_overlays); for (h = ctx->hist; h; h = h->next) { - // @@@ \n doesn't work with cairo_show_text :-( over = overlay_add(&ctx->vcs_overlays, &ctx->aois, NULL, click_history, h); overlay_text(over, "%s", vcs_git_summary(h->hist)); overlay_style(over, -/* - * @@@ for some mysterious reason, we get ink_rect.height / PANGO_SCALE = 5 - * instead of 2 if using overlay_style_dense_selected. Strangely, changing - * overlay_style_dense_selected such that it becomes more like - * overlay_style_dense has no effect. - */ - h == ctx->curr_hist ? &overlay_style_dense_selected : + h == ctx->curr_hist ? &style_dense_selected : &style_dense); } redraw(ctx);