XSelectInput (server.dsp, new_tsk->win, PropertyChangeMask|StructureNotifyMask);
if (desktop == 0xFFFFFFFF) {
- if (new_tsk->title) XFree (new_tsk->title);
- if (new_tsk->icon_data) XFree (new_tsk->icon_data);
+ if (new_tsk->title) {
+ free (new_tsk->title);
+ new_tsk->title = 0;
+ }
+ if (new_tsk->icon_data) {
+ free (new_tsk->icon_data);
+ new_tsk->icon_data = 0;
+ }
free(new_tsk);
fprintf(stderr, "task on all desktop : ignored\n");
return;
}
-
+
+ //printf("add_task %d %s\n", index(desktop, monitor), new_tsk->title);
Taskbar *tskbar;
- tskbar = g_slist_nth_data(panel.area.list, index(desktop, monitor));
+ tskbar = &panel.taskbar[index(desktop, monitor)];
new_tsk->area.parent = tskbar;
tskbar->area.list = g_slist_append(tskbar->area.list, new_tsk);
- if (resize_tasks (tskbar))
- redraw (&tskbar->area);
+ if (resize_tasks (tskbar))
+ set_redraw (&tskbar->area);
}
tskbar = (Taskbar*)tsk->area.parent;
tskbar->area.list = g_slist_remove(tskbar->area.list, tsk);
resize_tasks (tskbar);
- redraw (&tskbar->area);
+ set_redraw (&tskbar->area);
+ //printf("remove_task %d %s\n", index(tskbar->desktop, tskbar->monitor), tsk->title);
- if (tsk->title) XFree (tsk->title);
- if (tsk->icon_data) XFree (tsk->icon_data);
+ if (tsk->title) {
+ free (tsk->title);
+ tsk->title = 0;
+ }
+ if (tsk->icon_data) {
+ free (tsk->icon_data);
+ tsk->icon_data = 0;
+ }
XFreePixmap (server.dsp, tsk->area.pmap);
XFreePixmap (server.dsp, tsk->area_active.pmap);
free(tsk);
char *title, *name;
- if (tsk->title) free(tsk->title);
-
name = server_get_property (tsk->win, server.atom._NET_WM_VISIBLE_NAME, server.atom.UTF8_STRING, 0);
if (!name || !strlen(name)) {
name = server_get_property (tsk->win, server.atom._NET_WM_NAME, server.atom.UTF8_STRING, 0);
}
// add space before title
- title = malloc(strlen(name)+1);
+ title = malloc(strlen(name)+2);
if (g_task.icon) strcpy(title, " ");
else title[0] = 0;
strcat(title, name);
-
if (name) XFree (name);
+
+ if (tsk->title)
+ free(tsk->title);
tsk->title = title;
}
int num;
data = server_get_property (tsk->win, server.atom._NET_WM_ICON, XA_CARDINAL, &num);
- if (!data) return;
-
- int w, h;
- long *tmp_data;
- tmp_data = get_best_icon (data, get_icon_count (data, num), num, &w, &h, g_task.icon_size1);
-
- tsk->icon_width = w;
- tsk->icon_height = h;
- tsk->icon_data = malloc (w * h * sizeof (long));
- memcpy (tsk->icon_data, tmp_data, w * h * sizeof (long));
-
- XFree (data);
+ if (data) {
+ printf("get_icon plein\n");
+ // ARGB
+ int w, h;
+ long *tmp_data;
+ tmp_data = get_best_icon (data, get_icon_count (data, num), num, &w, &h, g_task.icon_size1);
+
+ tsk->icon_width = w;
+ tsk->icon_height = h;
+ tsk->icon_data = malloc (w * h * sizeof (long));
+ memcpy (tsk->icon_data, tmp_data, w * h * sizeof (long));
+
+ XFree (data);
+ }
+ else {
+ //XWMHints *hints;
+ //hints = XGetWMHints(server.dsp, tkwin);
+ //if (hints != NULL) {
+ // XFree(hints);
+ //}
+ printf("get_icon vide\n");
+ // XChangeProperty (display, windowH, XInternAtom (display, "_NET_WM_ICON", False), XA_CARDINAL, 32, PropModeReplace, (unsigned char*) data, dataSize);
+ return;
+ }
}
}
-int draw_foreground_task (void *obj, cairo_t *c)
+void draw_background_task (void *obj, cairo_t *c)
+{
+ Task *tsk = obj;
+
+ draw_background (&tsk->area_active, c);
+ draw_background (&tsk->area_inactive, c);
+}
+
+
+void draw_foreground_task (void *obj, cairo_t *c)
{
Task *tsk = obj;
cairo_surface_t *cs;
cairo_t *ca;
-
+ //printf(" draw_foreground_task\n");
+
draw_task_title (c, tsk, 0);
// draw active pmap
ca = cairo_create (cs);
// redraw task
- draw_background (&tsk->area_active, ca);
draw_task_title (ca, tsk, 1);
cairo_destroy (ca);
cairo_surface_destroy (cs);
- return 0;
}