aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorokan2008-05-19 17:11:19 +0000
committerokan2008-05-19 17:11:19 +0000
commita6afc5f36998efb9a564b3a22d2e36a89812af3d (patch)
tree2e751b6dfe83e12d724e9ac56d1f8e980d446fe8
parenta47b4ccaab4803eba1fb0774e26abd3ed06f9fd4 (diff)
downloadcwm-a6afc5f36998efb9a564b3a22d2e36a89812af3d.tar.gz
as done with cycle/rcycle, make prev/next group switching one kbfuncs
and use a flag; adjusted to match and rename to {r,}cycle. "ok, since i came up with the same thing" oga@
Diffstat (limited to '')
-rw-r--r--calmwm.h12
-rw-r--r--conf.c10
-rw-r--r--cwm.16
-rw-r--r--group.c17
-rw-r--r--kbfunc.c12
5 files changed, 25 insertions, 32 deletions
diff --git a/calmwm.h b/calmwm.h
index 78c0268..2d14637 100644
--- a/calmwm.h
+++ b/calmwm.h
@@ -15,7 +15,7 @@
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*
- * $Id: calmwm.h,v 1.43 2008/05/19 15:17:50 oga Exp $
+ * $Id: calmwm.h,v 1.44 2008/05/19 17:11:19 okan Exp $
*/
#ifndef _CALMWM_H_
@@ -221,9 +221,12 @@ TAILQ_HEAD(winmatch_q, winmatch);
/* for cwm_exec */
#define CWM_EXEC_PROGRAM 0x1
#define CWM_EXEC_WM 0x2
-/* For alt-tab */
+/* for alt-tab */
#define CWM_CYCLE 0x0
#define CWM_RCYCLE 0x1
+/* for group cycle */
+#define CWM_CYCLEGROUP 0x0
+#define CWM_RCYCLEGROUP 0x1
#define KBFLAG_NEEDCLIENT 0x01
@@ -434,8 +437,7 @@ void kbfunc_cmdexec(struct client_ctx *, void *);
void kbfunc_client_label(struct client_ctx *, void *);
void kbfunc_client_delete(struct client_ctx *, void *);
void kbfunc_client_group(struct client_ctx *, void *);
-void kbfunc_client_nextgroup(struct client_ctx *, void *);
-void kbfunc_client_prevgroup(struct client_ctx *, void *);
+void kbfunc_client_cyclegroup(struct client_ctx *, void *);
void kbfunc_client_nogroup(struct client_ctx *, void *);
void kbfunc_client_grouptoggle(struct client_ctx *, void *);
void kbfunc_client_maximize(struct client_ctx *, void *);
@@ -463,7 +465,7 @@ void search_match_exec(struct menu_q *, struct menu_q *,
void group_init(void);
void group_hidetoggle(int);
-void group_slide(int);
+void group_cycle(int);
void group_sticky(struct client_ctx *);
void group_client_delete(struct client_ctx *);
void group_menu(XButtonEvent *);
diff --git a/conf.c b/conf.c
index 3c4adb9..35f3577 100644
--- a/conf.c
+++ b/conf.c
@@ -15,7 +15,7 @@
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*
- * $Id: conf.c,v 1.33 2008/05/19 15:17:50 oga Exp $
+ * $Id: conf.c,v 1.34 2008/05/19 17:11:19 okan Exp $
*/
#include "headers.h"
@@ -115,8 +115,8 @@ conf_init(struct conf *c)
conf_bindname(c, "CM-7", "group7");
conf_bindname(c, "CM-8", "group8");
conf_bindname(c, "CM-9", "group9");
- conf_bindname(c, "M-Right", "nextgroup");
- conf_bindname(c, "M-Left", "prevgroup");
+ conf_bindname(c, "M-Right", "cyclegroup");
+ conf_bindname(c, "M-Left", "rcyclegroup");
conf_bindname(c, "CM-g", "grouptoggle");
conf_bindname(c, "CM-f", "maximize");
conf_bindname(c, "CM-equal", "vmaximize");
@@ -223,8 +223,8 @@ struct {
{ "group8", kbfunc_client_group, 0, (void *)8 },
{ "group9", kbfunc_client_group, 0, (void *)9 },
{ "nogroup", kbfunc_client_nogroup, 0, 0 },
- { "nextgroup", kbfunc_client_nextgroup, 0, 0 },
- { "prevgroup", kbfunc_client_prevgroup, 0, 0 },
+ { "cyclegroup", kbfunc_client_cyclegroup, 0, (void *)CWM_CYCLEGROUP },
+ { "rcyclegroup", kbfunc_client_cyclegroup, 0, (void *)CWM_RCYCLEGROUP },
{ "grouptoggle", kbfunc_client_grouptoggle, KBFLAG_NEEDCLIENT, 0},
{ "maximize", kbfunc_client_maximize, KBFLAG_NEEDCLIENT, 0 },
{ "vmaximize", kbfunc_client_vmaximize, KBFLAG_NEEDCLIENT, 0 },
diff --git a/cwm.1 b/cwm.1
index 6eaad75..00f74ad 100644
--- a/cwm.1
+++ b/cwm.1
@@ -1,4 +1,4 @@
-.\" $OpenBSD: cwm.1,v 1.28 2008/05/19 12:56:58 okan Exp $
+.\" $OpenBSD: cwm.1,v 1.29 2008/05/19 17:11:19 okan Exp $
.\"
.\" Copyright (c) 2004,2005 Marius Aamodt Eriksen <marius@monkey.org>
.\"
@@ -86,9 +86,9 @@ Select all groups.
.It Ic C-M-g
Toggle a window's membership in the current group.
.It Ic M-Right
-Switch to next group.
+Cycle through active groups.
.It Ic M-Left
-Switch to previous group.
+Reverse cycle through active groups.
.It Ic C-M-f
Toggle full-screen size of window.
.It Ic C-M-=
diff --git a/group.c b/group.c
index dd190af..f96e8f1 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.
*
- * $Id: group.c,v 1.14 2008/05/18 20:00:16 okan Exp $
+ * $Id: group.c,v 1.15 2008/05/19 17:11:19 okan Exp $
*/
#include "headers.h"
@@ -195,15 +195,11 @@ group_hidetoggle(int idx)
}
}
-#define GROUP_NEXT(gc, fwd) (fwd) ? \
- TAILQ_NEXT(gc, entry) : TAILQ_PREV(gc, group_ctx_q, entry)
-
/*
- * Jump to the next/previous active group. If none exist, then just
- * stay put.
+ * Cycle through active groups. If none exist, then just stay put.
*/
void
-group_slide(int fwd)
+group_cycle(int reverse)
{
struct group_ctx *gc, *showgroup = NULL;
@@ -211,10 +207,11 @@ group_slide(int fwd)
gc = Group_active;
for (;;) {
- gc = GROUP_NEXT(gc, fwd);
+ gc = reverse ? TAILQ_PREV(gc, group_ctx_q, entry) :
+ TAILQ_NEXT(gc, entry);
if (gc == NULL)
- gc = fwd ? TAILQ_FIRST(&Groupq) :
- TAILQ_LAST(&Groupq, group_ctx_q);
+ gc = reverse ? TAILQ_LAST(&Groupq, group_ctx_q) :
+ TAILQ_FIRST(&Groupq);
if (gc == Group_active)
break;
diff --git a/kbfunc.c b/kbfunc.c
index 7c98c37..e4a3574 100644
--- a/kbfunc.c
+++ b/kbfunc.c
@@ -15,7 +15,7 @@
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*
- * $Id: kbfunc.c,v 1.24 2008/05/19 15:17:50 oga Exp $
+ * $Id: kbfunc.c,v 1.25 2008/05/19 17:11:19 okan Exp $
*/
#include <paths.h>
@@ -412,15 +412,9 @@ kbfunc_client_group(struct client_ctx *cc, void *arg)
}
void
-kbfunc_client_nextgroup(struct client_ctx *cc, void *arg)
+kbfunc_client_cyclegroup(struct client_ctx *cc, void *arg)
{
- group_slide(1);
-}
-
-void
-kbfunc_client_prevgroup(struct client_ctx *cc, void *arg)
-{
- group_slide(0);
+ group_cycle((int)arg);
}
void