aboutsummaryrefslogtreecommitdiffstats
path: root/xutil.c
diff options
context:
space:
mode:
authorokan2016-10-04 15:18:20 +0000
committerokan2016-10-04 15:18:20 +0000
commit2e16db28638cf0e78e6ddae11521a1f589179f67 (patch)
treef968e38ac24cbd0b42a301ffcc7cefd2a5052415 /xutil.c
parentda816a4a2336765be3b75ca8c08375463fdf31b8 (diff)
downloadcwm-2e16db28638cf0e78e6ddae11521a1f589179f67.tar.gz
Turn CALMWM_NGROUPS define into variable, ngroups.
Diffstat (limited to 'xutil.c')
-rw-r--r--xutil.c27
1 files changed, 14 insertions, 13 deletions
diff --git a/xutil.c b/xutil.c
index f2691ff..f1d66d6 100644
--- a/xutil.c
+++ b/xutil.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: xutil.c,v 1.106 2016/09/30 18:28:06 okan Exp $
+ * $OpenBSD: xutil.c,v 1.107 2016/10/04 15:18:20 okan Exp $
*/
#include <sys/types.h>
@@ -131,19 +131,20 @@ xu_ewmh_net_desktop_geometry(struct screen_ctx *sc)
void
xu_ewmh_net_workarea(struct screen_ctx *sc)
{
- long workareas[CALMWM_NGROUPS][4];
- int i;
-
- for (i = 0; i < CALMWM_NGROUPS; i++) {
- workareas[i][0] = sc->work.x;
- workareas[i][1] = sc->work.y;
- workareas[i][2] = sc->work.w;
- workareas[i][3] = sc->work.h;
+ unsigned long *workarea;
+ int i, ngroups = Conf.ngroups;
+
+ workarea = xreallocarray(NULL, ngroups * 4, sizeof(unsigned long));
+ for (i = 0; i < ngroups; i++) {
+ workarea[4 * i + 0] = sc->work.x;
+ workarea[4 * i + 1] = sc->work.y;
+ workarea[4 * i + 2] = sc->work.w;
+ workarea[4 * i + 3] = sc->work.h;
}
-
XChangeProperty(X_Dpy, sc->rootwin, ewmh[_NET_WORKAREA],
- XA_CARDINAL, 32, PropModeReplace, (unsigned char *)workareas,
- CALMWM_NGROUPS * 4);
+ XA_CARDINAL, 32, PropModeReplace, (unsigned char *)workarea,
+ ngroups * 4);
+ free(workarea);
}
void
@@ -223,7 +224,7 @@ xu_ewmh_net_wm_desktop_viewport(struct screen_ctx *sc)
void
xu_ewmh_net_wm_number_of_desktops(struct screen_ctx *sc)
{
- long ndesks = CALMWM_NGROUPS;
+ long ndesks = Conf.ngroups;
XChangeProperty(X_Dpy, sc->rootwin, ewmh[_NET_NUMBER_OF_DESKTOPS],
XA_CARDINAL, 32, PropModeReplace, (unsigned char *)&ndesks, 1);