[client/tasklist] Reactivate icon drawing with client.icon_set()

Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
Julien Danjou 2008-05-20 22:37:08 +02:00
parent 67598ab859
commit e25434fe25
3 changed files with 18 additions and 4 deletions

View File

@ -1112,6 +1112,18 @@ luaA_client_tostring(lua_State *L)
return 1;
}
static int
luaA_client_icon_set(lua_State *L)
{
client_t **c = luaL_checkudata(L, 1, "client");
const char *icon = luaL_optstring(L, 2, NULL);
p_delete(&(*c)->icon_path);
(*c)->icon_path = a_strdup(icon);
return 0;
}
const struct luaL_reg awesome_client_methods[] =
{
{ "get", luaA_client_get },
@ -1137,6 +1149,7 @@ const struct luaL_reg awesome_client_meta[] =
{ "redraw", luaA_client_redraw },
{ "floating_set", luaA_client_floating_set },
{ "floating_get", luaA_client_floating_get },
{ "icon_set", luaA_client_icon_set },
{ "__eq", luaA_client_eq },
{ "__tostring", luaA_client_tostring },
{ NULL, NULL }

View File

@ -268,6 +268,8 @@ struct client_t
position_t titlebar_oldposition;
/** Layer in the stacking order */
layer_t layer, oldlayer;
/** Path to an icon */
char *icon_path;
};
typedef struct client_node_t client_node_t;

View File

@ -116,9 +116,9 @@ tasklist_draw(widget_node_t *w, statusbar_t *statusbar, int offset, int used)
draw_rectangle(statusbar->ctx, area, 1.0, true,
statusbar->colors.bg);
if(0)
if(c->icon_path)
{
// area = draw_get_image_size(r->icon);
area = draw_get_image_size(c->icon_path);
if(area.width > 0 && area.height > 0)
{
icon_width = ((double) statusbar->height / (double) area.height) * area.width;
@ -126,8 +126,7 @@ tasklist_draw(widget_node_t *w, statusbar_t *statusbar, int offset, int used)
w->area.x + box_width * i,
w->area.y,
statusbar->height,
NULL);
// r->icon);
c->icon_path);
}
}