mirror of
https://github.com/awesomeWM/awesome
synced 2024-09-29 17:37:02 +02:00
76ddf235ac
We now have the beginnings of a flexible widget structure for the statusbar. For now, there is no behavioural change, and the interface is a bit crude, but watch this space!
34 lines
766 B
C
34 lines
766 B
C
|
|
#include "widget.h"
|
|
|
|
|
|
void
|
|
calculate_alignments(Widget *widget)
|
|
{
|
|
while (widget){
|
|
printf("%s\n", widget->name);
|
|
if (widget->alignment == AlignFlex){
|
|
widget = widget->next;
|
|
break;
|
|
}
|
|
widget->alignment = AlignLeft;
|
|
widget = widget->next;
|
|
}
|
|
if (widget){
|
|
while (widget){
|
|
widget->alignment = AlignRight;
|
|
widget = widget->next;
|
|
}
|
|
}
|
|
}
|
|
|
|
int
|
|
calculate_offset(int barwidth, int widgetwidth, int offset, int alignment)
|
|
{
|
|
if (alignment == AlignLeft || alignment == AlignFlex)
|
|
return offset;
|
|
else
|
|
return barwidth - offset - widgetwidth;
|
|
}
|
|
|
|
// vim: filetype=c:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99
|