#include "panel.h"
+/* win_to_task_table holds for every Window an array of tasks. Usually the array contains only one
+ element. However for omnipresent windows (windows which are visible in every taskbar) the array
+ contains to every Task* on each panel a pointer (i.e. GPtrArray.len == server.nb_desktop)
+*/
GHashTable* win_to_task_table = 0;
guint win_hash(gconstpointer key) { return (guint)*((Window*)key); }
gboolean win_compare(gconstpointer a, gconstpointer b) { return (*((Window*)a) == *((Window*)b)); }
-
+void free_ptr_array(gpointer data) { g_ptr_array_free(data, 1); }
void init_taskbar()
{
int i, j;
if (win_to_task_table == 0)
- win_to_task_table = g_hash_table_new_full(win_hash, win_compare, free, g_ptr_array_unref);
+ win_to_task_table = g_hash_table_new_full(win_hash, win_compare, free, free_ptr_array);
for (i=0 ; i < nb_panel ; i++) {
panel = &panel1[i];
panel->taskbar = 0;
}
+ if (panel->g_taskbar.bg == 0) {
+ panel->g_taskbar.bg = &g_array_index(backgrounds, Background, 0);
+ panel->g_taskbar.area.bg = panel->g_taskbar.bg;
+ }
+ if (panel->g_taskbar.bg_active == 0)
+ panel->g_taskbar.bg_active = &g_array_index(backgrounds, Background, 0);
+ if (panel->g_task.area.bg == 0)
+ panel->g_task.area.bg = &g_array_index(backgrounds, Background, 0);
+
// taskbar
panel->g_taskbar.area._resize = resize_taskbar;
panel->g_taskbar.area.redraw = 1;
panel->g_task.area._draw_foreground = draw_task;
panel->g_task.area.redraw = 1;
panel->g_task.area.on_screen = 1;
+ if ((panel->g_task.config_asb_mask & (1<<TASK_NORMAL)) == 0) {
+ panel->g_task.alpha[TASK_NORMAL] = 100;
+ panel->g_task.saturation[TASK_NORMAL] = 0;
+ panel->g_task.brightness[TASK_NORMAL] = 0;
+ }
if ((panel->g_task.config_asb_mask & (1<<TASK_ACTIVE)) == 0) {
panel->g_task.alpha[TASK_ACTIVE] = panel->g_task.alpha[TASK_NORMAL];
panel->g_task.saturation[TASK_ACTIVE] = panel->g_task.saturation[TASK_NORMAL];
panel->g_task.saturation[TASK_URGENT] = panel->g_task.saturation[TASK_ACTIVE];
panel->g_task.brightness[TASK_URGENT] = panel->g_task.brightness[TASK_ACTIVE];
}
+ if ((panel->g_task.config_font_mask & (1<<TASK_NORMAL)) == 0) panel->g_task.font[TASK_NORMAL] = (Color){{0, 0, 0}, 0};
if ((panel->g_task.config_font_mask & (1<<TASK_ACTIVE)) == 0) panel->g_task.font[TASK_ACTIVE] = panel->g_task.font[TASK_NORMAL];
if ((panel->g_task.config_font_mask & (1<<TASK_ICONIFIED)) == 0) panel->g_task.font[TASK_ICONIFIED] = panel->g_task.font[TASK_NORMAL];
if ((panel->g_task.config_font_mask & (1<<TASK_URGENT)) == 0) panel->g_task.font[TASK_URGENT] = panel->g_task.font[TASK_ACTIVE];
+ if ((panel->g_task.config_font_mask & (1<<TASK_NORMAL)) == 0) panel->g_task.background[TASK_NORMAL] = &g_array_index(backgrounds, Background, 0);
if ((panel->g_task.config_background_mask & (1<<TASK_ACTIVE)) == 0) panel->g_task.background[TASK_ACTIVE] = panel->g_task.background[TASK_NORMAL];
if ((panel->g_task.config_background_mask & (1<<TASK_ICONIFIED)) == 0) panel->g_task.background[TASK_ICONIFIED] = panel->g_task.background[TASK_NORMAL];
if ((panel->g_task.config_background_mask & (1<<TASK_URGENT)) == 0) panel->g_task.background[TASK_URGENT] = panel->g_task.background[TASK_ACTIVE];
int k;
for (k=0; k<TASK_STATE_COUNT; ++k) {
if (panel->g_task.background[k]->border.rounded > panel->g_task.area.height/2) {
- printf("task%sbackground_id is too big. Please fix your tint2rc\n", k==0 ? "_" : k==1 ? "_active_" : k==2 ? "_iconified_" : "_urgent_");
+ printf("task%sbackground_id has a too large rounded value. Please fix your tint2rc\n", k==0 ? "_" : k==1 ? "_active_" : k==2 ? "_iconified_" : "_urgent_");
g_array_append_val(backgrounds, *panel->g_task.background[k]);
panel->g_task.background[k] = &g_array_index(backgrounds, Background, backgrounds->len-1);
panel->g_task.background[k]->border.rounded = panel->g_task.area.height/2;
tsk = l->data;
if (!tsk->area.on_screen) continue;
tsk->area.posx = x;
- if (tsk->area.width != pixel_width) set_task_redraw(tsk);
+ set_task_redraw(tsk); // always redraw task, because the background could have changed (taskbar_active_id)
tsk->area.width = pixel_width;
if (modulo_width) {
tsk->area.width++;
tsk = l->data;
if (!tsk->area.on_screen) continue;
tsk->area.posy = y;
- if (tsk->area.height != pixel_height) set_task_redraw(tsk);
+ set_task_redraw(tsk); // always redraw task, because the background could have changed (taskbar_active_id)
tsk->area.height = pixel_height;
if (modulo_height) {
tsk->area.height++;