tasklist: stop using client markup

Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
Julien Danjou 2008-07-10 09:31:29 +02:00
parent 015f529928
commit f28b4c07b2
4 changed files with 9 additions and 51 deletions

View File

@ -97,9 +97,9 @@ function mytasklist.label(c)
text = text .. "<bg image=\"@AWESOME_ICON_PATH@/floatingw.png\" align=\"right\"/>"
end
if client.focus_get() == c then
text = text .. " <bg color='"..bg_focus.."'/><span color='"..fg_focus.."'><title/></span> "
text = text .. " <bg color='"..bg_focus.."'/><span color='"..awful.escape(fg_focus).."'>"..c.name.."</span> "
else
text = text .. " <title/> "
text = text .. " "..awful.escape(c.name).." "
end
return text
end

View File

@ -794,46 +794,6 @@ client_updatesizehints(client_t *c)
return size;
}
/** Markup parsing hook.
* For now only substitute <title />
*/
static void
client_markup_on_elem(markup_parser_data_t *p, const char *elem,
const char **names, const char **values)
{
assert(!a_strcmp(elem, "title"));
buffer_add_xmlescaped(&p->text, NONULL(p->priv));
}
/** Parse a markup string which contains special markup sequence relative to a
* client, i.e. its title, etc.
* \param c The client concerned by the markup string.
* \param str The markup string.
* \param len The string length.
*/
char *
client_markup_parse(client_t *c, const char *str, ssize_t len)
{
static char const * const elements[] = { "title", NULL };
markup_parser_data_t p = {
.elements = elements,
.priv = c->name,
.on_element = client_markup_on_elem,
};
char *ret;
markup_parser_data_init(&p);
if(markup_parse(&p, str, len))
ret = buffer_detach(&p.text);
else
ret = a_strdup(str);
markup_parser_data_wipe(&p);
return ret;
}
/** Kill a client via a WM_DELETE_WINDOW request or XKillClient if not
* supported.
* \param c The client to kill.

View File

@ -43,7 +43,6 @@ bool client_updatetitle(client_t *);
void client_saveprops(client_t *);
void client_kill(client_t *);
void client_setfloating(client_t *, bool);
char * client_markup_parse(client_t *, const char *, ssize_t);
void client_setborder(client_t *, int);
int luaA_client_newindex(lua_State *);

View File

@ -20,7 +20,6 @@
*/
#include "widget.h"
#include "client.h"
#include "focus.h"
#include "ewmh.h"
#include "tag.h"
@ -114,8 +113,7 @@ tasklist_draw(draw_context_t *ctx, int screen,
client_t *c;
tasklist_data_t *d = w->widget->data;
area_t area;
char *text;
const char *buf;
const char *text;
int n = 0, i = 0, box_width = 0, icon_width = 0, box_width_rest = 0;
netwm_icon_t *icon;
draw_image_t *image;
@ -152,10 +150,7 @@ tasklist_draw(draw_context_t *ctx, int screen,
luaA_dofunction(globalconf.L, d->label, 1, 1);
if(lua_isstring(globalconf.L, -1))
{
buf = lua_tolstring(globalconf.L, -1, &len);
text = client_markup_parse(c, buf, len);
}
text = lua_tolstring(globalconf.L, -1, &len);
else
text = NULL;
@ -217,7 +212,6 @@ tasklist_draw(draw_context_t *ctx, int screen,
draw_text(ctx, globalconf.font, area, text, NULL);
p_delete(&text);
i++;
}
@ -281,6 +275,11 @@ tasklist_button_press(widget_node_t *w,
* \param L The Lua VM state.
* \param token The key token.
* \return The number of elements pushed on stack.
* \luastack
* \lfield show_icons Show icons near client title.
* \lfield show Which windows to show: all, tags, focus.
* \lfield label Function used to get the string to display as the window title.
* It gets the client as argument, and must return a string.
*/
static int
luaA_tasklist_index(lua_State *L, awesome_token_t token)