Commit 5b01670a authored by o9000's avatar o9000

Fix lost font setting for desktop name

parent 1f7f1971
......@@ -581,7 +581,7 @@ void add_entry (char *key, char *value)
panel_config.g_taskbar.background_name[TASKBAR_ACTIVE] = &g_array_index(backgrounds, Background, id);
}
else if (strcmp (key, "taskbar_name_font") == 0) {
taskbarname_font_desc = pango_font_description_from_string (value);
panel_config.taskbarname_font_desc = pango_font_description_from_string(value);
}
else if (strcmp (key, "taskbar_name_font_color") == 0) {
extract_values(value, &value1, &value2, &value3);
......
......@@ -140,6 +140,8 @@ void cleanup_panel()
backgrounds = NULL;
pango_font_description_free(panel_config.g_task.font_desc);
panel_config.g_task.font_desc = NULL;
pango_font_description_free(panel_config.taskbarname_font_desc);
panel_config.taskbarname_font_desc = NULL;
}
void init_panel()
......
......@@ -104,6 +104,7 @@ typedef struct {
// while panel->area.list is used to loop over all panel's objects
Taskbar *taskbar;
int nb_desktop;
PangoFontDescription *taskbarname_font_desc;
// --------------------------------------------------
// clock
......
......@@ -54,8 +54,8 @@ void init_taskbarname_panel(void *p)
if (!taskbarname_enabled)
return;
if (!taskbarname_font_desc)
taskbarname_font_desc = pango_font_description_from_string(DEFAULT_FONT);
if (!panel_config.taskbarname_font_desc)
panel_config.taskbarname_font_desc = pango_font_description_from_string(DEFAULT_FONT);
GSList *l, *list = server_get_name_of_desktop();
for (j=0, l=list ; j < panel->nb_desktop ; j++) {
......@@ -106,9 +106,6 @@ void cleanup_taskbarname()
tskbar->area.list = g_list_remove(tskbar->area.list, &tskbar->bar_name);
}
}
pango_font_description_free(taskbarname_font_desc);
taskbarname_font_desc = NULL;
}
......@@ -124,7 +121,7 @@ void draw_taskbarname (void *obj, cairo_t *c)
// draw content
layout = pango_cairo_create_layout (c);
pango_layout_set_font_description (layout, taskbarname_font_desc);
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);
pango_layout_set_text (layout, taskbar_name->name, strlen(taskbar_name->name));
......@@ -147,7 +144,7 @@ int resize_taskbarname(void *obj)
int ret = 0;
taskbar_name->area.redraw = 1;
get_text_size2(taskbarname_font_desc, &name_height_ink, &name_height, &name_width, panel->area.height, panel->area.width, taskbar_name->name, strlen(taskbar_name->name));
get_text_size2(panel_config.taskbarname_font_desc, &name_height_ink, &name_height, &name_width, panel->area.height, panel->area.width, taskbar_name->name, strlen(taskbar_name->name));
if (panel_horizontal) {
int new_size = name_width + (2* (taskbar_name->area.paddingxlr + taskbar_name->area.bg->border.width));
......
......@@ -9,7 +9,6 @@
#include "area.h"
extern int taskbarname_enabled;
extern PangoFontDescription *taskbarname_font_desc;
extern Color taskbarname_font;
extern Color taskbarname_active_font;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment