X-Git-Url: https://jasonwoof.com/gitweb/?a=blobdiff_plain;f=scrotwm.c;h=647433f95f1c158883fb99e4e7f3c0c831a13c0d;hb=f4dcc22a555b197724343e2c3cc30da8d4cedeca;hp=789518777dd32e5b6b3cf419e286bf4ddddf7502;hpb=fe1d4ab5ca0994139cc4dd1f28d0a4515b9ee130;p=spectrwm.git diff --git a/scrotwm.c b/scrotwm.c index 7895187..647433f 100644 --- a/scrotwm.c +++ b/scrotwm.c @@ -563,7 +563,7 @@ struct ewmh_hint { void store_float_geom(struct ws_win *, struct swm_region *); int floating_toggle_win(struct ws_win *); void spawn_select(struct swm_region *, union arg *, char *, int *); -unsigned char *get_win_name(Display *, Window, Atom, Atom, unsigned long *); +unsigned char *get_win_name(Display *, Window); int get_property(Window id, Atom atom, long count, Atom type, @@ -1354,11 +1354,10 @@ void bar_window_name(char *s, ssize_t sz, struct ws_win *cur_focus) { unsigned char *title; - unsigned long len; if (window_name_enabled && cur_focus != NULL) { - if ((title = get_win_name(display, cur_focus->id, a_netwmname, - a_utf8_string, &len)) != NULL) { + title = get_win_name(display, cur_focus->id); + if (title != NULL) { DNPRINTF(SWM_D_BAR, "bar_window_name: title: %s\n", title); @@ -2207,7 +2206,7 @@ focus_win(struct ws_win *win) PropModeReplace, (unsigned char *)&win->id,1); } - if (window_name_enabled) + if (window_name_enabled || title_class_enabled || title_name_enabled) bar_update(); } @@ -3313,31 +3312,29 @@ iconify(struct swm_region *r, union arg *args) } unsigned char * -get_win_name(Display *dpy, Window win, Atom wname, Atom stype, - unsigned long *slen) +get_win_name(Display *dpy, Window win) { int status, retfmt; unsigned long nitems, nbytes, nextra; unsigned char *prop = NULL; Atom rettype; - status = XGetWindowProperty(dpy, win, wname, 0L, 0L, False, stype, - &rettype, &retfmt, &nitems, &nbytes, &prop); + status = XGetWindowProperty(dpy, win, a_netwmname, 0L, 0L, False, + a_utf8_string, &rettype, &retfmt, &nitems, &nbytes, &prop); if (status != Success) return (NULL); XFree(prop); - status = XGetWindowProperty(dpy, win, wname, 0L, nbytes, False, - stype, &rettype, &retfmt, &nitems, &nextra, &prop); + status = XGetWindowProperty(dpy, win, a_netwmname, 0L, nbytes, False, + a_utf8_string, &rettype, &retfmt, &nitems, &nextra, &prop); if (status != Success) { XFree(prop); return (NULL); } - if (rettype != stype) { + if (rettype != a_utf8_string) { XFree(prop); return (NULL); } - *slen = nitems; return (prop); } @@ -3348,7 +3345,6 @@ uniconify(struct swm_region *r, union arg *args) FILE *lfile; unsigned char *name; int count = 0; - unsigned long len; DNPRINTF(SWM_D_MISC, "uniconify\n"); @@ -3380,8 +3376,7 @@ uniconify(struct swm_region *r, union arg *args) if (win->iconic == 0) continue; - name = get_win_name(display, win->id, a_netwmname, - a_utf8_string, &len); + name = get_win_name(display, win->id); if (name == NULL) continue; fprintf(lfile, "%s.%lu\n", name, win->id); @@ -3538,8 +3533,7 @@ search_resp_uniconify(char *resp, unsigned long len) TAILQ_FOREACH(win, &search_r->ws->winlist, entry) { if (win->iconic == 0) continue; - name = get_win_name(display, win->id, a_netwmname, - a_utf8_string, &len); + name = get_win_name(display, win->id); if (name == NULL) continue; if (asprintf(&s, "%s.%lu", name, win->id) == -1) {