Scale panel elements (issue #656)
This commit is contained in:
parent
12f04e3055
commit
c7b23ee94a
18 changed files with 183 additions and 133 deletions
|
@ -420,6 +420,7 @@ gboolean resize_battery(void *obj)
|
|||
void draw_battery(void *obj, cairo_t *c)
|
||||
{
|
||||
Battery *battery = (Battery *)obj;
|
||||
Panel *panel = (Panel *)battery->area.panel;
|
||||
draw_text_area(&battery->area,
|
||||
c,
|
||||
buf_bat_line1,
|
||||
|
@ -428,7 +429,8 @@ void draw_battery(void *obj, cairo_t *c)
|
|||
bat2_font_desc,
|
||||
battery->bat1_posy,
|
||||
battery->bat2_posy,
|
||||
&battery->font_color);
|
||||
&battery->font_color,
|
||||
panel->scale);
|
||||
}
|
||||
|
||||
void battery_dump_geometry(void *obj, int indent)
|
||||
|
|
|
@ -269,9 +269,9 @@ int button_compute_desired_size(void *obj)
|
|||
{
|
||||
Button *button = (Button *)obj;
|
||||
Panel *panel = (Panel *)button->area.panel;
|
||||
int horiz_padding = (panel_horizontal ? button->area.paddingxlr : button->area.paddingy);
|
||||
int vert_padding = (panel_horizontal ? button->area.paddingy : button->area.paddingxlr);
|
||||
int interior_padding = button->area.paddingx;
|
||||
int horiz_padding = (panel_horizontal ? button->area.paddingxlr : button->area.paddingy) * panel->scale;
|
||||
int vert_padding = (panel_horizontal ? button->area.paddingy : button->area.paddingxlr) * panel->scale;
|
||||
int interior_padding = button->area.paddingx * panel->scale;
|
||||
|
||||
int icon_w, icon_h;
|
||||
if (button->backend->icon_name) {
|
||||
|
@ -280,8 +280,8 @@ int button_compute_desired_size(void *obj)
|
|||
else
|
||||
icon_h = icon_w = button->area.width - left_right_border_width(&button->area) - 2 * horiz_padding;
|
||||
if (button->backend->max_icon_size) {
|
||||
icon_w = MIN(icon_w, button->backend->max_icon_size);
|
||||
icon_h = MIN(icon_h, button->backend->max_icon_size);
|
||||
icon_w = MIN(icon_w, button->backend->max_icon_size * panel->scale);
|
||||
icon_h = MIN(icon_h, button->backend->max_icon_size * panel->scale);
|
||||
}
|
||||
} else {
|
||||
icon_h = icon_w = 0;
|
||||
|
@ -300,7 +300,8 @@ int button_compute_desired_size(void *obj)
|
|||
strlen(button->backend->text),
|
||||
PANGO_WRAP_WORD_CHAR,
|
||||
PANGO_ELLIPSIZE_NONE,
|
||||
FALSE);
|
||||
FALSE,
|
||||
panel->scale);
|
||||
} else {
|
||||
get_text_size2(button->backend->font_desc,
|
||||
&txt_height_ink,
|
||||
|
@ -313,7 +314,8 @@ int button_compute_desired_size(void *obj)
|
|||
strlen(button->backend->text),
|
||||
PANGO_WRAP_WORD_CHAR,
|
||||
PANGO_ELLIPSIZE_NONE,
|
||||
FALSE);
|
||||
FALSE,
|
||||
panel->scale);
|
||||
}
|
||||
} else {
|
||||
txt_height_ink = txt_height = txt_width = 0;
|
||||
|
@ -336,9 +338,9 @@ gboolean resize_button(void *obj)
|
|||
Button *button = (Button *)obj;
|
||||
Panel *panel = (Panel *)button->area.panel;
|
||||
Area *area = &button->area;
|
||||
int horiz_padding = (panel_horizontal ? button->area.paddingxlr : button->area.paddingy);
|
||||
int vert_padding = (panel_horizontal ? button->area.paddingy : button->area.paddingxlr);
|
||||
int interior_padding = button->area.paddingx;
|
||||
int horiz_padding = (panel_horizontal ? button->area.paddingxlr : button->area.paddingy) * panel->scale;
|
||||
int vert_padding = (panel_horizontal ? button->area.paddingy : button->area.paddingxlr) * panel->scale;
|
||||
int interior_padding = button->area.paddingx * panel->scale;
|
||||
|
||||
int icon_w, icon_h;
|
||||
if (button->backend->icon_name) {
|
||||
|
@ -347,8 +349,8 @@ gboolean resize_button(void *obj)
|
|||
else
|
||||
icon_h = icon_w = button->area.width - left_right_border_width(&button->area) - 2 * horiz_padding;
|
||||
if (button->backend->max_icon_size) {
|
||||
icon_w = MIN(icon_w, button->backend->max_icon_size);
|
||||
icon_h = MIN(icon_h, button->backend->max_icon_size);
|
||||
icon_w = MIN(icon_w, button->backend->max_icon_size * panel->scale);
|
||||
icon_h = MIN(icon_h, button->backend->max_icon_size * panel->scale);
|
||||
}
|
||||
} else {
|
||||
icon_h = icon_w = 0;
|
||||
|
@ -381,7 +383,8 @@ gboolean resize_button(void *obj)
|
|||
strlen(button->backend->text),
|
||||
PANGO_WRAP_WORD_CHAR,
|
||||
PANGO_ELLIPSIZE_NONE,
|
||||
FALSE);
|
||||
FALSE,
|
||||
panel->scale);
|
||||
} else {
|
||||
txt_height_ink = txt_height = txt_width = 0;
|
||||
}
|
||||
|
@ -436,6 +439,7 @@ gboolean resize_button(void *obj)
|
|||
void draw_button(void *obj, cairo_t *c)
|
||||
{
|
||||
Button *button = obj;
|
||||
Panel *panel = (Panel *)button->area.panel;
|
||||
|
||||
if (button->frontend->icon) {
|
||||
// Render icon
|
||||
|
@ -457,7 +461,9 @@ void draw_button(void *obj, cairo_t *c)
|
|||
|
||||
// Render text
|
||||
if (button->backend->text) {
|
||||
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, button->backend->font_desc);
|
||||
pango_layout_set_width(layout, (button->frontend->textw + 1) * PANGO_SCALE);
|
||||
|
@ -475,6 +481,7 @@ void draw_button(void *obj, cairo_t *c)
|
|||
panel_config.font_shadow);
|
||||
|
||||
g_object_unref(layout);
|
||||
g_object_unref(context);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -306,6 +306,7 @@ gboolean resize_clock(void *obj)
|
|||
void draw_clock(void *obj, cairo_t *c)
|
||||
{
|
||||
Clock *clock = (Clock *)obj;
|
||||
Panel *panel = (Panel *)clock->area.panel;
|
||||
draw_text_area(&clock->area,
|
||||
c,
|
||||
buf_time,
|
||||
|
@ -314,7 +315,8 @@ void draw_clock(void *obj, cairo_t *c)
|
|||
time2_font_desc,
|
||||
clock->time1_posy,
|
||||
clock->time2_posy,
|
||||
&clock->font);
|
||||
&clock->font,
|
||||
panel->scale);
|
||||
}
|
||||
|
||||
void clock_dump_geometry(void *obj, int indent)
|
||||
|
|
|
@ -312,9 +312,9 @@ void execp_compute_icon_text_geometry(Execp *execp,
|
|||
{
|
||||
Panel *panel = (Panel *)execp->area.panel;
|
||||
Area *area = &execp->area;
|
||||
*horiz_padding = (panel_horizontal ? area->paddingxlr : area->paddingy);
|
||||
*vert_padding = (panel_horizontal ? area->paddingy : area->paddingxlr);
|
||||
*interior_padding = area->paddingx;
|
||||
*horiz_padding = (panel_horizontal ? area->paddingxlr : area->paddingy) * panel->scale;
|
||||
*vert_padding = (panel_horizontal ? area->paddingy : area->paddingxlr) * panel->scale;
|
||||
*interior_padding = area->paddingx * panel->scale;
|
||||
|
||||
if (reload_icon(execp)) {
|
||||
if (execp->backend->icon) {
|
||||
|
@ -333,7 +333,7 @@ void execp_compute_icon_text_geometry(Execp *execp,
|
|||
int available_w, available_h;
|
||||
if (panel_horizontal) {
|
||||
available_w = panel->area.width;
|
||||
available_h = area->height - 2 * area->paddingy - left_right_border_width(area);
|
||||
available_h = area->height - 2 * *horiz_padding - left_right_border_width(area);
|
||||
} else {
|
||||
available_w = !text_next_line
|
||||
? area->width - *icon_w - (*icon_w ? *interior_padding : 0) - 2 * *horiz_padding -
|
||||
|
@ -351,7 +351,8 @@ void execp_compute_icon_text_geometry(Execp *execp,
|
|||
strlen(execp->backend->text),
|
||||
PANGO_WRAP_WORD_CHAR,
|
||||
PANGO_ELLIPSIZE_NONE,
|
||||
execp->backend->has_markup);
|
||||
execp->backend->has_markup,
|
||||
panel->scale);
|
||||
|
||||
*resized = FALSE;
|
||||
if (panel_horizontal) {
|
||||
|
@ -476,7 +477,11 @@ gboolean resize_execp(void *obj)
|
|||
void draw_execp(void *obj, cairo_t *c)
|
||||
{
|
||||
Execp *execp = (Execp *)obj;
|
||||
PangoLayout *layout = pango_cairo_create_layout(c);
|
||||
Panel *panel = (Panel *)execp->area.panel;
|
||||
|
||||
PangoContext *context = pango_cairo_create_context(c);
|
||||
pango_cairo_context_set_resolution(context, 96 * panel->scale);
|
||||
PangoLayout *layout = pango_layout_new(context);
|
||||
|
||||
if (execp->backend->has_icon && execp->backend->icon) {
|
||||
imlib_context_set_image(execp->backend->icon);
|
||||
|
@ -504,6 +509,7 @@ void draw_execp(void *obj, cairo_t *c)
|
|||
panel_config.font_shadow);
|
||||
|
||||
g_object_unref(layout);
|
||||
g_object_unref(context);
|
||||
}
|
||||
|
||||
void execp_dump_geometry(void *obj, int indent)
|
||||
|
|
|
@ -65,14 +65,14 @@ void cleanup_freespace(Panel *panel)
|
|||
panel->freespace_list = NULL;
|
||||
}
|
||||
|
||||
int freespace_get_max_size(Panel *p)
|
||||
int freespace_get_max_size(Panel *panel)
|
||||
{
|
||||
if (panel_shrink)
|
||||
return 0;
|
||||
// Get space used by every element except the freespace
|
||||
int size = 0;
|
||||
int spacers = 0;
|
||||
for (GList *walk = p->area.children; walk; walk = g_list_next(walk)) {
|
||||
for (GList *walk = panel->area.children; walk; walk = g_list_next(walk)) {
|
||||
Area *a = (Area *)walk->data;
|
||||
|
||||
if (!a->on_screen)
|
||||
|
@ -83,15 +83,15 @@ int freespace_get_max_size(Panel *p)
|
|||
}
|
||||
|
||||
if (panel_horizontal)
|
||||
size += a->width + p->area.paddingx;
|
||||
size += a->width + panel->area.paddingx * panel->scale;
|
||||
else
|
||||
size += a->height + p->area.paddingy;
|
||||
size += a->height + panel->area.paddingy * panel->scale;
|
||||
}
|
||||
|
||||
if (panel_horizontal)
|
||||
size = p->area.width - size - left_right_border_width(&p->area) - p->area.paddingxlr;
|
||||
size = panel->area.width - size - left_right_border_width(&panel->area) - panel->area.paddingxlr * panel->scale;
|
||||
else
|
||||
size = p->area.height - size - top_bottom_border_width(&p->area) - p->area.paddingxlr;
|
||||
size = panel->area.height - size - top_bottom_border_width(&panel->area) - panel->area.paddingxlr * panel->scale;
|
||||
|
||||
return size / spacers;
|
||||
}
|
||||
|
|
|
@ -112,7 +112,7 @@ void init_launcher_panel(void *p)
|
|||
return;
|
||||
|
||||
// This will be recomputed on resize, we just initialize to a non-zero value
|
||||
launcher->icon_size = launcher_max_icon_size > 0 ? launcher_max_icon_size : 24;
|
||||
launcher->icon_size = launcher_max_icon_size > 0 ? launcher_max_icon_size * panel->scale : 24;
|
||||
|
||||
launcher->area.on_screen = TRUE;
|
||||
schedule_panel_redraw();
|
||||
|
@ -174,11 +174,12 @@ void cleanup_launcher_theme(Launcher *launcher)
|
|||
|
||||
int launcher_compute_icon_size(Launcher *launcher)
|
||||
{
|
||||
Panel *panel = launcher->area.panel;
|
||||
int icon_size = panel_horizontal ? launcher->area.height : launcher->area.width;
|
||||
icon_size = icon_size - MAX(left_right_border_width(&launcher->area), top_bottom_border_width(&launcher->area)) -
|
||||
(2 * launcher->area.paddingy);
|
||||
if (launcher_max_icon_size > 0 && icon_size > launcher_max_icon_size)
|
||||
icon_size = launcher_max_icon_size;
|
||||
(2 * launcher->area.paddingy * panel->scale);
|
||||
if (launcher_max_icon_size)
|
||||
icon_size = MIN(icon_size, launcher_max_icon_size * panel->scale);
|
||||
return icon_size;
|
||||
}
|
||||
|
||||
|
@ -189,6 +190,7 @@ void launcher_compute_geometry(Launcher *launcher,
|
|||
int *icons_per_row,
|
||||
int *margin)
|
||||
{
|
||||
Panel *panel = (Panel*)launcher->area.panel;
|
||||
int count = 0;
|
||||
for (GSList *l = launcher->list_icons; l; l = l->next) {
|
||||
LauncherIcon *launcherIcon = (LauncherIcon *)l->data;
|
||||
|
@ -204,25 +206,25 @@ void launcher_compute_geometry(Launcher *launcher,
|
|||
if (!count) {
|
||||
*size = 0;
|
||||
} else {
|
||||
int height = launcher->area.height - top_bottom_border_width(&launcher->area) - 2 * launcher->area.paddingy;
|
||||
int height = launcher->area.height - top_bottom_border_width(&launcher->area) - 2 * launcher->area.paddingy * panel->scale;
|
||||
// here icons_per_column always higher than 0
|
||||
*icons_per_column = (height + launcher->area.paddingx) / (*icon_size + launcher->area.paddingx);
|
||||
*margin = height - (*icons_per_column - 1) * (*icon_size + launcher->area.paddingx) - *icon_size;
|
||||
*icons_per_column = (height + launcher->area.paddingx * panel->scale) / (*icon_size + launcher->area.paddingx * panel->scale);
|
||||
*margin = height - (*icons_per_column - 1) * (*icon_size + launcher->area.paddingx * panel->scale) - *icon_size;
|
||||
*icons_per_row = count / *icons_per_column + (count % *icons_per_column != 0);
|
||||
*size = left_right_border_width(&launcher->area) + 2 * launcher->area.paddingxlr +
|
||||
(*icon_size * *icons_per_row) + ((*icons_per_row - 1) * launcher->area.paddingx);
|
||||
*size = left_right_border_width(&launcher->area) + 2 * launcher->area.paddingxlr * panel->scale +
|
||||
(*icon_size * *icons_per_row) + ((*icons_per_row - 1) * launcher->area.paddingx * panel->scale);
|
||||
}
|
||||
} else {
|
||||
if (!count) {
|
||||
*size = 0;
|
||||
} else {
|
||||
int width = launcher->area.width - top_bottom_border_width(&launcher->area) - 2 * launcher->area.paddingy;
|
||||
int width = launcher->area.width - top_bottom_border_width(&launcher->area) - 2 * launcher->area.paddingy * panel->scale;
|
||||
// here icons_per_row always higher than 0
|
||||
*icons_per_row = (width + launcher->area.paddingx) / (*icon_size + launcher->area.paddingx);
|
||||
*margin = width - (*icons_per_row - 1) * (*icon_size + launcher->area.paddingx) - *icon_size;
|
||||
*icons_per_row = (width + launcher->area.paddingx * panel->scale) / (*icon_size + launcher->area.paddingx * panel->scale);
|
||||
*margin = width - (*icons_per_row - 1) * (*icon_size + launcher->area.paddingx * panel->scale) - *icon_size;
|
||||
*icons_per_column = count / *icons_per_row + (count % *icons_per_row != 0);
|
||||
*size = top_bottom_border_width(&launcher->area) + 2 * launcher->area.paddingxlr +
|
||||
(*icon_size * *icons_per_column) + ((*icons_per_column - 1) * launcher->area.paddingx);
|
||||
*size = top_bottom_border_width(&launcher->area) + 2 * launcher->area.paddingxlr * panel->scale +
|
||||
(*icon_size * *icons_per_column) + ((*icons_per_column - 1) * launcher->area.paddingx * panel->scale);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -239,6 +241,7 @@ int launcher_compute_desired_size(void *obj)
|
|||
gboolean resize_launcher(void *obj)
|
||||
{
|
||||
Launcher *launcher = (Launcher *)obj;
|
||||
Panel *panel = (Panel*)launcher->area.panel;
|
||||
|
||||
int size, icons_per_column, icons_per_row, margin;
|
||||
launcher_compute_geometry(launcher, &size, &launcher->icon_size, &icons_per_column, &icons_per_row, &margin);
|
||||
|
@ -281,11 +284,11 @@ gboolean resize_launcher(void *obj)
|
|||
int posx, posy;
|
||||
int start;
|
||||
if (panel_horizontal) {
|
||||
posy = start = top_border_width(&launcher->area) + launcher->area.paddingy + margin / 2;
|
||||
posx = left_border_width(&launcher->area) + launcher->area.paddingxlr;
|
||||
posy = start = top_border_width(&launcher->area) + launcher->area.paddingy * panel->scale + margin / 2;
|
||||
posx = left_border_width(&launcher->area) + launcher->area.paddingxlr * panel->scale;
|
||||
} else {
|
||||
posx = start = left_border_width(&launcher->area) + launcher->area.paddingy + margin / 2;
|
||||
posy = top_border_width(&launcher->area) + launcher->area.paddingxlr;
|
||||
posx = start = left_border_width(&launcher->area) + launcher->area.paddingy * panel->scale + margin / 2;
|
||||
posy = top_border_width(&launcher->area) + launcher->area.paddingxlr * panel->scale;
|
||||
}
|
||||
|
||||
int i = 0;
|
||||
|
@ -300,17 +303,17 @@ gboolean resize_launcher(void *obj)
|
|||
// fprintf(stderr, "tint2: launcher %d : %d,%d\n", i, posx, posy);
|
||||
if (panel_horizontal) {
|
||||
if (i % icons_per_column) {
|
||||
posy += launcher->icon_size + launcher->area.paddingx;
|
||||
posy += launcher->icon_size + launcher->area.paddingx * panel->scale;
|
||||
} else {
|
||||
posy = start;
|
||||
posx += (launcher->icon_size + launcher->area.paddingx);
|
||||
posx += (launcher->icon_size + launcher->area.paddingx * panel->scale);
|
||||
}
|
||||
} else {
|
||||
if (i % icons_per_row) {
|
||||
posx += launcher->icon_size + launcher->area.paddingx;
|
||||
posx += launcher->icon_size + launcher->area.paddingx * panel->scale;
|
||||
} else {
|
||||
posx = start;
|
||||
posy += (launcher->icon_size + launcher->area.paddingx);
|
||||
posy += (launcher->icon_size + launcher->area.paddingx * panel->scale);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
10
src/panel.c
10
src/panel.c
|
@ -225,7 +225,7 @@ void init_panel()
|
|||
p->scale = server.monitors[p->monitor].dpi / ui_scale_dpi_ref;
|
||||
else
|
||||
p->scale = 1;
|
||||
fprintf(stderr, "tint2: panel %d uses scale %f\n", i + 1, p->scale);
|
||||
fprintf(stderr, BLUE "tint2: panel %d uses scale %g " RESET "\n", i + 1, p->scale);
|
||||
if (!p->area.bg)
|
||||
p->area.bg = &g_array_index(backgrounds, Background, 0);
|
||||
p->area.parent = p;
|
||||
|
@ -470,9 +470,9 @@ gboolean resize_panel(void *obj)
|
|||
if (!taskbar->area.on_screen)
|
||||
continue;
|
||||
if (panel_horizontal)
|
||||
taskbar->area.width = 2 * taskbar->area.paddingxlr;
|
||||
taskbar->area.width = 2 * taskbar->area.paddingxlr * panel->scale;
|
||||
else
|
||||
taskbar->area.height = 2 * taskbar->area.paddingxlr;
|
||||
taskbar->area.height = 2 * taskbar->area.paddingxlr * panel->scale;
|
||||
if (taskbarname_enabled && taskbar->area.children) {
|
||||
Area *name = (Area *)taskbar->area.children->data;
|
||||
if (name->on_screen) {
|
||||
|
@ -489,9 +489,9 @@ gboolean resize_panel(void *obj)
|
|||
continue;
|
||||
if (!first_child) {
|
||||
if (panel_horizontal)
|
||||
taskbar->area.width += taskbar->area.paddingx;
|
||||
taskbar->area.width += taskbar->area.paddingx * panel->scale;
|
||||
else
|
||||
taskbar->area.height += taskbar->area.paddingy;
|
||||
taskbar->area.height += taskbar->area.paddingy * panel->scale;
|
||||
}
|
||||
first_child = FALSE;
|
||||
}
|
||||
|
|
|
@ -115,31 +115,33 @@ void cleanup_separator()
|
|||
int separator_compute_desired_size(void *obj)
|
||||
{
|
||||
Separator *separator = (Separator *)obj;
|
||||
Panel *panel = (Panel*)separator->area.panel;
|
||||
if (!separator->area.on_screen)
|
||||
return 0;
|
||||
|
||||
if (panel_horizontal)
|
||||
return separator->thickness + 2 * separator->area.paddingxlr + left_right_border_width(&separator->area);
|
||||
return separator->thickness + 2 * separator->area.paddingxlr * panel->scale + left_right_border_width(&separator->area);
|
||||
else
|
||||
return separator->thickness + 2 * separator->area.paddingxlr + top_bottom_border_width(&separator->area);
|
||||
return separator->thickness + 2 * separator->area.paddingxlr * panel->scale + top_bottom_border_width(&separator->area);
|
||||
}
|
||||
|
||||
gboolean resize_separator(void *obj)
|
||||
{
|
||||
Separator *separator = (Separator *)obj;
|
||||
Panel *panel = (Panel*)separator->area.panel;
|
||||
if (!separator->area.on_screen)
|
||||
return FALSE;
|
||||
|
||||
if (panel_horizontal) {
|
||||
separator->area.width =
|
||||
separator->thickness + 2 * separator->area.paddingxlr + left_right_border_width(&separator->area);
|
||||
separator->thickness + 2 * separator->area.paddingxlr * panel->scale + left_right_border_width(&separator->area);
|
||||
separator->length =
|
||||
separator->area.height - 2 * separator->area.paddingy - top_bottom_border_width(&separator->area);
|
||||
separator->area.height - 2 * separator->area.paddingy * panel->scale - top_bottom_border_width(&separator->area);
|
||||
} else {
|
||||
separator->area.height =
|
||||
separator->thickness + 2 * separator->area.paddingxlr + top_bottom_border_width(&separator->area);
|
||||
separator->thickness + 2 * separator->area.paddingxlr * panel->scale + top_bottom_border_width(&separator->area);
|
||||
separator->length =
|
||||
separator->area.width - 2 * separator->area.paddingy - left_right_border_width(&separator->area);
|
||||
separator->area.width - 2 * separator->area.paddingy * panel->scale - left_right_border_width(&separator->area);
|
||||
}
|
||||
|
||||
schedule_redraw(&separator->area);
|
||||
|
|
|
@ -141,11 +141,12 @@ void init_systray_panel(void *p)
|
|||
|
||||
void systray_compute_geometry(int *size)
|
||||
{
|
||||
Panel *panel = (Panel*)systray.area.panel;
|
||||
systray.icon_size = panel_horizontal ? systray.area.height : systray.area.width;
|
||||
systray.icon_size -=
|
||||
MAX(left_right_border_width(&systray.area), top_bottom_border_width(&systray.area)) + 2 * systray.area.paddingy;
|
||||
MAX(left_right_border_width(&systray.area), top_bottom_border_width(&systray.area)) + 2 * systray.area.paddingy * panel->scale;
|
||||
if (systray_max_icon_size > 0)
|
||||
systray.icon_size = MIN(systray.icon_size, systray_max_icon_size);
|
||||
systray.icon_size = MIN(systray.icon_size, systray_max_icon_size * panel->scale);
|
||||
|
||||
int count = 0;
|
||||
for (GSList *l = systray.list_icons; l; l = l->next) {
|
||||
|
@ -153,24 +154,24 @@ void systray_compute_geometry(int *size)
|
|||
}
|
||||
|
||||
if (panel_horizontal) {
|
||||
int height = systray.area.height - top_bottom_border_width(&systray.area) - 2 * systray.area.paddingy;
|
||||
int height = systray.area.height - top_bottom_border_width(&systray.area) - 2 * systray.area.paddingy * panel->scale;
|
||||
// here icons_per_column always higher than 0
|
||||
systray.icons_per_column = (height + systray.area.paddingx) / (systray.icon_size + systray.area.paddingx);
|
||||
systray.icons_per_column = (height + systray.area.paddingx * panel->scale) / (systray.icon_size + systray.area.paddingx * panel->scale);
|
||||
systray.margin =
|
||||
height - (systray.icons_per_column - 1) * (systray.icon_size + systray.area.paddingx) - systray.icon_size;
|
||||
height - (systray.icons_per_column - 1) * (systray.icon_size + systray.area.paddingx * panel->scale) - systray.icon_size;
|
||||
systray.icons_per_row = count / systray.icons_per_column + (count % systray.icons_per_column != 0);
|
||||
*size = left_right_border_width(&systray.area) + 2 * systray.area.paddingxlr +
|
||||
(systray.icon_size * systray.icons_per_row) + ((systray.icons_per_row - 1) * systray.area.paddingx);
|
||||
*size = left_right_border_width(&systray.area) + 2 * systray.area.paddingxlr * panel->scale +
|
||||
(systray.icon_size * systray.icons_per_row) + ((systray.icons_per_row - 1) * systray.area.paddingx * panel->scale);
|
||||
} else {
|
||||
int width = systray.area.width - left_right_border_width(&systray.area) - 2 * systray.area.paddingy;
|
||||
int width = systray.area.width - left_right_border_width(&systray.area) - 2 * systray.area.paddingy * panel->scale;
|
||||
// here icons_per_row always higher than 0
|
||||
systray.icons_per_row = (width + systray.area.paddingx) / (systray.icon_size + systray.area.paddingx);
|
||||
systray.icons_per_row = (width + systray.area.paddingx * panel->scale) / (systray.icon_size + systray.area.paddingx * panel->scale);
|
||||
systray.margin =
|
||||
width - (systray.icons_per_row - 1) * (systray.icon_size + systray.area.paddingx) - systray.icon_size;
|
||||
width - (systray.icons_per_row - 1) * (systray.icon_size + systray.area.paddingx * panel->scale) - systray.icon_size;
|
||||
systray.icons_per_column = count / systray.icons_per_row + (count % systray.icons_per_row != 0);
|
||||
*size = top_bottom_border_width(&systray.area) + (2 * systray.area.paddingxlr) +
|
||||
*size = top_bottom_border_width(&systray.area) + (2 * systray.area.paddingxlr * panel->scale) +
|
||||
(systray.icon_size * systray.icons_per_column) +
|
||||
((systray.icons_per_column - 1) * systray.area.paddingx);
|
||||
((systray.icons_per_column - 1) * systray.area.paddingx * panel->scale);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -281,13 +282,13 @@ void on_change_systray(void *obj)
|
|||
int posx, posy;
|
||||
int start;
|
||||
if (panel_horizontal) {
|
||||
posy = start = top_border_width(&panel->area) + panel->area.paddingy + top_border_width(&systray.area) +
|
||||
systray.area.paddingy + systray.margin / 2;
|
||||
posx = systray.area.posx + left_border_width(&systray.area) + systray.area.paddingxlr;
|
||||
posy = start = top_border_width(&panel->area) + panel->area.paddingy * panel->scale + top_border_width(&systray.area) +
|
||||
systray.area.paddingy * panel->scale + systray.margin / 2;
|
||||
posx = systray.area.posx + left_border_width(&systray.area) + systray.area.paddingxlr * panel->scale;
|
||||
} else {
|
||||
posx = start = left_border_width(&panel->area) + panel->area.paddingy + left_border_width(&systray.area) +
|
||||
systray.area.paddingy + systray.margin / 2;
|
||||
posy = systray.area.posy + top_border_width(&systray.area) + systray.area.paddingxlr;
|
||||
posx = start = left_border_width(&panel->area) + panel->area.paddingy * panel->scale + left_border_width(&systray.area) +
|
||||
systray.area.paddingy * panel->scale + systray.margin / 2;
|
||||
posy = systray.area.posy + top_border_width(&systray.area) + systray.area.paddingxlr * panel->scale;
|
||||
}
|
||||
|
||||
TrayWindow *traywin;
|
||||
|
@ -312,17 +313,17 @@ void on_change_systray(void *obj)
|
|||
traywin->height = systray.icon_size;
|
||||
if (panel_horizontal) {
|
||||
if (i % systray.icons_per_column) {
|
||||
posy += systray.icon_size + systray.area.paddingx;
|
||||
posy += systray.icon_size + systray.area.paddingx * panel->scale;
|
||||
} else {
|
||||
posy = start;
|
||||
posx += (systray.icon_size + systray.area.paddingx);
|
||||
posx += (systray.icon_size + systray.area.paddingx * panel->scale);
|
||||
}
|
||||
} else {
|
||||
if (i % systray.icons_per_row) {
|
||||
posx += systray.icon_size + systray.area.paddingx;
|
||||
posx += systray.icon_size + systray.area.paddingx * panel->scale;
|
||||
} else {
|
||||
posx = start;
|
||||
posy += (systray.icon_size + systray.area.paddingx);
|
||||
posy += (systray.icon_size + systray.area.paddingx * panel->scale);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -429,7 +429,7 @@ void draw_task_icon(Task *task, int text_width)
|
|||
else
|
||||
task->_icon_x = (task->area.width - panel->g_task.icon_size1) / 2;
|
||||
} else {
|
||||
task->_icon_x = left_border_width(&task->area) + task->area.paddingxlr;
|
||||
task->_icon_x = left_border_width(&task->area) + task->area.paddingxlr * panel->scale;
|
||||
}
|
||||
|
||||
// Render
|
||||
|
@ -459,7 +459,9 @@ void draw_task(void *obj, cairo_t *c)
|
|||
|
||||
task->_text_width = 0;
|
||||
if (panel->g_task.has_text) {
|
||||
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, panel->g_task.font_desc);
|
||||
pango_layout_set_text(layout, task->title, -1);
|
||||
|
||||
|
@ -480,6 +482,7 @@ void draw_task(void *obj, cairo_t *c)
|
|||
draw_text(layout, c, panel->g_task.text_posx, task->_text_posy, config_text, panel->font_shadow);
|
||||
|
||||
g_object_unref(layout);
|
||||
g_object_unref(context);
|
||||
}
|
||||
|
||||
if (panel->g_task.has_icon)
|
||||
|
@ -532,7 +535,7 @@ int task_compute_desired_size(void *obj)
|
|||
{
|
||||
Task *task = (Task *)obj;
|
||||
Panel *panel = (Panel *)task->area.panel;
|
||||
int size = panel_horizontal ? panel->g_task.maximum_width : panel->g_task.maximum_height;
|
||||
int size = (panel_horizontal ? panel->g_task.maximum_width : panel->g_task.maximum_height) * panel->scale;
|
||||
return size;
|
||||
}
|
||||
|
||||
|
|
|
@ -238,15 +238,15 @@ void init_taskbar_panel(void *p)
|
|||
panel->g_taskbar.area.resize_needed = 1;
|
||||
panel->g_taskbar.area.on_screen = TRUE;
|
||||
if (panel_horizontal) {
|
||||
panel->g_taskbar.area.posy = top_border_width(&panel->area) + panel->area.paddingy;
|
||||
panel->g_taskbar.area.posy = top_border_width(&panel->area) + panel->area.paddingy * panel->scale;
|
||||
panel->g_taskbar.area.height =
|
||||
panel->area.height - top_bottom_border_width(&panel->area) - 2 * panel->area.paddingy;
|
||||
panel->area.height - top_bottom_border_width(&panel->area) - 2 * panel->area.paddingy * panel->scale;
|
||||
panel->g_taskbar.area_name.posy = panel->g_taskbar.area.posy;
|
||||
panel->g_taskbar.area_name.height = panel->g_taskbar.area.height;
|
||||
} else {
|
||||
panel->g_taskbar.area.posx = left_border_width(&panel->area) + panel->area.paddingy;
|
||||
panel->g_taskbar.area.posx = left_border_width(&panel->area) + panel->area.paddingy * panel->scale;
|
||||
panel->g_taskbar.area.width =
|
||||
panel->area.width - left_right_border_width(&panel->area) - 2 * panel->area.paddingy;
|
||||
panel->area.width - left_right_border_width(&panel->area) - 2 * panel->area.paddingy * panel->scale;
|
||||
panel->g_taskbar.area_name.posx = panel->g_taskbar.area.posx;
|
||||
panel->g_taskbar.area_name.width = panel->g_taskbar.area.width;
|
||||
}
|
||||
|
@ -304,19 +304,19 @@ void init_taskbar_panel(void *p)
|
|||
if (panel_horizontal) {
|
||||
panel->g_task.area.posy = panel->g_taskbar.area.posy +
|
||||
top_bg_border_width(panel->g_taskbar.background[TASKBAR_NORMAL]) +
|
||||
panel->g_taskbar.area.paddingy;
|
||||
panel->g_taskbar.area.paddingy * panel->scale;
|
||||
panel->g_task.area.width = panel->g_task.maximum_width;
|
||||
panel->g_task.area.height = panel->g_taskbar.area.height -
|
||||
top_bottom_bg_border_width(panel->g_taskbar.background[TASKBAR_NORMAL]) -
|
||||
2 * panel->g_taskbar.area.paddingy;
|
||||
2 * panel->g_taskbar.area.paddingy * panel->scale;
|
||||
} else {
|
||||
panel->g_task.area.posx = panel->g_taskbar.area.posx +
|
||||
left_bg_border_width(panel->g_taskbar.background[TASKBAR_NORMAL]) +
|
||||
panel->g_taskbar.area.paddingy;
|
||||
panel->g_taskbar.area.paddingy * panel->scale;
|
||||
panel->g_task.area.width = panel->g_taskbar.area.width -
|
||||
left_right_bg_border_width(panel->g_taskbar.background[TASKBAR_NORMAL]) -
|
||||
2 * panel->g_taskbar.area.paddingy;
|
||||
panel->g_task.area.height = panel->g_task.maximum_height;
|
||||
2 * panel->g_taskbar.area.paddingy * panel->scale;
|
||||
panel->g_task.area.height = panel->g_task.maximum_height * panel->scale;
|
||||
}
|
||||
|
||||
for (int j = 0; j < TASK_STATE_COUNT; ++j) {
|
||||
|
@ -344,17 +344,18 @@ void init_taskbar_panel(void *p)
|
|||
5,
|
||||
PANGO_WRAP_WORD_CHAR,
|
||||
PANGO_ELLIPSIZE_END,
|
||||
FALSE);
|
||||
FALSE,
|
||||
panel->scale);
|
||||
|
||||
panel->g_task.text_posx = left_bg_border_width(panel->g_task.background[0]) + panel->g_task.area.paddingxlr;
|
||||
panel->g_task.text_posx = left_bg_border_width(panel->g_task.background[0]) + panel->g_task.area.paddingxlr * panel->scale;
|
||||
panel->g_task.text_height =
|
||||
panel->g_task.area.height - (2 * panel->g_task.area.paddingy) - top_bottom_border_width(&panel->g_task.area);
|
||||
panel->g_task.area.height - (2 * panel->g_task.area.paddingy * panel->scale) - top_bottom_border_width(&panel->g_task.area);
|
||||
if (panel->g_task.has_icon) {
|
||||
panel->g_task.icon_size1 = MIN(MIN(panel->g_task.maximum_width, panel->g_task.maximum_height),
|
||||
panel->g_task.icon_size1 = MIN(MIN(panel->g_task.maximum_width * panel->scale, panel->g_task.maximum_height * panel->scale),
|
||||
MIN(panel->g_task.area.width, panel->g_task.area.height)) -
|
||||
2 * panel->g_task.area.paddingy - MAX(left_right_border_width(&panel->g_task.area),
|
||||
2 * panel->g_task.area.paddingy * panel->scale - MAX(left_right_border_width(&panel->g_task.area),
|
||||
top_bottom_border_width(&panel->g_task.area));
|
||||
panel->g_task.text_posx += panel->g_task.icon_size1 + panel->g_task.area.paddingx;
|
||||
panel->g_task.text_posx += panel->g_task.icon_size1 + panel->g_task.area.paddingx * panel->scale;
|
||||
panel->g_task.icon_posy = (panel->g_task.area.height - panel->g_task.icon_size1) / 2;
|
||||
}
|
||||
|
||||
|
@ -573,12 +574,12 @@ gboolean resize_taskbar(void *obj)
|
|||
}
|
||||
}
|
||||
taskbar->text_width = text_width - panel->g_task.text_posx - right_border_width(&panel->g_task.area) -
|
||||
panel->g_task.area.paddingxlr;
|
||||
panel->g_task.area.paddingxlr * panel->scale;
|
||||
} else {
|
||||
relayout_with_constraint(&taskbar->area, panel->g_task.maximum_height);
|
||||
relayout_with_constraint(&taskbar->area, panel->g_task.maximum_height * panel->scale);
|
||||
|
||||
taskbar->text_width = taskbar->area.width - (2 * panel->g_taskbar.area.paddingy) - panel->g_task.text_posx -
|
||||
right_border_width(&panel->g_task.area) - panel->g_task.area.paddingxlr;
|
||||
taskbar->text_width = taskbar->area.width - (2 * panel->g_taskbar.area.paddingy * panel->scale) - panel->g_task.text_posx -
|
||||
right_border_width(&panel->g_task.area) - panel->g_task.area.paddingxlr * panel->scale;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
|
|
@ -145,12 +145,13 @@ int taskbarname_compute_desired_size(void *obj)
|
|||
strlen(taskbar_name->name),
|
||||
PANGO_WRAP_WORD_CHAR,
|
||||
PANGO_ELLIPSIZE_NONE,
|
||||
FALSE);
|
||||
FALSE,
|
||||
panel->scale);
|
||||
|
||||
if (panel_horizontal) {
|
||||
return name_width + 2 * taskbar_name->area.paddingxlr + left_right_border_width(&taskbar_name->area);
|
||||
return name_width + 2 * taskbar_name->area.paddingxlr * panel->scale + left_right_border_width(&taskbar_name->area);
|
||||
} else {
|
||||
return name_height + 2 * taskbar_name->area.paddingxlr + top_bottom_border_width(&taskbar_name->area);
|
||||
return name_height + 2 * taskbar_name->area.paddingxlr * panel->scale + top_bottom_border_width(&taskbar_name->area);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -172,7 +173,8 @@ gboolean resize_taskbarname(void *obj)
|
|||
strlen(taskbar_name->name),
|
||||
PANGO_WRAP_WORD_CHAR,
|
||||
PANGO_ELLIPSIZE_NONE,
|
||||
FALSE);
|
||||
FALSE,
|
||||
panel->scale);
|
||||
|
||||
gboolean result = FALSE;
|
||||
int new_size = taskbarname_compute_desired_size(obj);
|
||||
|
@ -195,11 +197,14 @@ gboolean resize_taskbarname(void *obj)
|
|||
void draw_taskbarname(void *obj, cairo_t *c)
|
||||
{
|
||||
TaskbarName *taskbar_name = obj;
|
||||
Panel *panel = (Panel *)taskbar_name->area.panel;
|
||||
Taskbar *taskbar = taskbar_name->area.parent;
|
||||
Color *config_text = (taskbar->desktop == server.desktop) ? &taskbarname_active_font : &taskbarname_font;
|
||||
|
||||
// draw content
|
||||
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, panel_config.taskbarname_font_desc);
|
||||
pango_layout_set_width(layout, taskbar_name->area.width * PANGO_SCALE);
|
||||
pango_layout_set_alignment(layout, PANGO_ALIGN_CENTER);
|
||||
|
@ -213,6 +218,7 @@ void draw_taskbarname(void *obj, cairo_t *c)
|
|||
draw_text(layout, c, 0, taskbar_name->posy, config_text, ((Panel *)taskbar_name->area.panel)->font_shadow);
|
||||
|
||||
g_object_unref(layout);
|
||||
g_object_unref(context);
|
||||
}
|
||||
|
||||
void update_desktop_names()
|
||||
|
|
|
@ -153,7 +153,9 @@ void tooltip_update_geometry()
|
|||
|
||||
cairo_surface_t *cs = cairo_xlib_surface_create(server.display, g_tooltip.window, server.visual, width, height);
|
||||
cairo_t *c = cairo_create(cs);
|
||||
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);
|
||||
PangoRectangle r1, r2;
|
||||
|
@ -161,7 +163,7 @@ void tooltip_update_geometry()
|
|||
pango_layout_get_pixel_extents(layout, &r1, &r2);
|
||||
int max_width = MIN(r2.width * 5, screen_width * 2 / 3);
|
||||
if (g_tooltip.image && cairo_image_surface_get_width(g_tooltip.image) > 0) {
|
||||
max_width = left_right_bg_border_width(g_tooltip.bg) + 2 * g_tooltip.paddingx +
|
||||
max_width = left_right_bg_border_width(g_tooltip.bg) + 2 * g_tooltip.paddingx * panel->scale +
|
||||
cairo_image_surface_get_width(g_tooltip.image);
|
||||
}
|
||||
pango_layout_set_width(layout, max_width * PANGO_SCALE);
|
||||
|
@ -169,12 +171,12 @@ void tooltip_update_geometry()
|
|||
pango_layout_set_text(layout, g_tooltip.tooltip_text ? g_tooltip.tooltip_text : "1234567890abcdef", -1);
|
||||
pango_layout_set_wrap(layout, PANGO_WRAP_WORD);
|
||||
pango_layout_get_pixel_extents(layout, &r1, &r2);
|
||||
width = left_right_bg_border_width(g_tooltip.bg) + 2 * g_tooltip.paddingx + r2.width;
|
||||
height = top_bottom_bg_border_width(g_tooltip.bg) + 2 * g_tooltip.paddingy + r2.height;
|
||||
width = left_right_bg_border_width(g_tooltip.bg) + 2 * g_tooltip.paddingx * panel->scale + r2.width;
|
||||
height = top_bottom_bg_border_width(g_tooltip.bg) + 2 * g_tooltip.paddingy * panel->scale + r2.height;
|
||||
if (g_tooltip.image && cairo_image_surface_get_width(g_tooltip.image) > 0) {
|
||||
width = left_right_bg_border_width(g_tooltip.bg) + 2 * g_tooltip.paddingx +
|
||||
width = left_right_bg_border_width(g_tooltip.bg) + 2 * g_tooltip.paddingx * panel->scale +
|
||||
cairo_image_surface_get_width(g_tooltip.image);
|
||||
height += g_tooltip.paddingy + cairo_image_surface_get_height(g_tooltip.image);
|
||||
height += g_tooltip.paddingy * panel->scale + cairo_image_surface_get_height(g_tooltip.image);
|
||||
}
|
||||
|
||||
if (panel_horizontal && panel_position & BOTTOM)
|
||||
|
@ -187,6 +189,7 @@ void tooltip_update_geometry()
|
|||
x = panel->posx - width;
|
||||
|
||||
g_object_unref(layout);
|
||||
g_object_unref(context);
|
||||
cairo_destroy(c);
|
||||
cairo_surface_destroy(cs);
|
||||
}
|
||||
|
@ -243,6 +246,7 @@ void tooltip_update()
|
|||
tooltip_hide(0);
|
||||
return;
|
||||
}
|
||||
Panel *panel = g_tooltip.panel;
|
||||
|
||||
tooltip_update_geometry();
|
||||
if (just_shown) {
|
||||
|
@ -289,15 +293,15 @@ void tooltip_update()
|
|||
// I do not know why this is the right way, but with the below cairo_move_to it seems to be centered (horiz. and
|
||||
// vert.)
|
||||
cairo_move_to(c,
|
||||
-r1.x / 2 + left_bg_border_width(g_tooltip.bg) + g_tooltip.paddingx,
|
||||
-r1.y / 2 + 1 + top_bg_border_width(g_tooltip.bg) + g_tooltip.paddingy);
|
||||
-r1.x / 2 + left_bg_border_width(g_tooltip.bg) + g_tooltip.paddingx * panel->scale,
|
||||
-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);
|
||||
|
||||
if (g_tooltip.image) {
|
||||
cairo_translate(c,
|
||||
left_bg_border_width(g_tooltip.bg) + g_tooltip.paddingx,
|
||||
height - bottom_bg_border_width(g_tooltip.bg) - g_tooltip.paddingy - cairo_image_surface_get_height(g_tooltip.image));
|
||||
left_bg_border_width(g_tooltip.bg) + g_tooltip.paddingx * panel->scale,
|
||||
height - bottom_bg_border_width(g_tooltip.bg) - g_tooltip.paddingy * panel->scale - cairo_image_surface_get_height(g_tooltip.image));
|
||||
cairo_set_source_surface(c, g_tooltip.image, 0, 0);
|
||||
cairo_paint(c);
|
||||
}
|
||||
|
|
|
@ -950,7 +950,8 @@ void area_compute_text_geometry(Area *area,
|
|||
strlen(line1),
|
||||
PANGO_WRAP_WORD_CHAR,
|
||||
PANGO_ELLIPSIZE_NONE,
|
||||
FALSE);
|
||||
FALSE,
|
||||
((Panel*)area->panel)->scale);
|
||||
else
|
||||
*line1_width = *line1_height_ink = *line1_height = 0;
|
||||
|
||||
|
@ -965,7 +966,8 @@ void area_compute_text_geometry(Area *area,
|
|||
strlen(line2),
|
||||
PANGO_WRAP_WORD_CHAR,
|
||||
PANGO_ELLIPSIZE_NONE,
|
||||
FALSE);
|
||||
FALSE,
|
||||
((Panel*)area->panel)->scale);
|
||||
else
|
||||
*line2_width = *line2_height_ink = *line2_height = 0;
|
||||
}
|
||||
|
@ -1067,12 +1069,16 @@ void draw_text_area(Area *area,
|
|||
PangoFontDescription *line2_font_desc,
|
||||
int line1_posy,
|
||||
int line2_posy,
|
||||
Color *color)
|
||||
Color *color,
|
||||
double scale)
|
||||
{
|
||||
int inner_w, inner_h;
|
||||
area_compute_inner_size(area, &inner_w, &inner_h);
|
||||
|
||||
PangoLayout *layout = pango_cairo_create_layout(c);
|
||||
PangoContext *context = pango_cairo_create_context(c);
|
||||
pango_cairo_context_set_resolution(context, 96 * scale);
|
||||
PangoLayout *layout = pango_layout_new(context);
|
||||
|
||||
pango_layout_set_alignment(layout, PANGO_ALIGN_CENTER);
|
||||
pango_layout_set_wrap(layout, PANGO_WRAP_WORD_CHAR);
|
||||
pango_layout_set_ellipsize(layout, PANGO_ELLIPSIZE_NONE);
|
||||
|
@ -1096,6 +1102,7 @@ void draw_text_area(Area *area,
|
|||
}
|
||||
|
||||
g_object_unref(layout);
|
||||
g_object_unref(context);
|
||||
}
|
||||
|
||||
Area *compute_element_area(Area *area, Element element)
|
||||
|
|
|
@ -299,7 +299,8 @@ void draw_text_area(Area *area,
|
|||
PangoFontDescription *line2_font_desc,
|
||||
int line1_posy,
|
||||
int line2_posy,
|
||||
Color *color);
|
||||
Color *color,
|
||||
double scale);
|
||||
|
||||
int left_border_width(Area *a);
|
||||
int right_border_width(Area *a);
|
||||
|
|
|
@ -934,7 +934,8 @@ void get_text_size2(const PangoFontDescription *font,
|
|||
int text_len,
|
||||
PangoWrapMode wrap,
|
||||
PangoEllipsizeMode ellipsis,
|
||||
gboolean markup)
|
||||
gboolean markup,
|
||||
double scale)
|
||||
{
|
||||
PangoRectangle rect_ink, rect;
|
||||
|
||||
|
@ -945,7 +946,9 @@ void get_text_size2(const PangoFontDescription *font,
|
|||
cairo_image_surface_create(CAIRO_FORMAT_ARGB32, available_height, available_width);
|
||||
cairo_t *c = cairo_create(cs);
|
||||
|
||||
PangoLayout *layout = pango_cairo_create_layout(c);
|
||||
PangoContext *context = pango_cairo_create_context(c);
|
||||
pango_cairo_context_set_resolution(context, 96 * scale);
|
||||
PangoLayout *layout = pango_layout_new(context);
|
||||
pango_layout_set_width(layout, available_width * PANGO_SCALE);
|
||||
pango_layout_set_height(layout, available_height * PANGO_SCALE);
|
||||
pango_layout_set_wrap(layout, wrap);
|
||||
|
@ -964,6 +967,7 @@ void get_text_size2(const PangoFontDescription *font,
|
|||
// fprintf(stderr, "tint2: dimension : %d - %d\n", rect_ink.height, rect.height);
|
||||
|
||||
g_object_unref(layout);
|
||||
g_object_unref(context);
|
||||
cairo_destroy(c);
|
||||
cairo_surface_destroy(cs);
|
||||
}
|
||||
|
|
|
@ -122,7 +122,8 @@ void get_text_size2(const PangoFontDescription *font,
|
|||
int text_len,
|
||||
PangoWrapMode wrap,
|
||||
PangoEllipsizeMode ellipsis,
|
||||
gboolean markup);
|
||||
gboolean markup,
|
||||
double scale);
|
||||
|
||||
void draw_text(PangoLayout *layout, cairo_t *c, int posx, int posy, Color *color, int font_shadow);
|
||||
|
||||
|
|
|
@ -313,10 +313,10 @@ void sort_monitors()
|
|||
|
||||
int compute_dpi(XRRCrtcInfo *crtc, XRROutputInfo *output)
|
||||
{
|
||||
int width = output->mm_width;
|
||||
int height = output->mm_height;
|
||||
int x_res = crtc->width;
|
||||
int y_res = crtc->height;
|
||||
double width = output->mm_width;
|
||||
double height = output->mm_height;
|
||||
double x_res = crtc->width;
|
||||
double y_res = crtc->height;
|
||||
|
||||
if (width > 0 && height > 0) {
|
||||
int dpi_x = x_res / width * 25.4;
|
||||
|
@ -364,7 +364,7 @@ void get_monitors()
|
|||
if (dpi)
|
||||
server.monitors[i_monitor].dpi = dpi;
|
||||
fprintf(stderr,
|
||||
"tint2: xRandr: Linking output %s with crtc %d, resolution %dx%d, DPI %d\n",
|
||||
BLUE "tint2: xRandr: Linking output %s with crtc %d, resolution %dx%d, DPI %d" RESET "\n",
|
||||
output_info->name,
|
||||
i,
|
||||
server.monitors[i_monitor].width,
|
||||
|
|
Loading…
Reference in a new issue