add Display as arg
This commit is contained in:
parent
bbe0254393
commit
9f28582820
35
config.c
35
config.c
|
@ -66,25 +66,6 @@ extern const name_func_link_t UicbList[];
|
|||
extern const name_func_link_t WidgetList[];
|
||||
extern const name_func_link_t LayoutList[];
|
||||
|
||||
static unsigned int
|
||||
get_numlockmask(Display *disp)
|
||||
{
|
||||
XModifierKeymap *modmap;
|
||||
unsigned int mask = 0;
|
||||
int i, j;
|
||||
|
||||
modmap = XGetModifierMapping(disp);
|
||||
for(i = 0; i < 8; i++)
|
||||
for(j = 0; j < modmap->max_keypermod; j++)
|
||||
if(modmap->modifiermap[i * modmap->max_keypermod + j]
|
||||
== XKeysymToKeycode(disp, XK_Num_Lock))
|
||||
mask = (1 << i);
|
||||
|
||||
XFreeModifiermap(modmap);
|
||||
|
||||
return mask;
|
||||
}
|
||||
|
||||
/** Lookup for a key mask from its name
|
||||
* \param keyname Key name
|
||||
* \return Key mask or 0 if not found
|
||||
|
@ -331,21 +312,21 @@ config_parse_screen(cfg_t *cfg, int screen)
|
|||
eprint("awesome: cannot init font\n");
|
||||
|
||||
/* Colors */
|
||||
virtscreen->colors_normal[ColBorder] = initxcolor(phys_screen,
|
||||
virtscreen->colors_normal[ColBorder] = initxcolor(globalconf.display, phys_screen,
|
||||
cfg_getstr(cfg_colors, "normal_border"));
|
||||
virtscreen->colors_normal[ColBG] = initxcolor(phys_screen,
|
||||
virtscreen->colors_normal[ColBG] = initxcolor(globalconf.display, phys_screen,
|
||||
cfg_getstr(cfg_colors, "normal_bg"));
|
||||
virtscreen->colors_normal[ColFG] = initxcolor(phys_screen,
|
||||
virtscreen->colors_normal[ColFG] = initxcolor(globalconf.display, phys_screen,
|
||||
cfg_getstr(cfg_colors, "normal_fg"));
|
||||
virtscreen->colors_selected[ColBorder] = initxcolor(phys_screen,
|
||||
virtscreen->colors_selected[ColBorder] = initxcolor(globalconf.display, phys_screen,
|
||||
cfg_getstr(cfg_colors, "focus_border"));
|
||||
virtscreen->colors_selected[ColBG] = initxcolor(phys_screen,
|
||||
virtscreen->colors_selected[ColBG] = initxcolor(globalconf.display, phys_screen,
|
||||
cfg_getstr(cfg_colors, "focus_bg"));
|
||||
virtscreen->colors_selected[ColFG] = initxcolor(phys_screen,
|
||||
virtscreen->colors_selected[ColFG] = initxcolor(globalconf.display, phys_screen,
|
||||
cfg_getstr(cfg_colors, "focus_fg"));
|
||||
virtscreen->colors_urgent[ColBG] = initxcolor(phys_screen,
|
||||
virtscreen->colors_urgent[ColBG] = initxcolor(globalconf.display, phys_screen,
|
||||
cfg_getstr(cfg_colors, "urgent_bg"));
|
||||
virtscreen->colors_urgent[ColFG] = initxcolor(phys_screen,
|
||||
virtscreen->colors_urgent[ColFG] = initxcolor(globalconf.display, phys_screen,
|
||||
cfg_getstr(cfg_colors, "urgent_fg"));
|
||||
|
||||
/* Statusbar */
|
||||
|
|
|
@ -88,12 +88,12 @@ focustitle_new(Statusbar *statusbar, cfg_t *config)
|
|||
w->data = d = p_new(Data, 1);
|
||||
|
||||
if((buf = cfg_getstr(config, "fg")))
|
||||
d->fg = initxcolor(phys_screen, buf);
|
||||
d->fg = initxcolor(globalconf.display, phys_screen, buf);
|
||||
else
|
||||
d->fg = globalconf.screens[statusbar->screen].colors_selected[ColFG];
|
||||
|
||||
if((buf = cfg_getstr(config, "bg")))
|
||||
d->bg = initxcolor(phys_screen, buf);
|
||||
d->bg = initxcolor(globalconf.display, phys_screen, buf);
|
||||
else
|
||||
d->bg = globalconf.screens[statusbar->screen].colors_selected[ColBG];
|
||||
|
||||
|
|
|
@ -181,17 +181,17 @@ graph_new(Statusbar *statusbar, cfg_t *config)
|
|||
/* prevent: division by zero; with a MIN option one day, check for div/0's */
|
||||
d->current_max = d->max = MAX(cfg_getfloat(config, "max"), 0.0001);
|
||||
if((color = cfg_getstr(config, "fg")))
|
||||
d->fg = initxcolor(phys_screen, color);
|
||||
d->fg = initxcolor(globalconf.display, phys_screen, color);
|
||||
else
|
||||
d->fg = globalconf.screens[statusbar->screen].colors_normal[ColFG];
|
||||
|
||||
if((color = cfg_getstr(config, "bg")))
|
||||
d->bg = initxcolor(phys_screen, color);
|
||||
d->bg = initxcolor(globalconf.display, phys_screen, color);
|
||||
else
|
||||
d->bg = globalconf.screens[statusbar->screen].colors_normal[ColBG];
|
||||
|
||||
if((color = cfg_getstr(config, "bordercolor")))
|
||||
d->bordercolor = initxcolor(phys_screen, color);
|
||||
d->bordercolor = initxcolor(globalconf.display, phys_screen, color);
|
||||
else
|
||||
d->bordercolor = d->fg;
|
||||
|
||||
|
|
|
@ -164,17 +164,17 @@ progressbar_new(Statusbar *statusbar, cfg_t *config)
|
|||
cfg = cfg_getnsec(config, "bar", i);
|
||||
|
||||
if((color = cfg_getstr(cfg, "fg")))
|
||||
d->fg[i] = initxcolor(phys_screen, color);
|
||||
d->fg[i] = initxcolor(globalconf.display, phys_screen, color);
|
||||
else
|
||||
d->fg[i] = globalconf.screens[statusbar->screen].colors_normal[ColFG];
|
||||
|
||||
if((color = cfg_getstr(cfg, "bg")))
|
||||
d->bg[i] = initxcolor(phys_screen, color);
|
||||
d->bg[i] = initxcolor(globalconf.display, phys_screen, color);
|
||||
else
|
||||
d->bg[i] = globalconf.screens[statusbar->screen].colors_normal[ColBG];
|
||||
|
||||
if((color = cfg_getstr(cfg, "bordercolor")))
|
||||
d->bordercolor[i] = initxcolor(phys_screen, color);
|
||||
d->bordercolor[i] = initxcolor(globalconf.display, phys_screen, color);
|
||||
else
|
||||
d->bordercolor[i] = d->fg[i];
|
||||
|
||||
|
|
|
@ -222,22 +222,22 @@ tasklist_new(Statusbar *statusbar, cfg_t *config)
|
|||
w->data = d = p_new(Data, 1);
|
||||
|
||||
if((buf = cfg_getstr(config, "fg")))
|
||||
d->fg = initxcolor(phys_screen, buf);
|
||||
d->fg = initxcolor(globalconf.display, phys_screen, buf);
|
||||
else
|
||||
d->fg = globalconf.screens[statusbar->screen].colors_normal[ColFG];
|
||||
|
||||
if((buf = cfg_getstr(config, "bg")))
|
||||
d->bg = initxcolor(phys_screen, buf);
|
||||
d->bg = initxcolor(globalconf.display, phys_screen, buf);
|
||||
else
|
||||
d->bg = globalconf.screens[statusbar->screen].colors_normal[ColBG];
|
||||
|
||||
if((buf = cfg_getstr(config, "focus_bg")))
|
||||
d->bg_sel = initxcolor(phys_screen, buf);
|
||||
d->bg_sel = initxcolor(globalconf.display, phys_screen, buf);
|
||||
else
|
||||
d->bg_sel = globalconf.screens[statusbar->screen].colors_selected[ColBG];
|
||||
|
||||
if((buf = cfg_getstr(config, "focus_fg")))
|
||||
d->fg_sel = initxcolor(phys_screen, buf);
|
||||
d->fg_sel = initxcolor(globalconf.display, phys_screen, buf);
|
||||
else
|
||||
d->fg_sel = globalconf.screens[statusbar->screen].colors_selected[ColFG];
|
||||
|
||||
|
|
|
@ -81,9 +81,9 @@ textbox_tell(Widget *widget, char *command)
|
|||
if (ntok)
|
||||
*ntok = 0;
|
||||
if (!i)
|
||||
d->fg = initxcolor(phys_screen, tok);
|
||||
d->fg = initxcolor(globalconf.display, phys_screen, tok);
|
||||
else
|
||||
d->bg = initxcolor(phys_screen, tok);
|
||||
d->bg = initxcolor(globalconf.display, phys_screen, tok);
|
||||
if (ntok)
|
||||
*ntok = ' ';
|
||||
tok = ntok + (ntok != NULL);
|
||||
|
@ -109,12 +109,12 @@ textbox_new(Statusbar *statusbar, cfg_t *config)
|
|||
w->data = d = p_new(Data, 1);
|
||||
|
||||
if((buf = cfg_getstr(config, "fg")))
|
||||
d->fg = initxcolor(statusbar->screen, buf);
|
||||
d->fg = initxcolor(globalconf.display, statusbar->screen, buf);
|
||||
else
|
||||
d->fg = globalconf.screens[statusbar->screen].colors_normal[ColFG];
|
||||
|
||||
if((buf = cfg_getstr(config, "bg")))
|
||||
d->bg = initxcolor(get_phys_screen(statusbar->screen), buf);
|
||||
d->bg = initxcolor(globalconf.display, get_phys_screen(statusbar->screen), buf);
|
||||
else
|
||||
d->bg = globalconf.screens[statusbar->screen].colors_normal[ColBG];
|
||||
|
||||
|
|
25
xutil.c
25
xutil.c
|
@ -128,12 +128,12 @@ xgettextprop(Window w, Atom atom, char *text, ssize_t textlen)
|
|||
* \param colstr Color specification
|
||||
*/
|
||||
XColor
|
||||
initxcolor(int phys_screen, const char *colstr)
|
||||
initxcolor(Display *disp, int phys_screen, const char *colstr)
|
||||
{
|
||||
XColor screenColor, exactColor;
|
||||
|
||||
if(!XAllocNamedColor(globalconf.display,
|
||||
DefaultColormap(globalconf.display, phys_screen),
|
||||
if(!XAllocNamedColor(disp,
|
||||
DefaultColormap(disp, phys_screen),
|
||||
colstr,
|
||||
&screenColor,
|
||||
&exactColor))
|
||||
|
@ -142,4 +142,23 @@ initxcolor(int phys_screen, const char *colstr)
|
|||
return screenColor;
|
||||
}
|
||||
|
||||
unsigned int
|
||||
get_numlockmask(Display *disp)
|
||||
{
|
||||
XModifierKeymap *modmap;
|
||||
unsigned int mask = 0;
|
||||
int i, j;
|
||||
|
||||
modmap = XGetModifierMapping(disp);
|
||||
for(i = 0; i < 8; i++)
|
||||
for(j = 0; j < modmap->max_keypermod; j++)
|
||||
if(modmap->modifiermap[i * modmap->max_keypermod + j]
|
||||
== XKeysymToKeycode(disp, XK_Num_Lock))
|
||||
mask = (1 << i);
|
||||
|
||||
XFreeModifiermap(modmap);
|
||||
|
||||
return mask;
|
||||
}
|
||||
|
||||
// vim: filetype=c:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=80
|
||||
|
|
Loading…
Reference in New Issue