void manage(Window w, XWindowAttributes *wa) { Client *c, *t; Window trans; c = emallocz(sizeof(Client)); c->win = w; c->x = wa->x; c->y = wa->y; c->w = wa->width; c->h = wa->height; if(c->w == sw && c->h == sh) { c->border = 0; c->x = sx; c->y = sy; } else { c->border = BORDERPX; if(c->x + c->w + 2 * c->border > sx + sw) c->x = sx + sw - c->w - 2 * c->border; if(c->y + c->h + 2 * c->border > sy + sh) c->y = sy + sh - c->h - 2 * c->border; if(c->x < sx) c->x = sx; if(c->y < sy) c->y = sy; } updatesizehints(c); XSelectInput(dpy, c->win, StructureNotifyMask | PropertyChangeMask | EnterWindowMask); XGetTransientForHint(dpy, c->win, &trans); XSetWindowBorder(dpy, c->win, normcol); updatetitle(c); if((t = getclient(trans))) c->view = t->view; else c->view = view; if(clients) clients->prev = c; c->next = clients; c->snext = stack; stack = clients = c; XMoveWindow(dpy, c->win, c->x + 2 * sw, c->y); XMapWindow(dpy, c->win); setclientstate(c, NormalState); if(c->view == view) focus(c); arrange(); }
void propertynotify(XEvent* event) { // printf("name is: PropertyNotify\n"); XPropertyEvent *ev = &event->xproperty; HSClient* client; if (ev->state == PropertyNewValue) { if (is_ipc_connectable(event->xproperty.window)) { ipc_handle_connection(event->xproperty.window); } else if((client = get_client_from_window(ev->window))) { if (ev->atom == XA_WM_HINTS) { client_update_wm_hints(client); } else if (ev->atom == XA_WM_NORMAL_HINTS) { updatesizehints(client); HSMonitor* m = find_monitor_with_tag(client->tag); if (m) monitor_apply_layout(m); } else if (ev->atom == XA_WM_NAME || ev->atom == g_netatom[NetWmName]) { client_update_title(client); } } } }
static void propertynotify(XEvent *e) { Client *c; Window trans; XPropertyEvent *ev = &e->xproperty; if(ev->state == PropertyDelete) return; /* ignore */ if((c = getclient(ev->window))) { switch (ev->atom) { default: break; case XA_WM_TRANSIENT_FOR: XGetTransientForHint(dpy, c->win, &trans); if(!c->isfloat && (c->isfloat = (trans != 0))) arrange(); break; case XA_WM_NORMAL_HINTS: updatesizehints(c); break; } } }