move prevtags in jdwmconf also

This commit is contained in:
Julien Danjou 2007-09-06 19:09:09 +02:00
parent e5f2ed3f22
commit 2ef846164c
4 changed files with 9 additions and 8 deletions

View File

@ -201,15 +201,18 @@ parse_config(Display * disp, int scr, DC * drawcontext, jdwm_config *jdwmconf)
jdwmconf->ntags = config_setting_length(conftags);
jdwmconf->tags = p_new(const char *, jdwmconf->ntags);
jdwmconf->selected_tags = p_new(Bool, jdwmconf->ntags);
jdwmconf->prev_selected_tags = p_new(Bool, jdwmconf->ntags);
for(i = 0; (tmp = config_setting_get_string_elem(conftags, i)); i++)
{
jdwmconf->tags[i] = tmp;
jdwmconf->selected_tags[i] = False;
jdwmconf->prev_selected_tags[i] = False;
}
/* select first tag by default */
jdwmconf->selected_tags[0] = True;
jdwmconf->prev_selected_tags[0] = True;
/* layouts */
conflayouts = config_lookup(&jdwmlibconf, "jdwm.layouts");

View File

@ -61,6 +61,8 @@ struct jdwm_config
const char **tags;
/** Selected tags */
Bool *selected_tags;
/* Previously selected tags */
Bool *prev_selected_tags;
/** Number of tags in **tags */
int ntags;
/** Layout list */

4
jdwm.c
View File

@ -25,7 +25,6 @@ extern void (*handler[LASTEvent]) (XEvent *, jdwm_config *); /* event handler
int screen, sx, sy, sw, sh, wax, way, waw, wah;
int bh;
Atom jdwmprops, wmatom[WMLast], netatom[NetLast];
Bool *prevtags;;
Bool selscreen = True;
Client *clients = NULL;
Client *sel = NULL;
@ -98,7 +97,6 @@ cleanup(Display *disp, jdwm_config *jdwmconf)
XFreeCursor(disp, cursor[CurMove]);
XSetInputFocus(disp, PointerRoot, RevertToPointerRoot, CurrentTime);
XSync(disp, False);
p_delete(&prevtags);
p_delete(&taglayouts);
}
@ -180,8 +178,6 @@ setup(Display *disp, jdwm_config *jdwmconf)
XSelectInput(disp, DefaultRootWindow(disp), wa.event_mask);
grabkeys(disp, jdwmconf);
compileregs(jdwmconf);
prevtags = p_new(Bool, jdwmconf->ntags);
prevtags[0] = True;
/* geometry */
sx = sy = 0;
sw = DisplayWidth(disp, screen);

8
tag.c
View File

@ -10,7 +10,6 @@
#include "tag.h"
extern Client *sel; /* global client list */
extern Bool *prevtags;
extern Layout ** taglayouts;
static Regs *regs = NULL;
@ -227,7 +226,7 @@ uicb_view(Display *disp,
for(i = 0; i < jdwmconf->ntags; i++)
{
prevtags[i] = jdwmconf->selected_tags[i];
jdwmconf->prev_selected_tags[i] = jdwmconf->selected_tags[i];
jdwmconf->selected_tags[i] = arg == NULL;
}
i = idxoftag(arg, jdwmconf->tags, jdwmconf->ntags);
@ -242,6 +241,7 @@ uicb_view(Display *disp,
/** View previously selected tags
* \param disp Display ref
* \param jdwmconf jdwm config ref
* \param arg unused
* \ingroup ui_callback
*/
@ -256,8 +256,8 @@ uicb_viewprevtags(Display * disp,
for(i = 0; i < jdwmconf->ntags; i++)
{
t = jdwmconf->selected_tags[i];
jdwmconf->selected_tags[i] = prevtags[i];
prevtags[i] = t;
jdwmconf->selected_tags[i] = jdwmconf->prev_selected_tags[i];
jdwmconf->prev_selected_tags[i] = t;
}
arrange(disp, jdwmconf);
}