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) 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; return;
} }

View File

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