summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorOkan Demirmen <okan@cvs.openbsd.org>2019-02-28 23:26:13 +0000
committerOkan Demirmen <okan@cvs.openbsd.org>2019-02-28 23:26:13 +0000
commitd6c519554efc91144b6187b3c4ab21ea0ce64402 (patch)
tree087fbae08857a08f722de2d931d393ea68b33e60 /app
parente01fb8dcc37107b531022e67db303f5723ca93d4 (diff)
Move the group index (desktop number) check to the only 2 callers that require
checking due to ewmh.
Diffstat (limited to 'app')
-rw-r--r--app/cwm/group.c14
-rw-r--r--app/cwm/xevents.c10
2 files changed, 8 insertions, 16 deletions
diff --git a/app/cwm/group.c b/app/cwm/group.c
index 06e73eb8d..c51bf5124 100644
--- a/app/cwm/group.c
+++ b/app/cwm/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.131 2019/02/28 23:20:52 okan Exp $
+ * $OpenBSD: group.c,v 1.132 2019/02/28 23:26:12 okan Exp $
*/
#include <sys/types.h>
@@ -156,9 +156,6 @@ group_movetogroup(struct client_ctx *cc, int idx)
struct screen_ctx *sc = cc->sc;
struct group_ctx *gc;
- if (idx < 0 || idx >= Conf.ngroups)
- return;
-
TAILQ_FOREACH(gc, &sc->groupq, entry) {
if (gc->num == idx) {
if (cc->gc == gc)
@@ -216,9 +213,6 @@ group_hidetoggle(struct screen_ctx *sc, int idx)
{
struct group_ctx *gc;
- if (idx < 0 || idx >= Conf.ngroups)
- return;
-
TAILQ_FOREACH(gc, &sc->groupq, entry) {
if (gc->num == idx) {
if (group_holds_only_hidden(gc))
@@ -238,9 +232,6 @@ group_only(struct screen_ctx *sc, int idx)
{
struct group_ctx *gc;
- if (idx < 0 || idx >= Conf.ngroups)
- return;
-
TAILQ_FOREACH(gc, &sc->groupq, entry) {
if (gc->num == idx)
group_show(gc);
@@ -255,9 +246,6 @@ group_close(struct screen_ctx *sc, int idx)
struct group_ctx *gc;
struct client_ctx *cc;
- if (idx < 0 || idx >= Conf.ngroups)
- return;
-
TAILQ_FOREACH(gc, &sc->groupq, entry) {
if (gc->num == idx) {
TAILQ_FOREACH(cc, &gc->clientq, group_entry)
diff --git a/app/cwm/xevents.c b/app/cwm/xevents.c
index a697e9f28..19f957857 100644
--- a/app/cwm/xevents.c
+++ b/app/cwm/xevents.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.
*
- * $OpenBSD: xevents.c,v 1.136 2019/02/22 19:40:33 okan Exp $
+ * $OpenBSD: xevents.c,v 1.137 2019/02/28 23:26:12 okan Exp $
*/
/*
@@ -408,7 +408,9 @@ xev_handle_clientmessage(XEvent *ee)
if (e->data.l[0] == (unsigned long)-1)
group_movetogroup(cc, 0);
else
- group_movetogroup(cc, e->data.l[0]);
+ if (e->data.l[0] >= 0 &&
+ e->data.l[0] < Conf.ngroups)
+ group_movetogroup(cc, e->data.l[0]);
}
} else if (e->message_type == ewmh[_NET_WM_STATE]) {
if ((cc = client_find(e->window)) != NULL) {
@@ -417,7 +419,9 @@ xev_handle_clientmessage(XEvent *ee)
}
} else if (e->message_type == ewmh[_NET_CURRENT_DESKTOP]) {
if ((sc = screen_find(e->window)) != NULL) {
- group_only(sc, e->data.l[0]);
+ if (e->data.l[0] >= 0 &&
+ e->data.l[0] < Conf.ngroups)
+ group_only(sc, e->data.l[0]);
}
}
}