fixed icon on 64 bit system by benjaminfranzke
git-svn-id: http://tint2.googlecode.com/svn/trunk@151 121b4492-b84c-0410-8b4c-0d4edfb3f3cc
This commit is contained in:
parent
54188b9c0c
commit
5017fae290
4 changed files with 146 additions and 148 deletions
|
@ -1,3 +1,6 @@
|
|||
2009-07-26
|
||||
- fixed icon on 64 bit system by benjaminfranzke
|
||||
|
||||
2009-07-19
|
||||
- fixed systray crash by mart1987
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# -*- Autoconf -*-
|
||||
# Process this file with autoconf to produce a configure script.
|
||||
AC_INIT([tint2], [0.7], [http://code.google.com/p/tint2/issues])
|
||||
AC_INIT([tint2], [0.7.1], [http://code.google.com/p/tint2/issues])
|
||||
|
||||
LT_INIT
|
||||
AM_INIT_AUTOMAKE
|
||||
|
|
|
@ -128,7 +128,6 @@ void remove_task (Task *tsk)
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -187,8 +186,17 @@ void get_icon (Task *tsk)
|
|||
|
||||
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));
|
||||
// DATA32 is provided by imlib2
|
||||
tsk->icon_data = malloc (w * h * sizeof (DATA32));
|
||||
|
||||
#ifdef __x86_64__
|
||||
int length = tsk->icon_width * tsk->icon_height;
|
||||
int i;
|
||||
for (i = 0; i < length; ++i)
|
||||
tsk->icon_data[i] = tmp_data[i];
|
||||
#else
|
||||
memcpy (tsk->icon_data, tmp_data, w * h * sizeof (DATA32));
|
||||
#endif
|
||||
|
||||
XFree (data);
|
||||
}
|
||||
|
@ -216,8 +224,8 @@ void get_icon (Task *tsk)
|
|||
}
|
||||
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));
|
||||
tsk->icon_data = malloc (tsk->icon_width * tsk->icon_height * sizeof (DATA32));
|
||||
memcpy (tsk->icon_data, data, tsk->icon_width * tsk->icon_height * sizeof (DATA32));
|
||||
imlib_free_image();
|
||||
}
|
||||
XFree(hints);
|
||||
|
@ -248,19 +256,7 @@ void draw_task_icon (Task *tsk, int text_width, int active)
|
|||
Imlib_Color_Modifier cmod;
|
||||
DATA8 red[256], green[256], blue[256], alpha[256];
|
||||
|
||||
// TODO: cpu improvement : compute only when icon changed
|
||||
DATA32 *data;
|
||||
/* do we have 64bit? => long = 8bit */
|
||||
if (sizeof(long) != 4) {
|
||||
int length = tsk->icon_width * tsk->icon_height;
|
||||
data = malloc(sizeof(DATA32) * length);
|
||||
int i;
|
||||
for (i = 0; i < length; ++i)
|
||||
data[i] = tsk->icon_data[i];
|
||||
}
|
||||
else data = (DATA32 *) tsk->icon_data;
|
||||
|
||||
icon = imlib_create_image_using_data (tsk->icon_width, tsk->icon_height, data);
|
||||
icon = imlib_create_image_using_data (tsk->icon_width, tsk->icon_height, tsk->icon_data);
|
||||
imlib_context_set_image (icon);
|
||||
imlib_context_set_drawable (*pmap);
|
||||
|
||||
|
@ -280,7 +276,6 @@ void draw_task_icon (Task *tsk, int text_width, int active)
|
|||
|
||||
imlib_free_color_modifier ();
|
||||
imlib_free_image ();
|
||||
if (sizeof(long) != 4) free(data);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -43,7 +43,7 @@ typedef struct {
|
|||
// TODO: group task with list of windows here
|
||||
Window win;
|
||||
int desktop;
|
||||
long *icon_data;
|
||||
unsigned int *icon_data;
|
||||
int icon_width;
|
||||
int icon_height;
|
||||
char *title;
|
||||
|
|
Loading…
Reference in a new issue