desktop name second step
git-svn-id: http://tint2.googlecode.com/svn/trunk@599 121b4492-b84c-0410-8b4c-0d4edfb3f3cc
This commit is contained in:
parent
14b6d45761
commit
edc5db91c6
5 changed files with 32 additions and 7 deletions
14
src/config.c
14
src/config.c
|
@ -461,15 +461,21 @@ void add_entry (char *key, char *value)
|
|||
else if (strcmp (key, "taskbar_active_background_id") == 0) {
|
||||
int id = atoi (value);
|
||||
id = (id < backgrounds->len && id >= 0) ? id : 0;
|
||||
panel_config.g_taskbar.background[TASKBAR_ACTIVE] = &g_array_index(backgrounds, Background, id);
|
||||
panel_config.g_taskbar.background_name[TASKBAR_ACTIVE] = &g_array_index(backgrounds, Background, id);
|
||||
}
|
||||
else if (strcmp (key, "taskbar_name") == 0) {
|
||||
taskbarname_enabled = atoi (value);
|
||||
}
|
||||
else if (strcmp (key, "taskbar_name_padding") == 0) {
|
||||
extract_values(value, &value1, &value2, &value3);
|
||||
panel_config.g_taskbar.area_name.paddingxlr = panel_config.g_taskbar.area_name.paddingx = atoi (value1);
|
||||
}
|
||||
else if (strcmp (key, "taskbar_name_background_id") == 0) {
|
||||
int id = atoi (value);
|
||||
id = (id < backgrounds->len && id >= 0) ? id : 0;
|
||||
panel_config.g_taskbar.background_name[TASKBAR_ACTIVE] = &g_array_index(backgrounds, Background, id);
|
||||
panel_config.g_taskbar.background_name[TASKBAR_NORMAL] = &g_array_index(backgrounds, Background, id);
|
||||
if (panel_config.g_taskbar.background_name[TASKBAR_ACTIVE] == 0)
|
||||
panel_config.g_taskbar.background_name[TASKBAR_ACTIVE] = panel_config.g_taskbar.background_name[TASKBAR_NORMAL];
|
||||
}
|
||||
else if (strcmp (key, "taskbar_name_active_background_id") == 0) {
|
||||
int id = atoi (value);
|
||||
|
@ -486,6 +492,10 @@ void add_entry (char *key, char *value)
|
|||
else taskbarname_font.alpha = 0.5;
|
||||
}
|
||||
else if (strcmp (key, "taskbar_name_active_font_color") == 0) {
|
||||
extract_values(value, &value1, &value2, &value3);
|
||||
get_color (value1, taskbarname_active_font.color);
|
||||
if (value2) taskbarname_active_font.alpha = (atoi (value2) / 100.0);
|
||||
else taskbarname_active_font.alpha = 0.5;
|
||||
}
|
||||
|
||||
/* Task */
|
||||
|
|
|
@ -537,8 +537,11 @@ void set_panel_background(Panel *p)
|
|||
for (k=0; k<TASKBAR_STATE_COUNT; ++k) {
|
||||
if (tskbar->state_pix[k]) XFreePixmap(server.dsp, tskbar->state_pix[k]);
|
||||
tskbar->state_pix[k] = 0;
|
||||
if (tskbar->bar_name.state_pix[k]) XFreePixmap(server.dsp, tskbar->bar_name.state_pix[k]);
|
||||
tskbar->bar_name.state_pix[k] = 0;
|
||||
}
|
||||
tskbar->area.pix = 0;
|
||||
tskbar->bar_name.area.pix = 0;
|
||||
l0 = tskbar->area.list;
|
||||
if (taskbarname_enabled) l0 = l0->next;
|
||||
for (; l0 ; l0 = l0->next) {
|
||||
|
|
|
@ -342,6 +342,10 @@ void set_taskbar_state(Taskbar *tskbar, int state)
|
|||
{
|
||||
tskbar->area.bg = panel1[0].g_taskbar.background[state];
|
||||
tskbar->area.pix = tskbar->state_pix[state];
|
||||
if (taskbarname_enabled) {
|
||||
tskbar->bar_name.area.bg = panel1[0].g_taskbar.background_name[state];
|
||||
tskbar->bar_name.area.pix = tskbar->bar_name.state_pix[state];
|
||||
}
|
||||
if (panel_mode != MULTI_DESKTOP) {
|
||||
if (state == TASKBAR_NORMAL)
|
||||
tskbar->area.on_screen = 0;
|
||||
|
@ -351,6 +355,8 @@ void set_taskbar_state(Taskbar *tskbar, int state)
|
|||
if (tskbar->area.on_screen == 1) {
|
||||
if (tskbar->state_pix[state] == 0)
|
||||
tskbar->area.redraw = 1;
|
||||
if (taskbarname_enabled && tskbar->bar_name.state_pix[state] == 0)
|
||||
tskbar->bar_name.area.redraw = 1;
|
||||
if (panel_mode == MULTI_DESKTOP && panel1[0].g_taskbar.background[TASKBAR_NORMAL] != panel1[0].g_taskbar.background[TASKBAR_ACTIVE]) {
|
||||
GSList *l = tskbar->area.list;
|
||||
if (taskbarname_enabled) l = l->next;
|
||||
|
|
|
@ -35,6 +35,7 @@
|
|||
int taskbarname_enabled;
|
||||
PangoFontDescription *taskbarname_font_desc;
|
||||
Color taskbarname_font;
|
||||
Color taskbarname_active_font;
|
||||
|
||||
|
||||
void default_taskbarname()
|
||||
|
@ -92,30 +93,34 @@ void cleanup_taskbarname()
|
|||
void draw_taskbarname (void *obj, cairo_t *c)
|
||||
{
|
||||
Taskbarname *taskbar_name = obj;
|
||||
Taskbar *taskbar = taskbar_name->area.parent;
|
||||
PangoLayout *layout;
|
||||
Color *config_text = (taskbar->desktop == server.desktop) ? &taskbarname_active_font : &taskbarname_font;
|
||||
|
||||
int state = (taskbar->desktop == server.desktop) ? TASKBAR_ACTIVE : TASKBAR_NORMAL;
|
||||
taskbar_name->state_pix[state] = taskbar_name->area.pix;
|
||||
|
||||
// draw content
|
||||
layout = pango_cairo_create_layout (c);
|
||||
|
||||
// draw layout
|
||||
pango_layout_set_font_description (layout, 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));
|
||||
|
||||
cairo_set_source_rgba (c, taskbarname_font.color[0], taskbarname_font.color[1], taskbarname_font.color[2], taskbarname_font.alpha);
|
||||
cairo_set_source_rgba (c, config_text->color[0], config_text->color[1], config_text->color[2], config_text->alpha);
|
||||
|
||||
pango_cairo_update_layout (c, layout);
|
||||
cairo_move_to (c, 0, taskbar_name->posy);
|
||||
pango_cairo_show_layout (c, layout);
|
||||
|
||||
g_object_unref (layout);
|
||||
printf("draw_taskbarname %s ******************************\n", taskbar_name->name);
|
||||
//printf("draw_taskbarname %s ******************************\n", taskbar_name->name);
|
||||
}
|
||||
|
||||
|
||||
int resize_taskbarname(void *obj)
|
||||
{
|
||||
Taskbarname *taskbar_name = (Taskbar*)obj;
|
||||
Taskbarname *taskbar_name = obj;
|
||||
Panel *panel = taskbar_name->area.panel;
|
||||
int name_height, name_width, name_height_ink;
|
||||
int ret = 0;
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
extern int taskbarname_enabled;
|
||||
extern PangoFontDescription *taskbarname_font_desc;
|
||||
extern Color taskbarname_font;
|
||||
extern Color taskbarname_active_font;
|
||||
|
||||
void default_taskbarname();
|
||||
void cleanup_taskbarname();
|
||||
|
|
Loading…
Reference in a new issue