Scaling support - tooltips (issue #656)

This commit is contained in:
o9000 2018-01-17 21:12:17 +00:00
parent 5db0dceec2
commit 3190c5b7de
2 changed files with 6 additions and 2 deletions

View file

@ -655,12 +655,13 @@ void task_refresh_thumbnail(Task *task)
return;
if (task->current_state == TASK_ICONIFIED)
return;
Panel *panel = (Panel*)task->area.panel;
double now = get_time();
if (now - task->thumbnail_last_update < 0.1)
return;
if (debug_thumbnails)
fprintf(stderr, "tint2: thumbnail for window: %s" RESET "\n", task->title ? task->title : "");
cairo_surface_t *thumbnail = get_window_thumbnail(task->win, panel_config.g_task.thumbnail_width);
cairo_surface_t *thumbnail = get_window_thumbnail(task->win, panel_config.g_task.thumbnail_width * panel->scale);
if (!thumbnail)
return;
if (task->thumbnail)

View file

@ -281,7 +281,9 @@ void tooltip_update()
Color fc = g_tooltip.font_color;
cairo_set_source_rgba(c, fc.rgb[0], fc.rgb[1], fc.rgb[2], fc.alpha);
PangoLayout *layout = pango_cairo_create_layout(c);
PangoContext *context = pango_cairo_create_context(c);
pango_cairo_context_set_resolution(context, 96 * panel->scale);
PangoLayout *layout = pango_layout_new(context);
pango_layout_set_font_description(layout, g_tooltip.font_desc);
pango_layout_set_wrap(layout, PANGO_WRAP_WORD);
pango_layout_set_text(layout, g_tooltip.tooltip_text, -1);
@ -297,6 +299,7 @@ void tooltip_update()
-r1.y / 2 + 1 + top_bg_border_width(g_tooltip.bg) + g_tooltip.paddingy * panel->scale);
pango_cairo_show_layout(c, layout);
g_object_unref(layout);
g_object_unref(context);
if (g_tooltip.image) {
cairo_translate(c,