aboutsummaryrefslogtreecommitdiffstats
path: root/xevents.c
diff options
context:
space:
mode:
authorokan2019-02-28 23:26:12 +0000
committerokan2019-02-28 23:26:12 +0000
commita2862aa36ac4cfd2b613edc356bf0ebfdaeec84e (patch)
tree9acff8eebe86e6eaacbe9220a7aa35cb277e1d8b /xevents.c
parent647ee7a24a435b91d26f1f2f7a9a1f199e87a7ee (diff)
downloadcwm-a2862aa36ac4cfd2b613edc356bf0ebfdaeec84e.tar.gz
Move the group index (desktop number) check to the only 2 callers that require
checking due to ewmh.
Diffstat (limited to '')
-rw-r--r--xevents.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/xevents.c b/xevents.c
index a697e9f..19f9578 100644
--- a/xevents.c
+++ b/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]);
}
}
}