new feature: uicb_setlayout can no go backward ; binding Button3 click on layout symbol statusbar for reverse layout switching

This commit is contained in:
Julien Danjou 2007-10-02 14:22:51 +02:00
parent 17ec922077
commit 4c4fb83e81
2 changed files with 16 additions and 15 deletions

View File

@ -175,7 +175,9 @@ handle_event_buttonpress(XEvent * e, awesome_config *awesomeconf)
}
}
if((ev->x < x + awesomeconf[screen].statusbar.width) && ev->button == Button1)
uicb_setlayout(e->xany.display, &dc[screen], &awesomeconf[screen], NULL);
uicb_setlayout(e->xany.display, &dc[screen], &awesomeconf[screen], "+1");
else if((ev->x < x + awesomeconf[screen].statusbar.width) && ev->button == Button3)
uicb_setlayout(e->xany.display, &dc[screen], &awesomeconf[screen], "-1");
return;
}

View File

@ -163,21 +163,20 @@ uicb_setlayout(Display *disp,
awesome_config * awesomeconf,
const char *arg)
{
int i, j;
int i;
Client *c;
for(i = 0; i < awesomeconf->nlayouts && &awesomeconf->layouts[i] != awesomeconf->current_layout; i++);
if(!arg)
{
if(!(++awesomeconf->current_layout)->symbol)
awesomeconf->current_layout = awesomeconf->layouts;
}
i++;
else
{
i = strtol(arg, NULL, 10);
if(i < 0 || i >= awesomeconf->nlayouts)
return;
awesomeconf->current_layout = &awesomeconf->layouts[i];
}
i = compute_new_value_from_arg(arg, (double) i);
if(i < 0 || i >= awesomeconf->nlayouts)
i = 0;
awesomeconf->current_layout = &awesomeconf->layouts[i];
for(c = clients; c; c = c->next)
c->ftview = True;
@ -189,9 +188,9 @@ uicb_setlayout(Display *disp,
saveawesomeprops(disp, awesomeconf);
for(j = 0; j < awesomeconf->ntags; j++)
if (awesomeconf->tags[j].selected)
awesomeconf->tags[j].layout = awesomeconf->current_layout;
for(i = 0; i < awesomeconf->ntags; i++)
if (awesomeconf->tags[i].selected)
awesomeconf->tags[i].layout = awesomeconf->current_layout;
}
static void