Fix setting of window property strings to use actual number of

elements rather than char array size.

ok marco
This commit is contained in:
Reginald Kennedy 2012-02-13 23:32:31 +08:00
parent 40c7235602
commit 99a8c34790
2 changed files with 4 additions and 3 deletions

View file

@ -106,7 +106,8 @@ set_property(Display *dpy, Window id, char *name, char *val)
if (atom)
if (snprintf(prop, SWM_PROPLEN, "%s", val) < SWM_PROPLEN)
(*xcp)(dpy, id, atom, XA_STRING,
8, PropModeReplace, (unsigned char *)prop, SWM_PROPLEN);
8, PropModeReplace, (unsigned char *)prop,
strlen((char *)prop));
}
typedef Window(CWF) (Display * _display, Window _parent, int _x,

View file

@ -3280,7 +3280,7 @@ send_to_ws(struct swm_region *r, union arg *args)
DNPRINTF(SWM_D_PROP, "send_to_ws: set property: _SWM_WS: %s\n",
ws_idx_str);
XChangeProperty(display, win->id, ws_idx_atom, XA_STRING, 8,
PropModeReplace, ws_idx_str, SWM_PROPLEN);
PropModeReplace, ws_idx_str, strlen((char *)ws_idx_str));
}
stack();
@ -5878,7 +5878,7 @@ manage_window(Window id)
DNPRINTF(SWM_D_PROP, "manage_window: set _SWM_WS: %s\n",
ws_idx_str);
XChangeProperty(display, win->id, ws_idx_atom, XA_STRING, 8,
PropModeReplace, ws_idx_str, SWM_PROPLEN);
PropModeReplace, ws_idx_str, strlen((char *)ws_idx_str));
}
if (prop)
XFree(prop);