simplify load/saveawesomeprops

This commit is contained in:
Julien Danjou 2007-09-17 14:02:28 +02:00
parent dcec6aa749
commit d9523d3436
4 changed files with 12 additions and 12 deletions

View File

@ -208,7 +208,7 @@ setup(Display *disp, int screen, DC *drawcontext, awesome_config *awesomeconf)
if(!drawcontext->font.set)
XSetFont(disp, drawcontext->gc, drawcontext->font.xfont->fid);
loadawesomeprops(disp, screen, awesomeconf);
loadawesomeprops(disp, awesomeconf);
}
/** Startup Error handler to check if another window manager

View File

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