- if (ws_idx_atom && prop == NULL) {
- /* set the window's workspace property if it wasn't there */
- ws_idx_str[0] = (unsigned char)ws->idx;
- XChangeProperty(display, id, ws_idx_atom, XA_STRING, 1,
- PropModeReplace, ws_idx_str, 1);
+ if (ws_idx_atom && prop == NULL &&
+ snprintf(ws_idx_str, SWM_PROPLEN, "%d", ws->idx) < SWM_PROPLEN) {
+ DNPRINTF(SWM_D_PROP, "setting property _SWM_WS to %s\n",
+ ws_idx_str);
+ XChangeProperty(display, win->id, ws_idx_atom, XA_STRING, 8,
+ PropModeReplace, ws_idx_str, SWM_PROPLEN);