X-Git-Url: https://jasonwoof.com/gitweb/?a=blobdiff_plain;f=spectrwm.c;h=7291eb186078a53df7a0cdb4cd70123acefbeffc;hb=b78adefb6507ceb8d3918f99f806292615124395;hp=4003ee13e45d164331564c733e07e2d9bd3c1ef1;hpb=e0ef82c3d1b5e6378c17bb147698a86345a6965d;p=spectrwm.git diff --git a/spectrwm.c b/spectrwm.c index 4003ee1..7291eb1 100644 --- a/spectrwm.c +++ b/spectrwm.c @@ -703,29 +703,6 @@ get_atom_from_string(const char *str) return (XCB_ATOM_NONE); } -int -get_property(Window id, Atom atom, long count, Atom type, unsigned long *nitems, - unsigned long *nbytes, unsigned char **data) -{ - int format, status; - unsigned long *nbytes_ret, *nitems_ret; - unsigned long nbytes_tmp, nitems_tmp; - Atom real; - - nbytes_ret = nbytes != NULL ? nbytes : &nbytes_tmp; - nitems_ret = nitems != NULL ? nitems : &nitems_tmp; - - status = XGetWindowProperty(display, id, atom, 0L, count, False, type, - &real, &format, nitems_ret, nbytes_ret, data); - - if (status != Success) - return (False); - if (real != type) - return (False); - - return (True); -} - void update_iconic(struct ws_win *win, int newv) { @@ -1549,7 +1526,7 @@ bar_window_name(char *s, size_t sz, struct swm_region *r) if ((title = get_win_name(r->ws->focus->id)) == NULL) return; - strlcat(s, (char *)title, sz); + strlcat(s, title, sz); free(title); } @@ -3761,12 +3738,12 @@ get_win_name(xcb_window_t win) c = xcb_icccm_get_wm_name(conn, win); if (xcb_icccm_get_wm_name_reply(conn, c, &r, NULL)) { - name = malloc((r.name_len + 1) * sizeof(char *)); + name = malloc(1, r.name_len + 1); if (!name) { xcb_get_text_property_reply_wipe(&r); return (NULL); } - memcpy(name, r.name, r.name_len * sizeof(char *)); + memcpy(name, r.name, r.name_len); name[r.name_len] = '\0'; }