2 * layoutinfo.c - layout info widget
4 * Copyright © 2007 Aldo Cortesi <aldo@nullcube.com>
5 * Copyright © 2007-2008 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.
28 extern AwesomeConf globalconf
;
31 layoutinfo_draw(Widget
*widget
,
34 int used
__attribute__ ((unused
)))
36 Tag
**curtags
= get_current_tags(widget
->statusbar
->screen
);
37 Area area
= draw_get_image_size(curtags
[0]->layout
->image
);
39 if(!widget
->user_supplied_x
)
40 widget
->area
.x
= widget_calculate_offset(widget
->statusbar
->width
,
41 widget
->statusbar
->height
,
45 if(!widget
->user_supplied_y
)
48 widget
->area
.width
= ((double) widget
->statusbar
->height
/ (double) area
.height
) * area
.width
;;
49 widget
->area
.height
= widget
->statusbar
->height
;
51 draw_image(ctx
, widget
->area
.x
, widget
->area
.y
,
52 widget
->statusbar
->height
,
53 curtags
[0]->layout
->image
);
57 return widget
->area
.width
;
61 layoutinfo_new(Statusbar
*statusbar
, cfg_t
* config
)
65 widget_common_new(w
, statusbar
, config
);
66 w
->draw
= layoutinfo_draw
;
68 /* Set cache property */
69 w
->cache
.flags
= WIDGET_CACHE_LAYOUTS
;
74 // vim: filetype=c:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=80