save and loadawesomeprops do not need display as arg

This commit is contained in:
Julien Danjou 2007-10-15 18:14:43 +02:00
parent 8cd37bedf5
commit 3592e8e448
4 changed files with 14 additions and 13 deletions

View File

@ -329,7 +329,7 @@ main(int argc, char *argv[])
/* do this only for real screen */
for(screen = 0; screen < ScreenCount(dpy); screen++)
{
loadawesomeprops(dpy, &awesomeconf[screen]);
loadawesomeprops(&awesomeconf[screen]);
XChangeProperty(dpy, RootWindow(dpy, screen), netatom[NetSupported],
XA_ATOM, 32, PropModeReplace, (unsigned char *) netatom, NetLast);
}

View File

@ -91,14 +91,15 @@ uicb_focusprev(awesome_config *awesomeconf,
}
void
loadawesomeprops(Display *disp, awesome_config * awesomeconf)
loadawesomeprops(awesome_config * awesomeconf)
{
int i;
char *prop;
prop = p_new(char, awesomeconf->ntags + 1);
if(xgettextprop(disp, RootWindow(disp, awesomeconf->phys_screen), AWESOMEPROPS_ATOM(disp), prop, awesomeconf->ntags + 1))
if(xgettextprop(awesomeconf->display, RootWindow(awesomeconf->display, awesomeconf->phys_screen),
AWESOMEPROPS_ATOM(awesomeconf->display), prop, awesomeconf->ntags + 1))
for(i = 0; i < awesomeconf->ntags && prop[i]; i++)
if(prop[i] == '1')
{
@ -152,7 +153,7 @@ restack(Display * disp, awesome_config *awesomeconf)
}
void
saveawesomeprops(Display *disp, awesome_config *awesomeconf)
saveawesomeprops(awesome_config *awesomeconf)
{
int i;
char *prop;
@ -161,8 +162,8 @@ saveawesomeprops(Display *disp, awesome_config *awesomeconf)
for(i = 0; i < awesomeconf->ntags; i++)
prop[i] = awesomeconf->tags[i].selected ? '1' : '0';
prop[i] = '\0';
XChangeProperty(disp, RootWindow(disp, awesomeconf->phys_screen),
AWESOMEPROPS_ATOM(disp), XA_STRING, 8,
XChangeProperty(awesomeconf->display, RootWindow(awesomeconf->display, awesomeconf->phys_screen),
AWESOMEPROPS_ATOM(awesomeconf->display), XA_STRING, 8,
PropModeReplace, (unsigned char *) prop, i);
p_delete(&prop);
}
@ -196,7 +197,7 @@ uicb_setlayout(awesome_config * awesomeconf,
else
drawstatusbar(awesomeconf->display, awesomeconf);
saveawesomeprops(awesomeconf->display, awesomeconf);
saveawesomeprops(awesomeconf);
for(i = 0; i < awesomeconf->ntags; i++)
if (awesomeconf->tags[i].selected)

View File

@ -31,8 +31,8 @@
void arrange(Display *, awesome_config *); /* arranges all windows depending on the layout in use */
void restack(Display *, awesome_config *); /* restores z layers of all clients */
void loadawesomeprops(Display *, awesome_config *);
void saveawesomeprops(Display *, awesome_config *);
void loadawesomeprops(awesome_config *);
void saveawesomeprops(awesome_config *);
UICB_PROTO(uicb_focusnext);
UICB_PROTO(uicb_focusprev);

8
tag.c
View File

@ -231,7 +231,7 @@ uicb_toggleview(awesome_config *awesomeconf,
for(j = 0; j < awesomeconf->ntags && !awesomeconf->tags[j].selected; j++);
if(j == awesomeconf->ntags)
awesomeconf->tags[i].selected = True;
saveawesomeprops(awesomeconf->display, awesomeconf);
saveawesomeprops(awesomeconf);
arrange(awesomeconf->display, awesomeconf);
}
@ -257,7 +257,7 @@ uicb_view(awesome_config *awesomeconf,
awesomeconf->tags[i].selected = True;
awesomeconf->current_layout = awesomeconf->tags[i].layout;
}
saveawesomeprops(awesomeconf->display, awesomeconf);
saveawesomeprops(awesomeconf);
arrange(awesomeconf->display, awesomeconf);
}
@ -303,7 +303,7 @@ uicb_tag_viewnext(awesome_config *awesomeconf,
firsttag = 0;
awesomeconf->tags[firsttag].selected = True;
awesomeconf->current_layout = awesomeconf->tags[firsttag].layout;
saveawesomeprops(awesomeconf->display, awesomeconf);
saveawesomeprops(awesomeconf);
arrange(awesomeconf->display, awesomeconf);
}
@ -328,7 +328,7 @@ uicb_tag_viewprev(awesome_config *awesomeconf,
firsttag = awesomeconf->ntags - 1;
awesomeconf->tags[firsttag].selected = True;
awesomeconf->current_layout = awesomeconf->tags[firsttag].layout;
saveawesomeprops(awesomeconf->display, awesomeconf);
saveawesomeprops(awesomeconf);
arrange(awesomeconf->display, awesomeconf);
}
// vim: filetype=c:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99