Пример #1
0
void client_update_title(Client *c) {
	if(!gettextprop(c->win, NetWMName, c->name, sizeof c->name)) {
		if(!gettextprop(c->win, XCB_ATOM_WM_NAME, c->name, sizeof c->name)) {
			strcpy(c->name, "broken");
		}
	}
}
Пример #2
0
static int xwinfs_read(const char *path, char *buf, size_t size, off_t offset,
                       struct fuse_file_info *fi)
{
    size_t len;
    (void) fi;
    char data[256];
    Window w;
    Atom a;
    int n;
    char *name, *parent;

    bzero(data, 256);
    name = winfs_basename(path);
    parent = winfs_basename(winfs_dirname(path));
    if ((w = valid_client(parent))) {
        if(strcmp(name, "name") == 0) {
            if(!gettextprop(w, atoms[WindowName], data, sizeof data))
                gettextprop(w, atoms[WmName], data, sizeof data);
        } else {
            a = XInternAtom(dpy, name, False);
            sprintf(data, "%s", atom2string(w, a, &n));
            size = n;
        }
    } else
        return -ENOENT;

    len = strlen(data);
    if (offset < len) {
        if (offset + size > len)
            size = len - offset;
        memcpy(buf, data + offset, size);
    } else
        size = 0;

    return size;
}
Пример #3
0
void client_update_title(Client* client) {
    gettextprop(client->window, g_netatom[NetWmName], client->title, sizeof(client->title));
    if(client->title[0] == '\0')
       strcpy(client->title, "broken");
}