fixed issue 14 : no icons
git-svn-id: http://tint2.googlecode.com/svn/trunk@53 121b4492-b84c-0410-8b4c-0d4edfb3f3cc
This commit is contained in:
parent
6c57698291
commit
077590ffce
4 changed files with 32 additions and 18 deletions
|
@ -1,3 +1,6 @@
|
||||||
|
2009-02-12
|
||||||
|
- fixed issue 14 : no icons
|
||||||
|
|
||||||
2009-02-11
|
2009-02-11
|
||||||
- fixed bug with number of desktop changed
|
- fixed bug with number of desktop changed
|
||||||
- fixed clock resize when date changed
|
- fixed clock resize when date changed
|
||||||
|
|
|
@ -79,6 +79,7 @@ void add_task (Window win)
|
||||||
tskbar->area.list = g_slist_append(tskbar->area.list, new_tsk2);
|
tskbar->area.list = g_slist_append(tskbar->area.list, new_tsk2);
|
||||||
|
|
||||||
//printf("add_task panel %d, desktop %d, task %s\n", i, j, new_tsk2->title);
|
//printf("add_task panel %d, desktop %d, task %s\n", i, j, new_tsk2->title);
|
||||||
|
// set_resize (&tskbar->area);
|
||||||
if (resize_tasks (tskbar))
|
if (resize_tasks (tskbar))
|
||||||
set_redraw (&tskbar->area);
|
set_redraw (&tskbar->area);
|
||||||
}
|
}
|
||||||
|
@ -116,7 +117,7 @@ void remove_task (Task *tsk)
|
||||||
l0 = l0->next;
|
l0 = l0->next;
|
||||||
if (win == tsk2->win) {
|
if (win == tsk2->win) {
|
||||||
tskbar->area.list = g_slist_remove(tskbar->area.list, tsk2);
|
tskbar->area.list = g_slist_remove(tskbar->area.list, tsk2);
|
||||||
resize_tasks (tskbar);
|
set_resize (&tskbar->area);
|
||||||
set_redraw (&tskbar->area);
|
set_redraw (&tskbar->area);
|
||||||
|
|
||||||
if (tsk2 == task_active)
|
if (tsk2 == task_active)
|
||||||
|
@ -183,8 +184,7 @@ void get_icon (Task *tsk)
|
||||||
int num;
|
int num;
|
||||||
data = server_get_property (tsk->win, server.atom._NET_WM_ICON, XA_CARDINAL, &num);
|
data = server_get_property (tsk->win, server.atom._NET_WM_ICON, XA_CARDINAL, &num);
|
||||||
if (data) {
|
if (data) {
|
||||||
//printf("get_icon plein\n");
|
// get ARGB icon
|
||||||
// ARGB
|
|
||||||
int w, h;
|
int w, h;
|
||||||
long *tmp_data;
|
long *tmp_data;
|
||||||
tmp_data = get_best_icon (data, get_icon_count (data, num), num, &w, &h, panel->g_task.icon_size1);
|
tmp_data = get_best_icon (data, get_icon_count (data, num), num, &w, &h, panel->g_task.icon_size1);
|
||||||
|
@ -197,13 +197,35 @@ void get_icon (Task *tsk)
|
||||||
XFree (data);
|
XFree (data);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
//printf("get_icon vide\n");
|
// get Pixmap icon
|
||||||
XWMHints *hints = XGetWMHints(server.dsp, tsk->win);
|
XWMHints *hints = XGetWMHints(server.dsp, tsk->win);
|
||||||
if (hints) {
|
if (hints) {
|
||||||
if (hints->flags & IconPixmapHint) {
|
if (hints->flags & IconPixmapHint && hints->icon_pixmap != 0) {
|
||||||
|
// get width, height and depth for the pixmap
|
||||||
|
Window root;
|
||||||
|
int icon_x, icon_y;
|
||||||
|
uint border_width, bpp;
|
||||||
|
uint icon_width, icon_height;
|
||||||
|
|
||||||
|
XGetGeometry(server.dsp, hints->icon_pixmap, &root, &icon_x, &icon_y, &icon_width, &icon_height, &border_width, &bpp);
|
||||||
|
|
||||||
|
//printf(" get_pixmap\n");
|
||||||
|
Imlib_Image img;
|
||||||
|
imlib_context_set_drawable(hints->icon_pixmap);
|
||||||
|
img = imlib_create_image_from_drawable(hints->icon_mask, 0, 0, icon_width, icon_height, 0);
|
||||||
|
imlib_context_set_image(img);
|
||||||
|
unsigned int *data = imlib_image_get_data();
|
||||||
|
if (!data) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
tsk->icon_width = imlib_image_get_width();
|
||||||
|
tsk->icon_height = imlib_image_get_height();
|
||||||
|
tsk->icon_data = malloc (tsk->icon_width * tsk->icon_height * sizeof (long));
|
||||||
|
memcpy (tsk->icon_data, data, tsk->icon_width * tsk->icon_height * sizeof (long));
|
||||||
|
imlib_free_image();
|
||||||
}
|
}
|
||||||
XFree(hints);
|
XFree(hints);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
BIN
src/tint2
BIN
src/tint2
Binary file not shown.
|
@ -12,18 +12,7 @@
|
||||||
* -> systray -> icons
|
* -> systray -> icons
|
||||||
* -> clock
|
* -> clock
|
||||||
*
|
*
|
||||||
* draw_foreground(obj) is virtual function.
|
* draw_foreground(obj) and resize(obj) are virtual function.
|
||||||
*
|
|
||||||
* TODO :
|
|
||||||
* resize_width(obj, width) = 0 : fonction virtuelle à redéfinir
|
|
||||||
* recalcule la largeur de l'objet (car la hauteur est fixe)
|
|
||||||
* - taille systray calculée à partir de la liste des icones
|
|
||||||
* - taille clock calculée à partir de l'heure
|
|
||||||
* - taille d'une tache calculée à partir de la taskbar (ajout, suppression, taille)
|
|
||||||
* - taille d'une taskbar calculée à partir de la taille du panel et des autres objets
|
|
||||||
*
|
|
||||||
* voir resize_taskbar(), resize_clock() et resize_tasks()
|
|
||||||
* voir config(obj) configure un objet (définie les positions verticales)
|
|
||||||
*
|
*
|
||||||
**************************************************************************/
|
**************************************************************************/
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue