move txtlenwidth initlization in initstatusbar()
This commit is contained in:
parent
d75a512f5d
commit
77609263dc
|
@ -200,7 +200,7 @@ setup(awesome_config *awesomeconf)
|
||||||
compileregs(awesomeconf->rules, awesomeconf->nrules);
|
compileregs(awesomeconf->rules, awesomeconf->nrules);
|
||||||
|
|
||||||
/* bar */
|
/* bar */
|
||||||
initstatusbar(awesomeconf->display, awesomeconf->screen, &awesomeconf->statusbar, awesomeconf->cursor[CurNormal], awesomeconf->font);
|
initstatusbar(awesomeconf->display, awesomeconf->screen, &awesomeconf->statusbar, awesomeconf->cursor[CurNormal], awesomeconf->font, awesomeconf->layouts, awesomeconf->nlayouts);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Startup Error handler to check if another window manager
|
/** Startup Error handler to check if another window manager
|
||||||
|
|
6
config.c
6
config.c
|
@ -19,7 +19,6 @@
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \defgroup ui_callback
|
* \defgroup ui_callback
|
||||||
*/
|
*/
|
||||||
|
@ -237,7 +236,7 @@ parse_config(Display * disp, int scr,const char *confpatharg, awesome_config *aw
|
||||||
const char *tmp, *homedir;
|
const char *tmp, *homedir;
|
||||||
char *confpath;
|
char *confpath;
|
||||||
KeySym tmp_key;
|
KeySym tmp_key;
|
||||||
ssize_t confpath_len, txtlen;
|
ssize_t confpath_len;
|
||||||
|
|
||||||
if(confpatharg)
|
if(confpatharg)
|
||||||
confpath = a_strdup(confpatharg);
|
confpath = a_strdup(confpatharg);
|
||||||
|
@ -320,9 +319,6 @@ parse_config(Display * disp, int scr,const char *confpatharg, awesome_config *aw
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
awesomeconf->layouts[i].symbol = a_strdup(cfg_getstr(cfgsectmp, "symbol"));
|
awesomeconf->layouts[i].symbol = a_strdup(cfg_getstr(cfgsectmp, "symbol"));
|
||||||
txtlen = awesomeconf->font->height + textwidth(disp, awesomeconf->font, awesomeconf->layouts[i].symbol, a_strlen(awesomeconf->layouts[i].symbol));
|
|
||||||
if(txtlen > awesomeconf->statusbar.txtlayoutwidth)
|
|
||||||
awesomeconf->statusbar.txtlayoutwidth = txtlen;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
awesomeconf->mwfact = cfg_getfloat(cfg_layouts, "mwfact");
|
awesomeconf->mwfact = cfg_getfloat(cfg_layouts, "mwfact");
|
||||||
|
|
20
statusbar.c
20
statusbar.c
|
@ -177,21 +177,18 @@ drawstatusbar(Display *disp, awesome_config * awesomeconf)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
initstatusbar(Display *disp, int screen, Statusbar *statusbar, Cursor cursor, XftFont *font)
|
initstatusbar(Display *disp, int screen, Statusbar *statusbar, Cursor cursor, XftFont *font, Layout *layouts, int nlayouts)
|
||||||
{
|
{
|
||||||
XSetWindowAttributes wa;
|
XSetWindowAttributes wa;
|
||||||
int phys_screen;
|
int i, phys_screen = get_phys_screen(disp, screen);
|
||||||
ScreenInfo *si;
|
ScreenInfo *si = get_screen_info(disp, screen, NULL);
|
||||||
|
|
||||||
phys_screen = get_phys_screen(disp, screen);
|
|
||||||
|
|
||||||
statusbar->screen = screen;
|
|
||||||
|
|
||||||
si = get_screen_info(disp, screen, NULL);
|
|
||||||
statusbar->width = si[screen].width;
|
statusbar->width = si[screen].width;
|
||||||
statusbar->height = font->height + 2;
|
statusbar->height = font->height + 2;
|
||||||
p_delete(&si);
|
p_delete(&si);
|
||||||
|
|
||||||
|
statusbar->screen = screen;
|
||||||
|
|
||||||
wa.event_mask = SubstructureRedirectMask | SubstructureNotifyMask
|
wa.event_mask = SubstructureRedirectMask | SubstructureNotifyMask
|
||||||
| EnterWindowMask | LeaveWindowMask | StructureNotifyMask;
|
| EnterWindowMask | LeaveWindowMask | StructureNotifyMask;
|
||||||
wa.cursor = cursor;
|
wa.cursor = cursor;
|
||||||
|
@ -202,7 +199,8 @@ initstatusbar(Display *disp, int screen, Statusbar *statusbar, Cursor cursor, Xf
|
||||||
statusbar->width,
|
statusbar->width,
|
||||||
statusbar->height,
|
statusbar->height,
|
||||||
0, DefaultDepth(disp, phys_screen), CopyFromParent,
|
0, DefaultDepth(disp, phys_screen), CopyFromParent,
|
||||||
DefaultVisual(disp, phys_screen), CWOverrideRedirect | CWBackPixmap | CWEventMask, &wa);
|
DefaultVisual(disp, phys_screen),
|
||||||
|
CWOverrideRedirect | CWBackPixmap | CWEventMask, &wa);
|
||||||
XDefineCursor(disp, statusbar->window, cursor);
|
XDefineCursor(disp, statusbar->window, cursor);
|
||||||
updatebarpos(disp, *statusbar);
|
updatebarpos(disp, *statusbar);
|
||||||
XMapRaised(disp, statusbar->window);
|
XMapRaised(disp, statusbar->window);
|
||||||
|
@ -211,6 +209,10 @@ initstatusbar(Display *disp, int screen, Statusbar *statusbar, Cursor cursor, Xf
|
||||||
statusbar->width,
|
statusbar->width,
|
||||||
statusbar->height,
|
statusbar->height,
|
||||||
DefaultDepth(disp, phys_screen));
|
DefaultDepth(disp, phys_screen));
|
||||||
|
|
||||||
|
for(i = 0; i < nlayouts; i++)
|
||||||
|
statusbar->txtlayoutwidth = MAX(statusbar->txtlayoutwidth,
|
||||||
|
(font->height + textwidth(disp, font, layouts[i].symbol, a_strlen(layouts[i].symbol))));
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
|
@ -24,7 +24,7 @@
|
||||||
|
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
|
|
||||||
void initstatusbar(Display *, int, Statusbar *, Cursor, XftFont *);
|
void initstatusbar(Display *, int, Statusbar *, Cursor, XftFont *, Layout *, int);
|
||||||
void drawstatusbar(Display *, awesome_config *);
|
void drawstatusbar(Display *, awesome_config *);
|
||||||
void updatebarpos(Display *, Statusbar);
|
void updatebarpos(Display *, Statusbar);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue