aboutsummaryrefslogtreecommitdiffstats
path: root/group.c
diff options
context:
space:
mode:
authorokan2014-09-27 18:57:11 +0000
committerokan2014-09-27 18:57:11 +0000
commit86f32d09f2b57c63ec2f978125f7872cec312a00 (patch)
tree7ce2b075e6b21135d48f06dba488f8dac21f3e21 /group.c
parent67bc0ac5f4529aa91e615a0bccb42424ff432926 (diff)
downloadcwm-86f32d09f2b57c63ec2f978125f7872cec312a00.tar.gz
Pass just the group to group_setactive instead of the screen and an
index which then needed to be found in a queue.
Diffstat (limited to 'group.c')
-rw-r--r--group.c22
1 files changed, 9 insertions, 13 deletions
diff --git a/group.c b/group.c
index ff9b339..5a7a29f 100644
--- a/group.c
+++ b/group.c
@@ -16,7 +16,7 @@
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*
- * $OpenBSD: group.c,v 1.106 2014/09/23 14:25:08 okan Exp $
+ * $OpenBSD: group.c,v 1.107 2014/09/27 18:57:11 okan Exp $
*/
#include <sys/param.h>
@@ -34,7 +34,7 @@
static void group_assign(struct group_ctx *, struct client_ctx *);
static void group_restack(struct group_ctx *);
-static void group_setactive(struct screen_ctx *, int);
+static void group_setactive(struct group_ctx *);
const char *num_to_name[] = {
"nogroup", "one", "two", "three", "four", "five", "six",
@@ -75,7 +75,7 @@ group_show(struct group_ctx *gc)
client_unhide(cc);
group_restack(gc);
- group_setactive(gc->sc, gc->num);
+ group_setactive(gc);
}
static void
@@ -126,20 +126,16 @@ group_init(struct screen_ctx *sc)
gc->name = xstrdup(num_to_name[i]);
gc->num = i;
TAILQ_INSERT_TAIL(&sc->groupq, gc, entry);
+ if (i == 1)
+ group_setactive(gc);
}
-
- group_setactive(sc, 1);
}
static void
-group_setactive(struct screen_ctx *sc, int idx)
+group_setactive(struct group_ctx *gc)
{
- struct group_ctx *gc;
+ struct screen_ctx *sc = gc->sc;
- TAILQ_FOREACH(gc, &sc->groupq, entry) {
- if (gc->num == idx)
- break;
- }
sc->group_active = gc;
xu_ewmh_net_current_desktop(sc);
@@ -243,7 +239,7 @@ group_hidetoggle(struct screen_ctx *sc, int idx)
group_hide(gc);
/* make clients stick to empty group */
if (TAILQ_EMPTY(&gc->clientq))
- group_setactive(sc, idx);
+ group_setactive(gc);
}
}
@@ -297,7 +293,7 @@ group_cycle(struct screen_ctx *sc, int flags)
if (group_holds_only_hidden(showgroup))
group_show(showgroup);
else
- group_setactive(sc, showgroup->num);
+ group_setactive(showgroup);
}
void