From 2ef846164c22c2659cb73b4d34d571e45991b079 Mon Sep 17 00:00:00 2001 From: Julien Danjou Date: Thu, 6 Sep 2007 19:09:09 +0200 Subject: [PATCH] move prevtags in jdwmconf also --- config.c | 3 +++ config.h | 2 ++ jdwm.c | 4 ---- tag.c | 8 ++++---- 4 files changed, 9 insertions(+), 8 deletions(-) diff --git a/config.c b/config.c index 8d2576683..a0e8465c2 100644 --- a/config.c +++ b/config.c @@ -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"); diff --git a/config.h b/config.h index f2e229660..8690afd96 100644 --- a/config.h +++ b/config.h @@ -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 */ diff --git a/jdwm.c b/jdwm.c index 30dc3f281..9dd2811eb 100644 --- a/jdwm.c +++ b/jdwm.c @@ -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); diff --git a/tag.c b/tag.c index 479896c2b..023952690 100644 --- a/tag.c +++ b/tag.c @@ -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); }