Clean interface of statusbar_update_position.
This commit is contained in:
parent
10200477c8
commit
51379e065b
2
event.c
2
event.c
|
@ -208,7 +208,7 @@ handle_event_configurenotify(XEvent * e)
|
||||||
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(screen);
|
||||||
arrange(screen);
|
arrange(screen);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
42
statusbar.c
42
statusbar.c
|
@ -172,37 +172,49 @@ statusbar_init(int screen)
|
||||||
|
|
||||||
widget_calculate_alignments(statusbar->widgets);
|
widget_calculate_alignments(statusbar->widgets);
|
||||||
|
|
||||||
statusbar_update_position(globalconf.display,
|
statusbar_update_position(screen);
|
||||||
statusbar,
|
|
||||||
&globalconf.screens[screen].padding);
|
|
||||||
XMapRaised(globalconf.display, statusbar->window);
|
XMapRaised(globalconf.display, statusbar->window);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
statusbar_update_position(Display *disp, Statusbar *statusbar, Padding *padding)
|
statusbar_update_position(int screen)
|
||||||
{
|
{
|
||||||
XEvent ev;
|
XEvent ev;
|
||||||
ScreenInfo *si = get_screen_info(statusbar->screen, NULL, padding);
|
Statusbar *statusbar = globalconf.screens[screen].statusbar;
|
||||||
|
ScreenInfo *si = get_screen_info(statusbar->screen,
|
||||||
|
NULL,
|
||||||
|
&globalconf.screens[screen].padding);
|
||||||
|
|
||||||
XMapRaised(disp, statusbar->window);
|
XMapRaised(globalconf.display, 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(globalconf.display,
|
||||||
|
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(globalconf.display,
|
||||||
|
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(globalconf.display,
|
||||||
|
statusbar->window,
|
||||||
|
si[statusbar->screen].x_org,
|
||||||
|
si[statusbar->screen].height - statusbar->height);
|
||||||
break;
|
break;
|
||||||
case BarOff:
|
case BarOff:
|
||||||
XUnmapWindow(disp, statusbar->window);
|
XUnmapWindow(globalconf.display, statusbar->window);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
p_delete(&si);
|
p_delete(&si);
|
||||||
XSync(disp, False);
|
XSync(globalconf.display, False);
|
||||||
while(XCheckMaskEvent(disp, EnterWindowMask, &ev));
|
while(XCheckMaskEvent(globalconf.display, EnterWindowMask, &ev));
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
|
@ -231,7 +243,7 @@ uicb_statusbar_toggle(int screen, char *arg __attribute__ ((unused)))
|
||||||
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(screen);
|
||||||
arrange(screen);
|
arrange(screen);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -246,9 +258,7 @@ 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,
|
statusbar_update_position(screen);
|
||||||
globalconf.screens[screen].statusbar,
|
|
||||||
&globalconf.screens[screen].padding);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// vim: filetype=c:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=80
|
// vim: filetype=c:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=80
|
||||||
|
|
|
@ -27,7 +27,7 @@
|
||||||
void statusbar_init(int);
|
void statusbar_init(int);
|
||||||
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(int);
|
||||||
|
|
||||||
UICB_PROTO(uicb_statusbar_toggle);
|
UICB_PROTO(uicb_statusbar_toggle);
|
||||||
UICB_PROTO(uicb_statusbar_set_position);
|
UICB_PROTO(uicb_statusbar_set_position);
|
||||||
|
|
Loading…
Reference in New Issue