uicb_reloadconfig: cosmetic and simplify clients pointer
This commit is contained in:
parent
983d2d72a6
commit
582c81a3d0
37
config.c
37
config.c
|
@ -443,16 +443,15 @@ uicb_reloadconfig(awesome_config *awesomeconf,
|
|||
char ***savetagnames;
|
||||
Client ****savetagclientsel;
|
||||
Bool *old_c_tags;
|
||||
Client *c, **clients;
|
||||
Client *c, *clients;
|
||||
|
||||
// Save tag information
|
||||
savetagnames = p_new(char**, screen_count);
|
||||
/* Save tag information */
|
||||
savetagnames = p_new(char **, screen_count);
|
||||
savetagclientsel = p_new(Client ***, screen_count);
|
||||
clients = p_new(Client*, 1);
|
||||
*clients = *awesomeconf_first->clients;
|
||||
clients = *awesomeconf_first->clients;
|
||||
for (screen = 0; screen < screen_count; screen ++)
|
||||
{
|
||||
savetagnames[screen] = p_new(char*, awesomeconf_first[screen].ntags);
|
||||
savetagnames[screen] = p_new(char *, awesomeconf_first[screen].ntags);
|
||||
savetagclientsel[screen] = p_new(Client **, awesomeconf_first[screen].ntags);
|
||||
for (tag = 0; tag < awesomeconf_first[screen].ntags; tag++)
|
||||
{
|
||||
|
@ -468,42 +467,35 @@ uicb_reloadconfig(awesome_config *awesomeconf,
|
|||
mapping = p_new(int*, screen_count);
|
||||
for(screen = 0; screen < screen_count; screen++)
|
||||
{
|
||||
// Cleanup screens and reload their config.
|
||||
/* Cleanup screens and reload their config. */
|
||||
cleanup_screen(&awesomeconf_first[screen]);
|
||||
setup_screen(&awesomeconf_first[screen], awesomeconf_first->configpath);
|
||||
|
||||
// Compute a mapping of tags between the old and new config, based on
|
||||
// tag names.
|
||||
/* Compute a mapping of tags between the old and new config, based on
|
||||
* tag names. */
|
||||
mapping[screen] = p_new(int, awesomeconf_first[screen].ntags);
|
||||
for (i = 0; i < awesomeconf_first[screen].ntags; i ++)
|
||||
{
|
||||
mapping[screen][i] = -1;
|
||||
for (j = 0; j < old_ntags[screen]; j ++)
|
||||
{
|
||||
if (!strcmp(savetagnames[screen][j], awesomeconf_first[screen].tags[i].name))
|
||||
{
|
||||
mapping[screen][i] = j;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Reinitialize the tags' client lists and selected client.
|
||||
*awesomeconf_first[screen].clients = *clients;
|
||||
/* Reinitialize the tags' client lists and selected client. */
|
||||
*awesomeconf_first[screen].clients = clients;
|
||||
for (tag = 0; tag < awesomeconf_first[screen].ntags; tag++)
|
||||
{
|
||||
if (mapping[screen][tag] >= 0)
|
||||
awesomeconf_first[screen].tags[tag].client_sel = *savetagclientsel[screen][mapping[screen][tag]];
|
||||
}
|
||||
drawstatusbar(&awesomeconf_first[screen]);
|
||||
}
|
||||
|
||||
//for (screen = 0; screen < ScreenCount(awesomeconf_first->display); screen++)
|
||||
// loadawesomeprops(&awesomeconf_first[screen]);
|
||||
|
||||
// Reinitialize the 'tags' array of each client.
|
||||
// Clients are assigned to the tags of the same name as in the previous
|
||||
// awesomerc, or to tag #1 otherwise.
|
||||
/* Reinitialize the 'tags' array of each client.
|
||||
* Clients are assigned to the tags of the same name as in the previous
|
||||
* awesomerc, or to tag #1 otherwise. */
|
||||
for (c = *awesomeconf_first->clients; c; c = c->next)
|
||||
{
|
||||
old_c_ntags = old_ntags[c->screen];
|
||||
|
@ -525,7 +517,7 @@ uicb_reloadconfig(awesome_config *awesomeconf,
|
|||
applyrules(c, awesomeconf_first);
|
||||
}
|
||||
|
||||
// Cleanup after ourselves
|
||||
/* Cleanup after ourselves */
|
||||
for(screen = 0; screen < screen_count; screen++)
|
||||
{
|
||||
for(i = 0; i < old_ntags[screen]; i++)
|
||||
|
@ -536,7 +528,6 @@ uicb_reloadconfig(awesome_config *awesomeconf,
|
|||
p_delete(&mapping);
|
||||
p_delete(&savetagnames);
|
||||
p_delete(&old_ntags);
|
||||
p_delete(&clients);
|
||||
for (screen = 0; screen < screen_count; screen ++)
|
||||
arrange(&awesomeconf_first[screen]);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue