Make "Statusbar statusbar" the in VirtScreen "Statusbar *statusbar". This is
more consistent with the rest of the interface, and will make our life easier when we have mulitiple statusbars per screen.
This commit is contained in:
parent
21fe1add9e
commit
205f2c55ca
|
@ -225,7 +225,7 @@ static void
|
||||||
setup_screen(int screen)
|
setup_screen(int screen)
|
||||||
{
|
{
|
||||||
setup(screen);
|
setup(screen);
|
||||||
statusbar_init(globalconf.display, screen, &globalconf.screens[screen].statusbar,
|
statusbar_init(globalconf.display, screen, globalconf.screens[screen].statusbar,
|
||||||
globalconf.cursor[CurNormal], globalconf.screens[screen].font,
|
globalconf.cursor[CurNormal], globalconf.screens[screen].font,
|
||||||
&globalconf.screens[screen].padding);
|
&globalconf.screens[screen].padding);
|
||||||
}
|
}
|
||||||
|
|
2
client.c
2
client.c
|
@ -292,7 +292,7 @@ client_manage(Window w, XWindowAttributes *wa, int screen)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ScreenInfo *display_info = get_display_info(c->display, c->phys_screen, &globalconf.screens[screen].statusbar, &globalconf.screens[screen].padding);
|
ScreenInfo *display_info = get_display_info(c->display, c->phys_screen, globalconf.screens[screen].statusbar, &globalconf.screens[screen].padding);
|
||||||
|
|
||||||
if(c->x + c->w + 2 * c->border > display_info->x_org + display_info->width)
|
if(c->x + c->w + 2 * c->border > display_info->x_org + display_info->width)
|
||||||
c->x = c->rx = display_info->x_org + display_info->width - c->w - 2 * c->border;
|
c->x = c->rx = display_info->x_org + display_info->width - c->w - 2 * c->border;
|
||||||
|
|
5
config.c
5
config.c
|
@ -562,10 +562,11 @@ config_parse(const char *confpatharg)
|
||||||
cfg_getstr(cfg_colors, "focus_fg"));
|
cfg_getstr(cfg_colors, "focus_fg"));
|
||||||
|
|
||||||
/* Statusbar */
|
/* Statusbar */
|
||||||
virtscreen->statusbar.position = virtscreen->statusbar.dposition =
|
virtscreen->statusbar = p_new(Statusbar, 1);
|
||||||
|
virtscreen->statusbar->position = virtscreen->statusbar->dposition =
|
||||||
statusbar_get_position_from_str(cfg_getstr(cfg_statusbar, "position"));
|
statusbar_get_position_from_str(cfg_getstr(cfg_statusbar, "position"));
|
||||||
|
|
||||||
create_widgets(cfg_statusbar, &virtscreen->statusbar);
|
create_widgets(cfg_statusbar, virtscreen->statusbar);
|
||||||
|
|
||||||
/* Layouts */
|
/* Layouts */
|
||||||
if(cfg_size(cfg_layouts, "layout"))
|
if(cfg_size(cfg_layouts, "layout"))
|
||||||
|
|
2
config.h
2
config.h
|
@ -211,7 +211,7 @@ typedef struct
|
||||||
/** Layout list */
|
/** Layout list */
|
||||||
Layout *layouts;
|
Layout *layouts;
|
||||||
/** Status bar */
|
/** Status bar */
|
||||||
Statusbar statusbar;
|
Statusbar *statusbar;
|
||||||
/** Padding */
|
/** Padding */
|
||||||
Padding padding;
|
Padding padding;
|
||||||
/** Font */
|
/** Font */
|
||||||
|
|
30
event.c
30
event.c
|
@ -71,28 +71,28 @@ handle_event_buttonpress(XEvent * e)
|
||||||
XButtonPressedEvent *ev = &e->xbutton;
|
XButtonPressedEvent *ev = &e->xbutton;
|
||||||
|
|
||||||
for(screen = 0; screen < get_screen_count(e->xany.display); screen++)
|
for(screen = 0; screen < get_screen_count(e->xany.display); screen++)
|
||||||
if(globalconf.screens[screen].statusbar.window == ev->window)
|
if(globalconf.screens[screen].statusbar->window == ev->window)
|
||||||
{
|
{
|
||||||
for(i = 1, tag = globalconf.screens[screen].tags; tag; tag = tag->next, i++)
|
for(i = 1, tag = globalconf.screens[screen].tags; tag; tag = tag->next, i++)
|
||||||
{
|
{
|
||||||
x += textwidth_primitive(e->xany.display, globalconf.screens[screen].font, tag->name);
|
x += textwidth_primitive(e->xany.display, globalconf.screens[screen].font, tag->name);
|
||||||
if(((globalconf.screens[screen].statusbar.position == BarTop
|
if(((globalconf.screens[screen].statusbar->position == BarTop
|
||||||
|| globalconf.screens[screen].statusbar.position == BarBot)
|
|| globalconf.screens[screen].statusbar->position == BarBot)
|
||||||
&& ev->x < x)
|
&& ev->x < x)
|
||||||
|| (globalconf.screens[screen].statusbar.position == BarRight && ev->y < x)
|
|| (globalconf.screens[screen].statusbar->position == BarRight && ev->y < x)
|
||||||
|| (globalconf.screens[screen].statusbar.position == BarLeft && ev->y > globalconf.screens[screen].statusbar.width - x))
|
|| (globalconf.screens[screen].statusbar->position == BarLeft && ev->y > globalconf.screens[screen].statusbar->width - x))
|
||||||
{
|
{
|
||||||
snprintf(arg, sizeof(arg), "%d", i);
|
snprintf(arg, sizeof(arg), "%d", i);
|
||||||
handle_mouse_button_press(screen, ev->button, ev->state, globalconf.buttons.tag, arg);
|
handle_mouse_button_press(screen, ev->button, ev->state, globalconf.buttons.tag, arg);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
x += globalconf.screens[screen].statusbar.txtlayoutwidth;
|
x += globalconf.screens[screen].statusbar->txtlayoutwidth;
|
||||||
if(((globalconf.screens[screen].statusbar.position == BarTop
|
if(((globalconf.screens[screen].statusbar->position == BarTop
|
||||||
|| globalconf.screens[screen].statusbar.position == BarBot)
|
|| globalconf.screens[screen].statusbar->position == BarBot)
|
||||||
&& ev->x < x)
|
&& ev->x < x)
|
||||||
|| (globalconf.screens[screen].statusbar.position == BarRight && ev->y < x)
|
|| (globalconf.screens[screen].statusbar->position == BarRight && ev->y < x)
|
||||||
|| (globalconf.screens[screen].statusbar.position == BarLeft && ev->y > globalconf.screens[screen].statusbar.width - x))
|
|| (globalconf.screens[screen].statusbar->position == BarLeft && ev->y > globalconf.screens[screen].statusbar->width - x))
|
||||||
handle_mouse_button_press(screen, ev->button, ev->state, globalconf.buttons.layout, NULL);
|
handle_mouse_button_press(screen, ev->button, ev->state, globalconf.buttons.layout, NULL);
|
||||||
else
|
else
|
||||||
handle_mouse_button_press(screen, ev->button, ev->state, globalconf.buttons.title, NULL);
|
handle_mouse_button_press(screen, ev->button, ev->state, globalconf.buttons.title, NULL);
|
||||||
|
@ -197,13 +197,13 @@ handle_event_configurenotify(XEvent * e)
|
||||||
|
|
||||||
/* update statusbar */
|
/* update statusbar */
|
||||||
si = get_screen_info(e->xany.display, screen, NULL, &globalconf.screens[screen].padding);
|
si = get_screen_info(e->xany.display, screen, NULL, &globalconf.screens[screen].padding);
|
||||||
globalconf.screens[screen].statusbar.width = si[screen].width;
|
globalconf.screens[screen].statusbar->width = si[screen].width;
|
||||||
p_delete(&si);
|
p_delete(&si);
|
||||||
|
|
||||||
XResizeWindow(e->xany.display,
|
XResizeWindow(e->xany.display,
|
||||||
globalconf.screens[screen].statusbar.window,
|
globalconf.screens[screen].statusbar->window,
|
||||||
globalconf.screens[screen].statusbar.width,
|
globalconf.screens[screen].statusbar->width,
|
||||||
globalconf.screens[screen].statusbar.height);
|
globalconf.screens[screen].statusbar->height);
|
||||||
|
|
||||||
statusbar_update_position(e->xany.display, globalconf.screens[screen].statusbar, &globalconf.screens[screen].padding);
|
statusbar_update_position(e->xany.display, globalconf.screens[screen].statusbar, &globalconf.screens[screen].padding);
|
||||||
arrange(screen);
|
arrange(screen);
|
||||||
|
@ -250,7 +250,7 @@ handle_event_expose(XEvent * e)
|
||||||
|
|
||||||
if(!ev->count)
|
if(!ev->count)
|
||||||
for(screen = 0; screen < get_screen_count(e->xany.display); screen++)
|
for(screen = 0; screen < get_screen_count(e->xany.display); screen++)
|
||||||
if(globalconf.screens[screen].statusbar.window == ev->window)
|
if(globalconf.screens[screen].statusbar->window == ev->window)
|
||||||
statusbar_draw(screen);
|
statusbar_draw(screen);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
8
layout.c
8
layout.c
|
@ -180,7 +180,7 @@ restack(int screen)
|
||||||
if(!(get_current_layout(screen)->arrange == layout_floating))
|
if(!(get_current_layout(screen)->arrange == layout_floating))
|
||||||
{
|
{
|
||||||
wc.stack_mode = Below;
|
wc.stack_mode = Below;
|
||||||
wc.sibling = globalconf.screens[screen].statusbar.window;
|
wc.sibling = globalconf.screens[screen].statusbar->window;
|
||||||
if(!sel->isfloating)
|
if(!sel->isfloating)
|
||||||
{
|
{
|
||||||
XConfigureWindow(sel->display, sel->win, CWSibling | CWStackMode, &wc);
|
XConfigureWindow(sel->display, sel->win, CWSibling | CWStackMode, &wc);
|
||||||
|
@ -280,7 +280,7 @@ maximize(int x, int y, int w, int h, int screen)
|
||||||
void
|
void
|
||||||
uicb_client_togglemax(int screen, char *arg __attribute__ ((unused)))
|
uicb_client_togglemax(int screen, char *arg __attribute__ ((unused)))
|
||||||
{
|
{
|
||||||
ScreenInfo *si = get_screen_info(globalconf.display, screen, &globalconf.screens[screen].statusbar, &globalconf.screens[screen].padding);
|
ScreenInfo *si = get_screen_info(globalconf.display, screen, globalconf.screens[screen].statusbar, &globalconf.screens[screen].padding);
|
||||||
|
|
||||||
maximize(si[screen].x_org, si[screen].y_org,
|
maximize(si[screen].x_org, si[screen].y_org,
|
||||||
si[screen].width - 2 * globalconf.screens[screen].borderpx,
|
si[screen].width - 2 * globalconf.screens[screen].borderpx,
|
||||||
|
@ -293,7 +293,7 @@ void
|
||||||
uicb_client_toggleverticalmax(int screen, char *arg __attribute__ ((unused)))
|
uicb_client_toggleverticalmax(int screen, char *arg __attribute__ ((unused)))
|
||||||
{
|
{
|
||||||
Client *sel = globalconf.focus->client;
|
Client *sel = globalconf.focus->client;
|
||||||
ScreenInfo *si = get_screen_info(globalconf.display, screen, &globalconf.screens[screen].statusbar, &globalconf.screens[screen].padding);
|
ScreenInfo *si = get_screen_info(globalconf.display, screen, globalconf.screens[screen].statusbar, &globalconf.screens[screen].padding);
|
||||||
|
|
||||||
if(sel)
|
if(sel)
|
||||||
maximize(sel->x,
|
maximize(sel->x,
|
||||||
|
@ -309,7 +309,7 @@ void
|
||||||
uicb_client_togglehorizontalmax(int screen, char *arg __attribute__ ((unused)))
|
uicb_client_togglehorizontalmax(int screen, char *arg __attribute__ ((unused)))
|
||||||
{
|
{
|
||||||
Client *sel = globalconf.focus->client;
|
Client *sel = globalconf.focus->client;
|
||||||
ScreenInfo *si = get_screen_info(globalconf.display, screen, &globalconf.screens[screen].statusbar, &globalconf.screens[screen].padding);
|
ScreenInfo *si = get_screen_info(globalconf.display, screen, globalconf.screens[screen].statusbar, &globalconf.screens[screen].padding);
|
||||||
|
|
||||||
if(sel)
|
if(sel)
|
||||||
maximize(si[screen].x_org,
|
maximize(si[screen].x_org,
|
||||||
|
|
|
@ -32,7 +32,7 @@ layout_fibonacci(int screen, int shape)
|
||||||
int n = 0, i = 0, nx, ny, nw, nh;
|
int n = 0, i = 0, nx, ny, nw, nh;
|
||||||
Client *c;
|
Client *c;
|
||||||
ScreenInfo *si = get_screen_info(globalconf.display, screen,
|
ScreenInfo *si = get_screen_info(globalconf.display, screen,
|
||||||
&globalconf.screens[screen].statusbar,
|
globalconf.screens[screen].statusbar,
|
||||||
&globalconf.screens[screen].padding);
|
&globalconf.screens[screen].padding);
|
||||||
|
|
||||||
nx = si[screen].x_org;
|
nx = si[screen].x_org;
|
||||||
|
|
|
@ -30,7 +30,7 @@ void
|
||||||
layout_max(int screen)
|
layout_max(int screen)
|
||||||
{
|
{
|
||||||
Client *c;
|
Client *c;
|
||||||
ScreenInfo *si = get_screen_info(globalconf.display, screen, &globalconf.screens[screen].statusbar, &globalconf.screens[screen].padding);
|
ScreenInfo *si = get_screen_info(globalconf.display, screen, globalconf.screens[screen].statusbar, &globalconf.screens[screen].padding);
|
||||||
|
|
||||||
for(c = globalconf.clients; c; c = c->next)
|
for(c = globalconf.clients; c; c = c->next)
|
||||||
if(IS_TILED(c, screen))
|
if(IS_TILED(c, screen))
|
||||||
|
|
|
@ -103,7 +103,7 @@ _tile(int screen, const Bool right)
|
||||||
Client *c;
|
Client *c;
|
||||||
Tag *curtag = get_current_tag(screen);
|
Tag *curtag = get_current_tag(screen);
|
||||||
|
|
||||||
screens_info = get_screen_info(globalconf.display, screen, &globalconf.screens[screen].statusbar, &globalconf.screens[screen].padding);
|
screens_info = get_screen_info(globalconf.display, screen, globalconf.screens[screen].statusbar, &globalconf.screens[screen].padding);
|
||||||
|
|
||||||
for(n = 0, c = globalconf.clients; c; c = c->next)
|
for(n = 0, c = globalconf.clients; c; c = c->next)
|
||||||
if(IS_TILED(c, screen))
|
if(IS_TILED(c, screen))
|
||||||
|
|
2
mouse.c
2
mouse.c
|
@ -49,7 +49,7 @@ uicb_client_movemouse(int screen, char *arg __attribute__ ((unused)))
|
||||||
else
|
else
|
||||||
restack(screen);
|
restack(screen);
|
||||||
|
|
||||||
si = get_screen_info(c->display, c->screen, &globalconf.screens[screen].statusbar, &globalconf.screens[screen].padding);
|
si = get_screen_info(c->display, c->screen, globalconf.screens[screen].statusbar, &globalconf.screens[screen].padding);
|
||||||
|
|
||||||
ocx = nx = c->x;
|
ocx = nx = c->x;
|
||||||
ocy = ny = c->y;
|
ocy = ny = c->y;
|
||||||
|
|
62
statusbar.c
62
statusbar.c
|
@ -42,57 +42,57 @@ statusbar_draw(int screen)
|
||||||
|
|
||||||
vscreen = globalconf.screens[screen];
|
vscreen = globalconf.screens[screen];
|
||||||
/* don't waste our time */
|
/* don't waste our time */
|
||||||
if(vscreen.statusbar.position == BarOff)
|
if(vscreen.statusbar->position == BarOff)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
DrawCtx *ctx = draw_get_context(globalconf.display, phys_screen,
|
DrawCtx *ctx = draw_get_context(globalconf.display, phys_screen,
|
||||||
vscreen.statusbar.width,
|
vscreen.statusbar->width,
|
||||||
vscreen.statusbar.height);
|
vscreen.statusbar->height);
|
||||||
drawrectangle(ctx,
|
drawrectangle(ctx,
|
||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
vscreen.statusbar.width,
|
vscreen.statusbar->width,
|
||||||
vscreen.statusbar.height,
|
vscreen.statusbar->height,
|
||||||
True,
|
True,
|
||||||
vscreen.colors_normal[ColBG]);
|
vscreen.colors_normal[ColBG]);
|
||||||
for(widget = vscreen.statusbar.widgets; widget; widget = widget->next)
|
for(widget = vscreen.statusbar->widgets; widget; widget = widget->next)
|
||||||
if (widget->alignment == AlignLeft)
|
if (widget->alignment == AlignLeft)
|
||||||
left += widget->draw(widget, ctx, left, (left + right));
|
left += widget->draw(widget, ctx, left, (left + right));
|
||||||
else if (widget->alignment == AlignRight)
|
else if (widget->alignment == AlignRight)
|
||||||
right += widget->draw(widget, ctx, right, (left + right));
|
right += widget->draw(widget, ctx, right, (left + right));
|
||||||
|
|
||||||
for(widget = vscreen.statusbar.widgets; widget; widget = widget->next)
|
for(widget = vscreen.statusbar->widgets; widget; widget = widget->next)
|
||||||
if (widget->alignment == AlignFlex)
|
if (widget->alignment == AlignFlex)
|
||||||
left += widget->draw(widget, ctx, left, (left + right));
|
left += widget->draw(widget, ctx, left, (left + right));
|
||||||
|
|
||||||
if(vscreen.statusbar.position == BarRight ||
|
if(vscreen.statusbar->position == BarRight ||
|
||||||
vscreen.statusbar.position == BarLeft)
|
vscreen.statusbar->position == BarLeft)
|
||||||
{
|
{
|
||||||
Drawable d;
|
Drawable d;
|
||||||
if(vscreen.statusbar.position == BarRight)
|
if(vscreen.statusbar->position == BarRight)
|
||||||
d = draw_rotate(ctx,
|
d = draw_rotate(ctx,
|
||||||
phys_screen,
|
phys_screen,
|
||||||
M_PI_2,
|
M_PI_2,
|
||||||
vscreen.statusbar.height,
|
vscreen.statusbar->height,
|
||||||
0);
|
0);
|
||||||
else
|
else
|
||||||
d = draw_rotate(ctx,
|
d = draw_rotate(ctx,
|
||||||
phys_screen,
|
phys_screen,
|
||||||
- M_PI_2,
|
- M_PI_2,
|
||||||
0,
|
0,
|
||||||
vscreen.statusbar.width);
|
vscreen.statusbar->width);
|
||||||
XCopyArea(globalconf.display, d,
|
XCopyArea(globalconf.display, d,
|
||||||
vscreen.statusbar.window,
|
vscreen.statusbar->window,
|
||||||
DefaultGC(globalconf.display, phys_screen), 0, 0,
|
DefaultGC(globalconf.display, phys_screen), 0, 0,
|
||||||
vscreen.statusbar.height,
|
vscreen.statusbar->height,
|
||||||
vscreen.statusbar.width, 0, 0);
|
vscreen.statusbar->width, 0, 0);
|
||||||
XFreePixmap(globalconf.display, d);
|
XFreePixmap(globalconf.display, d);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
XCopyArea(globalconf.display, ctx->drawable,
|
XCopyArea(globalconf.display, ctx->drawable,
|
||||||
vscreen.statusbar.window,
|
vscreen.statusbar->window,
|
||||||
DefaultGC(globalconf.display, phys_screen), 0, 0,
|
DefaultGC(globalconf.display, phys_screen), 0, 0,
|
||||||
vscreen.statusbar.width, vscreen.statusbar.height, 0, 0);
|
vscreen.statusbar->width, vscreen.statusbar->height, 0, 0);
|
||||||
|
|
||||||
draw_free_context(ctx);
|
draw_free_context(ctx);
|
||||||
XSync(globalconf.display, False);
|
XSync(globalconf.display, False);
|
||||||
|
@ -140,30 +140,30 @@ statusbar_init(Display *disp, int screen, Statusbar *statusbar, Cursor cursor, X
|
||||||
|
|
||||||
calculate_alignments(statusbar->widgets);
|
calculate_alignments(statusbar->widgets);
|
||||||
|
|
||||||
statusbar_update_position(disp, *statusbar, padding);
|
statusbar_update_position(disp, statusbar, padding);
|
||||||
XMapRaised(disp, statusbar->window);
|
XMapRaised(disp, statusbar->window);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
statusbar_update_position(Display *disp, Statusbar statusbar, Padding *padding)
|
statusbar_update_position(Display *disp, Statusbar *statusbar, Padding *padding)
|
||||||
{
|
{
|
||||||
XEvent ev;
|
XEvent ev;
|
||||||
ScreenInfo *si = get_screen_info(disp, statusbar.screen, NULL, padding);
|
ScreenInfo *si = get_screen_info(disp, statusbar->screen, NULL, padding);
|
||||||
|
|
||||||
XMapRaised(disp, statusbar.window);
|
XMapRaised(disp, statusbar->window);
|
||||||
switch (statusbar.position)
|
switch (statusbar->position)
|
||||||
{
|
{
|
||||||
default:
|
default:
|
||||||
XMoveWindow(disp, statusbar.window, si[statusbar.screen].x_org, si[statusbar.screen].y_org);
|
XMoveWindow(disp, statusbar->window, si[statusbar->screen].x_org, si[statusbar->screen].y_org);
|
||||||
break;
|
break;
|
||||||
case BarRight:
|
case BarRight:
|
||||||
XMoveWindow(disp, statusbar.window, si[statusbar.screen].x_org + (si[statusbar.screen].width - statusbar.height), si[statusbar.screen].y_org);
|
XMoveWindow(disp, statusbar->window, si[statusbar->screen].x_org + (si[statusbar->screen].width - statusbar->height), si[statusbar->screen].y_org);
|
||||||
break;
|
break;
|
||||||
case BarBot:
|
case BarBot:
|
||||||
XMoveWindow(disp, statusbar.window, si[statusbar.screen].x_org, si[statusbar.screen].height - statusbar.height);
|
XMoveWindow(disp, statusbar->window, si[statusbar->screen].x_org, si[statusbar->screen].height - statusbar->height);
|
||||||
break;
|
break;
|
||||||
case BarOff:
|
case BarOff:
|
||||||
XUnmapWindow(disp, statusbar.window);
|
XUnmapWindow(disp, statusbar->window);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
p_delete(&si);
|
p_delete(&si);
|
||||||
|
@ -188,10 +188,10 @@ statusbar_get_position_from_str(const char * pos)
|
||||||
void
|
void
|
||||||
uicb_statusbar_toggle(int screen, char *arg __attribute__ ((unused)))
|
uicb_statusbar_toggle(int screen, char *arg __attribute__ ((unused)))
|
||||||
{
|
{
|
||||||
if(globalconf.screens[screen].statusbar.position == BarOff)
|
if(globalconf.screens[screen].statusbar->position == BarOff)
|
||||||
globalconf.screens[screen].statusbar.position = (globalconf.screens[screen].statusbar.dposition == BarOff) ? BarTop : globalconf.screens[screen].statusbar.dposition;
|
globalconf.screens[screen].statusbar->position = (globalconf.screens[screen].statusbar->dposition == BarOff) ? BarTop : globalconf.screens[screen].statusbar->dposition;
|
||||||
else
|
else
|
||||||
globalconf.screens[screen].statusbar.position = BarOff;
|
globalconf.screens[screen].statusbar->position = BarOff;
|
||||||
statusbar_update_position(globalconf.display, globalconf.screens[screen].statusbar, &globalconf.screens[screen].padding);
|
statusbar_update_position(globalconf.display, globalconf.screens[screen].statusbar, &globalconf.screens[screen].padding);
|
||||||
arrange(screen);
|
arrange(screen);
|
||||||
}
|
}
|
||||||
|
@ -199,8 +199,8 @@ uicb_statusbar_toggle(int screen, char *arg __attribute__ ((unused)))
|
||||||
void
|
void
|
||||||
uicb_statusbar_set_position(int screen, char *arg)
|
uicb_statusbar_set_position(int screen, char *arg)
|
||||||
{
|
{
|
||||||
globalconf.screens[screen].statusbar.dposition =
|
globalconf.screens[screen].statusbar->dposition =
|
||||||
globalconf.screens[screen].statusbar.position =
|
globalconf.screens[screen].statusbar->position =
|
||||||
statusbar_get_position_from_str(arg);
|
statusbar_get_position_from_str(arg);
|
||||||
statusbar_update_position(globalconf.display, globalconf.screens[screen].statusbar, &globalconf.screens[screen].padding);
|
statusbar_update_position(globalconf.display, globalconf.screens[screen].statusbar, &globalconf.screens[screen].padding);
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,7 +27,7 @@
|
||||||
void statusbar_init(Display *, int, Statusbar *, Cursor, XftFont *, Padding *);
|
void statusbar_init(Display *, int, Statusbar *, Cursor, XftFont *, Padding *);
|
||||||
void statusbar_draw(int);
|
void statusbar_draw(int);
|
||||||
int statusbar_get_position_from_str(const char *);
|
int statusbar_get_position_from_str(const char *);
|
||||||
void statusbar_update_position(Display *, Statusbar, Padding *);
|
void statusbar_update_position(Display *, Statusbar*, Padding *);
|
||||||
|
|
||||||
UICB_PROTO(uicb_statusbar_toggle);
|
UICB_PROTO(uicb_statusbar_toggle);
|
||||||
UICB_PROTO(uicb_statusbar_set_position);
|
UICB_PROTO(uicb_statusbar_set_position);
|
||||||
|
|
2
widget.c
2
widget.c
|
@ -49,7 +49,7 @@ static Widget *
|
||||||
find_widget(char *name, int screen)
|
find_widget(char *name, int screen)
|
||||||
{
|
{
|
||||||
Widget *widget;
|
Widget *widget;
|
||||||
widget = globalconf.screens[screen].statusbar.widgets;
|
widget = globalconf.screens[screen].statusbar->widgets;
|
||||||
for(; widget; widget = widget->next)
|
for(; widget; widget = widget->next)
|
||||||
if (strcmp(name, widget->name) == 0)
|
if (strcmp(name, widget->name) == 0)
|
||||||
return widget;
|
return widget;
|
||||||
|
|
|
@ -13,15 +13,15 @@ focustitle_draw(Widget *widget, DrawCtx *ctx, int offset, int used)
|
||||||
VirtScreen vscreen = globalconf.screens[widget->statusbar->screen];
|
VirtScreen vscreen = globalconf.screens[widget->statusbar->screen];
|
||||||
Client *sel = focus_get_latest_client_for_tag(widget->statusbar->screen,
|
Client *sel = focus_get_latest_client_for_tag(widget->statusbar->screen,
|
||||||
get_current_tag(widget->statusbar->screen));
|
get_current_tag(widget->statusbar->screen));
|
||||||
int location = calculate_offset(vscreen.statusbar.width,
|
int location = calculate_offset(vscreen.statusbar->width,
|
||||||
0,
|
0,
|
||||||
offset,
|
offset,
|
||||||
widget->alignment);
|
widget->alignment);
|
||||||
|
|
||||||
if(sel)
|
if(sel)
|
||||||
{
|
{
|
||||||
drawtext(ctx, location, 0, vscreen.statusbar.width - used,
|
drawtext(ctx, location, 0, vscreen.statusbar->width - used,
|
||||||
vscreen.statusbar.height, vscreen.font, sel->name,
|
vscreen.statusbar->height, vscreen.font, sel->name,
|
||||||
vscreen.colors_selected[ColFG],
|
vscreen.colors_selected[ColFG],
|
||||||
vscreen.colors_selected[ColBG]);
|
vscreen.colors_selected[ColBG]);
|
||||||
if(sel->isfloating)
|
if(sel->isfloating)
|
||||||
|
@ -31,11 +31,11 @@ focustitle_draw(Widget *widget, DrawCtx *ctx, int offset, int used)
|
||||||
vscreen.colors_selected[ColFG]);
|
vscreen.colors_selected[ColFG]);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
drawtext(ctx, location, 0, vscreen.statusbar.width - used,
|
drawtext(ctx, location, 0, vscreen.statusbar->width - used,
|
||||||
vscreen.statusbar.height, vscreen.font, NULL,
|
vscreen.statusbar->height, vscreen.font, NULL,
|
||||||
vscreen.colors_normal[ColFG],
|
vscreen.colors_normal[ColFG],
|
||||||
vscreen.colors_normal[ColBG]);
|
vscreen.colors_normal[ColBG]);
|
||||||
return vscreen.statusbar.width - used;
|
return vscreen.statusbar->width - used;
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget *
|
Widget *
|
||||||
|
|
|
@ -16,13 +16,13 @@ layoutinfo_draw(Widget *widget,
|
||||||
Layout *l;
|
Layout *l;
|
||||||
for(l = vscreen.layouts ; l; l = l->next)
|
for(l = vscreen.layouts ; l; l = l->next)
|
||||||
width = MAX(width, (textwidth(ctx, vscreen.font, l->symbol)));
|
width = MAX(width, (textwidth(ctx, vscreen.font, l->symbol)));
|
||||||
location = calculate_offset(vscreen.statusbar.width,
|
location = calculate_offset(vscreen.statusbar->width,
|
||||||
width,
|
width,
|
||||||
offset,
|
offset,
|
||||||
widget->alignment);
|
widget->alignment);
|
||||||
drawtext(ctx, location, 0,
|
drawtext(ctx, location, 0,
|
||||||
width,
|
width,
|
||||||
vscreen.statusbar.height,
|
vscreen.statusbar->height,
|
||||||
vscreen.font,
|
vscreen.font,
|
||||||
get_current_layout(widget->statusbar->screen)->symbol,
|
get_current_layout(widget->statusbar->screen)->symbol,
|
||||||
vscreen.colors_normal[ColFG],
|
vscreen.colors_normal[ColFG],
|
||||||
|
|
|
@ -42,7 +42,7 @@ taglist_draw(Widget *widget,
|
||||||
{
|
{
|
||||||
width += textwidth(ctx, vscreen.font, tag->name);
|
width += textwidth(ctx, vscreen.font, tag->name);
|
||||||
}
|
}
|
||||||
location = calculate_offset(vscreen.statusbar.width,
|
location = calculate_offset(vscreen.statusbar->width,
|
||||||
width,
|
width,
|
||||||
offset,
|
offset,
|
||||||
widget->alignment);
|
widget->alignment);
|
||||||
|
@ -56,7 +56,7 @@ taglist_draw(Widget *widget,
|
||||||
else
|
else
|
||||||
colors = vscreen.colors_normal;
|
colors = vscreen.colors_normal;
|
||||||
drawtext(ctx, location + width, 0, w,
|
drawtext(ctx, location + width, 0, w,
|
||||||
vscreen.statusbar.height,
|
vscreen.statusbar->height,
|
||||||
vscreen.font,
|
vscreen.font,
|
||||||
tag->name,
|
tag->name,
|
||||||
colors[ColFG],
|
colors[ColFG],
|
||||||
|
|
|
@ -31,11 +31,11 @@ textbox_draw(Widget *widget, DrawCtx *ctx, int offset,
|
||||||
Data *d;
|
Data *d;
|
||||||
d = (Data*) widget->data;
|
d = (Data*) widget->data;
|
||||||
width = textwidth(ctx, vscreen.font, d->text);
|
width = textwidth(ctx, vscreen.font, d->text);
|
||||||
location = calculate_offset(vscreen.statusbar.width,
|
location = calculate_offset(vscreen.statusbar->width,
|
||||||
width,
|
width,
|
||||||
offset,
|
offset,
|
||||||
widget->alignment);
|
widget->alignment);
|
||||||
drawtext(ctx, location, 0, width, vscreen.statusbar.height,
|
drawtext(ctx, location, 0, width, vscreen.statusbar->height,
|
||||||
vscreen.font, d->text,
|
vscreen.font, d->text,
|
||||||
vscreen.colors_normal[ColFG],
|
vscreen.colors_normal[ColFG],
|
||||||
vscreen.colors_normal[ColBG]);
|
vscreen.colors_normal[ColBG]);
|
||||||
|
|
Loading…
Reference in New Issue