change warn() message and use simply , as strtok delimiter
[awesome.git] / widgets / layoutinfo.c
blob98e047e7684f450955f29b32bd42a6bec5b6da68
1 /*
2 * layoutinfo.c - layout info widget
4 * Copyright © 2007 Aldo Cortesi <aldo@nullcube.com>
5 * Copyright © 2007 Julien Danjou <julien@danjou.info>
6 * Aldo Cortesi <aldo@nullcube.com>
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License along
19 * with this program; if not, write to the Free Software Foundation, Inc.,
20 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
24 #include <confuse.h>
25 #include "widget.h"
26 #include "util.h"
27 #include "tag.h"
29 extern AwesomeConf globalconf;
31 static int
32 layoutinfo_draw(Widget *widget,
33 DrawCtx *ctx,
34 int offset,
35 int used __attribute__ ((unused)))
37 Tag **curtags = get_current_tags(widget->statusbar->screen);
38 widget->location = widget_calculate_offset(widget->statusbar->width,
39 widget->statusbar->height,
40 offset,
41 widget->alignment);
43 widget->width = widget->statusbar->height;
45 draw_image(ctx, widget->location, 0, widget->statusbar->height,
46 curtags[0]->layout->image);
48 p_delete(&curtags);
50 return widget->width;
53 Widget *
54 layoutinfo_new(Statusbar *statusbar, cfg_t* config)
56 Widget *w;
57 w = p_new(Widget, 1);
58 widget_common_new(w, statusbar, config);
59 w->draw = layoutinfo_draw;
60 return w;
63 // vim: filetype=c:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=80