remove some get_phys_screen() calls

This commit is contained in:
Julien Danjou 2008-01-02 17:41:03 +01:00
parent e07af54520
commit 9fc22e9e4e
6 changed files with 33 additions and 30 deletions

View File

@ -202,6 +202,7 @@ setup(int screen)
{
XSetWindowAttributes wa;
Statusbar *statusbar;
int phys_screen = get_phys_screen(screen);
/* init cursors */
globalconf.cursor[CurNormal] = XCreateFontCursor(globalconf.display, XC_left_ptr);
@ -214,14 +215,14 @@ setup(int screen)
wa.cursor = globalconf.cursor[CurNormal];
XChangeWindowAttributes(globalconf.display,
RootWindow(globalconf.display, get_phys_screen(screen)),
RootWindow(globalconf.display, phys_screen),
CWEventMask | CWCursor, &wa);
XSelectInput(globalconf.display,
RootWindow(globalconf.display, get_phys_screen(screen)),
RootWindow(globalconf.display, phys_screen),
wa.event_mask);
grabkeys(get_phys_screen(screen));
grabkeys(phys_screen);
for(statusbar = globalconf.screens[screen].statusbar; statusbar; statusbar = statusbar->next)
statusbar_init(statusbar, screen);

View File

@ -317,6 +317,7 @@ config_parse_screen(cfg_t *cfg, int screen)
*cfg_layouts, *cfg_padding, *cfgsectmp;
VirtScreen *virtscreen = &globalconf.screens[screen];
unsigned int i;
int phys_screen = get_phys_screen(screen);
snprintf(buf, sizeof(buf), "%d", screen);
cfg_screen = cfg_gettsec(cfg, "screen", buf);
@ -346,27 +347,27 @@ config_parse_screen(cfg_t *cfg, int screen)
virtscreen->focus_move_pointer = cfg_getbool(cfg_general, "focus_move_pointer");
virtscreen->allow_lower_floats = cfg_getbool(cfg_general, "allow_lower_floats");
virtscreen->font = XftFontOpenName(globalconf.display,
get_phys_screen(screen),
phys_screen,
cfg_getstr(cfg_general, "font"));
if(!virtscreen->font)
eprint("awesome: cannot init font\n");
/* Colors */
virtscreen->colors_normal[ColBorder] = initxcolor(screen,
virtscreen->colors_normal[ColBorder] = initxcolor(phys_screen,
cfg_getstr(cfg_colors, "normal_border"));
virtscreen->colors_normal[ColBG] = initxcolor(screen,
virtscreen->colors_normal[ColBG] = initxcolor(phys_screen,
cfg_getstr(cfg_colors, "normal_bg"));
virtscreen->colors_normal[ColFG] = initxcolor(screen,
virtscreen->colors_normal[ColFG] = initxcolor(phys_screen,
cfg_getstr(cfg_colors, "normal_fg"));
virtscreen->colors_selected[ColBorder] = initxcolor(screen,
virtscreen->colors_selected[ColBorder] = initxcolor(phys_screen,
cfg_getstr(cfg_colors, "focus_border"));
virtscreen->colors_selected[ColBG] = initxcolor(screen,
virtscreen->colors_selected[ColBG] = initxcolor(phys_screen,
cfg_getstr(cfg_colors, "focus_bg"));
virtscreen->colors_selected[ColFG] = initxcolor(screen,
virtscreen->colors_selected[ColFG] = initxcolor(phys_screen,
cfg_getstr(cfg_colors, "focus_fg"));
virtscreen->colors_urgent[ColBG] = initxcolor(screen,
virtscreen->colors_urgent[ColBG] = initxcolor(phys_screen,
cfg_getstr(cfg_colors, "urgent_bg"));
virtscreen->colors_urgent[ColFG] = initxcolor(screen,
virtscreen->colors_urgent[ColFG] = initxcolor(phys_screen,
cfg_getstr(cfg_colors, "urgent_fg"));
/* Statusbar */
@ -448,9 +449,9 @@ config_parse_screen(cfg_t *cfg, int screen)
tag->mwfact = 0.5;
}
ewmh_update_net_numbers_of_desktop(get_phys_screen(screen));
ewmh_update_net_current_desktop(get_phys_screen(screen));
ewmh_update_net_desktop_names(get_phys_screen(screen));
ewmh_update_net_numbers_of_desktop(phys_screen);
ewmh_update_net_current_desktop(phys_screen);
ewmh_update_net_desktop_names(phys_screen);
/* select first tag by default */
virtscreen->tags[0].selected = True;

View File

@ -75,6 +75,7 @@ focustitle_new(Statusbar *statusbar, cfg_t *config)
Widget *w;
Data *d;
char *buf;
int phys_screen = get_phys_screen(statusbar->screen);
w = p_new(Widget, 1);
widget_common_new(w, statusbar, config);
@ -83,12 +84,12 @@ focustitle_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(phys_screen, buf);
else
d->fg = globalconf.screens[statusbar->screen].colors_selected[ColFG];
if((buf = cfg_getstr(config, "bg")))
d->bg = initxcolor(statusbar->screen, buf);
d->bg = initxcolor(phys_screen, buf);
else
d->bg = globalconf.screens[statusbar->screen].colors_selected[ColBG];

View File

@ -24,6 +24,7 @@
#include "draw.h"
#include "widget.h"
#include "xutil.h"
#include "screen.h"
extern AwesomeConf globalconf;
@ -124,7 +125,7 @@ progressbar_new(Statusbar *statusbar, cfg_t *config)
Widget *w;
Data *d;
char *color;
int i;
int i, phys_screen = get_phys_screen(statusbar->screen);
cfg_t *cfg;
@ -151,17 +152,17 @@ progressbar_new(Statusbar *statusbar, cfg_t *config)
cfg = cfg_getnsec(config, "bar", i);
if((color = cfg_getstr(cfg, "fg")))
d->fg[i] = initxcolor(statusbar->screen, color);
d->fg[i] = initxcolor(phys_screen, color);
else
d->fg[i] = globalconf.screens[statusbar->screen].colors_normal[ColFG];
if((color = cfg_getstr(cfg, "bg")))
d->bg[i] = initxcolor(statusbar->screen, color);
d->bg[i] = initxcolor(phys_screen, color);
else
d->bg[i] = globalconf.screens[statusbar->screen].colors_normal[ColBG];
if((color = cfg_getstr(cfg, "bcolor")))
d->bcolor[i] = initxcolor(statusbar->screen, color);
d->bcolor[i] = initxcolor(phys_screen, color);
else
d->bcolor[i] = d->fg[i];

View File

@ -85,7 +85,7 @@ textbox_new(Statusbar *statusbar, cfg_t *config)
d->fg = globalconf.screens[statusbar->screen].colors_normal[ColFG];
if((buf = cfg_getstr(config, "bg")))
d->bg = initxcolor(statusbar->screen, buf);
d->bg = initxcolor(get_phys_screen(statusbar->screen), buf);
else
d->bg = globalconf.screens[statusbar->screen].colors_normal[ColBG];

15
xutil.c
View File

@ -129,18 +129,17 @@ xgettextprop(Display *disp, Window w, Atom atom, char *text, ssize_t textlen)
* \param colstr Color specification
*/
XColor
initxcolor(int screen, const char *colstr)
initxcolor(int phys_screen, const char *colstr)
{
XColor screenColor, exactColor;
int ret, physcreen = get_phys_screen(screen);
ret = XAllocNamedColor(globalconf.display,
DefaultColormap(globalconf.display, physcreen),
colstr,
&screenColor,
&exactColor);
if(!ret)
if(!XAllocNamedColor(globalconf.display,
DefaultColormap(globalconf.display, phys_screen),
colstr,
&screenColor,
&exactColor))
eprint("awesome: error, cannot allocate color '%s'\n", colstr);
return screenColor;
}