tags uicb function does not take arg name anymore, but tag index number
This commit is contained in:
parent
0f840d2eec
commit
8b048ec6fe
6
event.c
6
event.c
|
@ -144,6 +144,7 @@ handle_event_buttonpress(XEvent * e, awesome_config *awesomeconf)
|
|||
unsigned int udummy;
|
||||
Client *c;
|
||||
Window wdummy;
|
||||
char buf[256];
|
||||
XButtonPressedEvent *ev = &e->xbutton;
|
||||
|
||||
for(screen = 0; screen < get_screen_count(e->xany.display); screen++)
|
||||
|
@ -154,12 +155,13 @@ handle_event_buttonpress(XEvent * e, awesome_config *awesomeconf)
|
|||
x += textwidth(e->xany.display, awesomeconf[screen].font, awesomeconf[screen].tags[i].name);
|
||||
if(ev->x < x)
|
||||
{
|
||||
snprintf(buf, sizeof(buf), "%d", i + 1);
|
||||
if(ev->button == Button1)
|
||||
{
|
||||
if(ev->state & awesomeconf[screen].modkey)
|
||||
uicb_tag(&awesomeconf[screen], awesomeconf[screen].tags[i].name);
|
||||
uicb_tag(&awesomeconf[screen], buf);
|
||||
else
|
||||
uicb_view(&awesomeconf[screen], awesomeconf[screen].tags[i].name);
|
||||
uicb_view(&awesomeconf[screen], buf);
|
||||
}
|
||||
else if(ev->button == Button3)
|
||||
{
|
||||
|
|
38
tag.c
38
tag.c
|
@ -26,28 +26,6 @@
|
|||
#include "tag.h"
|
||||
#include "util.h"
|
||||
|
||||
/** This function returns the index of
|
||||
* the tag given un argument in *tags
|
||||
* \param tag_to_find tag name
|
||||
* \param tags tag list
|
||||
* \param ntags number of tags in tag list
|
||||
* \return index of tag
|
||||
*/
|
||||
static int
|
||||
idxoftag(const char *tag_to_find, Tag *tags, int ntags)
|
||||
{
|
||||
int i;
|
||||
|
||||
if(!tag_to_find)
|
||||
return 0;
|
||||
|
||||
for(i = 0; i < ntags; i++)
|
||||
if(!a_strcmp(tags[i].name, tag_to_find))
|
||||
return i;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void
|
||||
applyrules(Client * c, awesome_config *awesomeconf)
|
||||
{
|
||||
|
@ -152,11 +130,15 @@ uicb_tag(awesome_config *awesomeconf,
|
|||
|
||||
if(!sel)
|
||||
return;
|
||||
|
||||
for(i = 0; i < awesomeconf->ntags; i++)
|
||||
sel->tags[i] = arg == NULL;
|
||||
i = idxoftag(arg, awesomeconf->tags, awesomeconf->ntags);
|
||||
|
||||
i = arg ? atoi(arg) - 1 : 0;
|
||||
|
||||
if(i >= 0 && i < awesomeconf->ntags)
|
||||
sel->tags[i] = True;
|
||||
|
||||
saveprops(sel, awesomeconf->ntags);
|
||||
arrange(awesomeconf);
|
||||
}
|
||||
|
@ -199,7 +181,7 @@ uicb_toggletag(awesome_config *awesomeconf,
|
|||
|
||||
if(!sel)
|
||||
return;
|
||||
i = idxoftag(arg, awesomeconf->tags, awesomeconf->ntags);
|
||||
i = arg ? atoi(arg) - 1 : 0;
|
||||
sel->tags[i] = !sel->tags[i];
|
||||
for(j = 0; j < awesomeconf->ntags && !sel->tags[j]; j++);
|
||||
if(j == awesomeconf->ntags)
|
||||
|
@ -219,7 +201,7 @@ uicb_toggleview(awesome_config *awesomeconf,
|
|||
unsigned int i;
|
||||
int j;
|
||||
|
||||
i = idxoftag(arg, awesomeconf->tags, awesomeconf->ntags);
|
||||
i = arg ? atoi(arg) - 1: 0;
|
||||
awesomeconf->tags[i].selected = !awesomeconf->tags[i].selected;
|
||||
for(j = 0; j < awesomeconf->ntags && !awesomeconf->tags[j].selected; j++);
|
||||
if(j == awesomeconf->ntags)
|
||||
|
@ -245,10 +227,12 @@ uicb_view(awesome_config *awesomeconf,
|
|||
awesomeconf->tags[i].selected = arg == NULL;
|
||||
}
|
||||
|
||||
i = idxoftag(arg, awesomeconf->tags, awesomeconf->ntags);
|
||||
|
||||
if(arg)
|
||||
{
|
||||
i = atoi(arg) - 1;
|
||||
if(i >= 0 && i < awesomeconf->ntags)
|
||||
awesomeconf->tags[i].selected = True;
|
||||
}
|
||||
|
||||
saveawesomeprops(awesomeconf);
|
||||
arrange(awesomeconf);
|
||||
|
|
Loading…
Reference in New Issue