load and save awesome props now take screen as arg

This commit is contained in:
Julien Danjou 2007-09-15 22:40:52 +02:00
parent c02be2ab82
commit 5c78f4785f
4 changed files with 12 additions and 12 deletions

View File

@ -161,7 +161,7 @@ setup(Display *disp, DC *drawcontext, awesome_config *awesomeconf)
XSetLineAttributes(disp, drawcontext->gc, 1, LineSolid, CapButt, JoinMiter);
if(!drawcontext->font.set)
XSetFont(disp, drawcontext->gc, drawcontext->font.xfont->fid);
loadawesomeprops(disp, awesomeconf);
loadawesomeprops(disp, DefaultScreen(disp), awesomeconf);
}
/*

View File

@ -91,14 +91,14 @@ uicb_focusprev(Display *disp __attribute__ ((unused)),
}
void
loadawesomeprops(Display *disp, awesome_config * awesomeconf)
loadawesomeprops(Display *disp, int screen, awesome_config * awesomeconf)
{
int i;
char *prop;
prop = p_new(char, awesomeconf->ntags + 1);
if(xgettextprop(disp, DefaultRootWindow(disp), AWESOMEPROPS_ATOM(disp), prop, awesomeconf->ntags + 1))
if(xgettextprop(disp, RootWindow(disp, screen), AWESOMEPROPS_ATOM(disp), prop, awesomeconf->ntags + 1))
for(i = 0; i < awesomeconf->ntags && prop[i]; i++)
awesomeconf->selected_tags[i] = prop[i] == '1';
@ -139,7 +139,7 @@ restack(Display * disp, DC * drawcontext, awesome_config *awesomeconf)
}
void
saveawesomeprops(Display *disp, awesome_config *awesomeconf)
saveawesomeprops(Display *disp, int screen, awesome_config *awesomeconf)
{
int i;
char *prop;
@ -148,7 +148,7 @@ saveawesomeprops(Display *disp, awesome_config *awesomeconf)
for(i = 0; i < awesomeconf->ntags; i++)
prop[i] = awesomeconf->selected_tags[i] ? '1' : '0';
prop[i] = '\0';
XChangeProperty(disp, DefaultRootWindow(disp),
XChangeProperty(disp, RootWindow(disp, screen),
AWESOMEPROPS_ATOM(disp), XA_STRING, 8,
PropModeReplace, (unsigned char *) prop, i);
p_delete(&prop);
@ -184,7 +184,7 @@ uicb_setlayout(Display *disp,
else
drawstatusbar(disp, drawcontext, awesomeconf);
saveawesomeprops(disp, awesomeconf);
saveawesomeprops(disp, DefaultScreen(disp), awesomeconf);
for(j = 0; j < awesomeconf->ntags; j++)
if (awesomeconf->selected_tags[j])

View File

@ -38,7 +38,7 @@ void uicb_togglemax(Display *, DC *, awesome_config *, const char *); /* toggl
void uicb_toggleverticalmax(Display *, DC *, awesome_config *, const char *);
void uicb_togglehorizontalmax(Display *, DC *, awesome_config *, const char *);
void uicb_zoom(Display *, DC *, awesome_config *, const char *); /* set current window first in stack */
void loadawesomeprops(Display *, awesome_config *);
void saveawesomeprops(Display *disp, awesome_config *);
void loadawesomeprops(Display *, int, awesome_config *);
void saveawesomeprops(Display *disp, int, awesome_config *);
#endif

8
tag.c
View File

@ -235,7 +235,7 @@ uicb_toggleview(Display *disp,
for(j = 0; j < awesomeconf->ntags && !awesomeconf->selected_tags[j]; j++);
if(j == awesomeconf->ntags)
awesomeconf->selected_tags[i] = True; /* cannot toggle last view */
saveawesomeprops(disp, awesomeconf);
saveawesomeprops(disp, DefaultScreen(disp), awesomeconf);
arrange(disp, drawcontext, awesomeconf);
}
@ -264,7 +264,7 @@ uicb_view(Display *disp,
awesomeconf->selected_tags[i] = True;
awesomeconf->current_layout = awesomeconf->tag_layouts[i];
}
saveawesomeprops(disp, awesomeconf);
saveawesomeprops(disp, DefaultScreen(disp), awesomeconf);
arrange(disp, drawcontext, awesomeconf);
}
@ -315,7 +315,7 @@ uicb_tag_viewnext(Display *disp,
if(++firsttag >= awesomeconf->ntags)
firsttag = 0;
awesomeconf->selected_tags[firsttag] = True;
saveawesomeprops(disp, awesomeconf);
saveawesomeprops(disp, DefaultScreen(disp), awesomeconf);
arrange(disp, drawcontext, awesomeconf);
}
@ -342,6 +342,6 @@ uicb_tag_viewprev(Display *disp,
if(--firsttag < 0)
firsttag = awesomeconf->ntags - 1;
awesomeconf->selected_tags[firsttag] = True;
saveawesomeprops(disp, awesomeconf);
saveawesomeprops(disp, DefaultScreen(disp), awesomeconf);
arrange(disp, drawcontext, awesomeconf);
}