wmii

git clone git://oldgit.suckless.org/wmii/
Log | Files | Refs | README | LICENSE

commit 6b835653185e4b025d6a63a6dd2e71844f89d3f4
parent 7d808e3955f1241824fb047c1f111eb423cd147e
Author: Anselm R. Garbe <garbeam@wmii.de>
Date:   Tue, 11 Jul 2006 12:12:29 +0200

removed wm_atoms handling (was basically only necessary for client state changes (we don't use them anymore) and for WM_PROTOCOL_DELET (we simply use XKillClient now for simplicity reasons)


Diffstat:
cmd/wm/client.c | 36+-----------------------------------
cmd/wm/wm.c | 44--------------------------------------------
cmd/wm/wm.h | 11-----------
3 files changed, 1 insertion(+), 90 deletions(-)

diff --git a/cmd/wm/client.c b/cmd/wm/client.c @@ -100,7 +100,6 @@ create_client(Window w, XWindowAttributes *wa) c->rect.width = wa->width; c->rect.height = wa->height; XSetWindowBorderWidth(blz.dpy, c->win, 0); - c->proto = win_proto(c->win); XGetTransientForHint(blz.dpy, c->win, &c->trans); if(!XGetWMNormalHints(blz.dpy, c->win, &c->size, &msize) || !c->size.flags) c->size.flags = PSize; @@ -136,14 +135,6 @@ create_client(Window w, XWindowAttributes *wa) } void -set_client_state(Client * c, int state) -{ - long data[] = { state, None }; - XChangeProperty(blz.dpy, c->win, wm_atom[WMState], wm_atom[WMState], 32, - PropModeReplace, (unsigned char *) data, 2); -} - -void update_client_grab(Client *c, Bool is_sel) { if(is_sel) { @@ -206,7 +197,6 @@ map_client(Client *c) XSelectInput(blz.dpy, c->win, CLIENT_MASK & ~StructureNotifyMask); XMapWindow(blz.dpy, c->win); XSelectInput(blz.dpy, c->win, CLIENT_MASK); - set_client_state(c, NormalState); } void @@ -215,7 +205,6 @@ unmap_client(Client *c) XSelectInput(blz.dpy, c->win, CLIENT_MASK & ~StructureNotifyMask); XUnmapWindow(blz.dpy, c->win); XSelectInput(blz.dpy, c->win, CLIENT_MASK); - set_client_state(c, WithdrawnState); } void @@ -251,28 +240,10 @@ configure_client(Client *c) XSync(blz.dpy, False); } -static void -send_client_message(Window w, Atom a, long value) -{ - XEvent e; - e.type = ClientMessage; - e.xclient.window = w; - e.xclient.message_type = a; - e.xclient.format = 32; - e.xclient.data.l[0] = value; - e.xclient.data.l[1] = CurrentTime; - - XSendEvent(blz.dpy, w, False, NoEventMask, &e); - XSync(blz.dpy, False); -} - void kill_client(Client * c) { - if(c->proto & WM_PROTOCOL_DELWIN) - send_client_message(c->win, wm_atom[WMProtocols], wm_atom[WMDelete]); - else - XKillClient(blz.dpy, c->win); + XKillClient(blz.dpy, c->win); } void @@ -280,11 +251,6 @@ prop_client(Client *c, XPropertyEvent *e) { long msize; - if(e->atom == wm_atom[WMProtocols]) { - /* update */ - c->proto = win_proto(c->win); - return; - } switch (e->atom) { case XA_WM_TRANSIENT_FOR: XGetTransientForHint(blz.dpy, c->win, &c->trans); diff --git a/cmd/wm/wm.c b/cmd/wm/wm.c @@ -63,53 +63,9 @@ scan_wins() XFree(wins); } -static int -win_property(Window w, Atom a, Atom t, long l, unsigned char **prop) -{ - Atom real; - int format; - unsigned long res, extra; - int status; - - status = XGetWindowProperty(blz.dpy, w, a, 0L, l, False, t, &real, &format, - &res, &extra, prop); - - if(status != Success || *prop == 0) { - return 0; - } - if(res == 0) { - free((void *) *prop); - } - return res; -} - -int -win_proto(Window w) -{ - Atom *protocols; - long res; - int protos = 0; - int i; - - res = win_property(w, wm_atom[WMProtocols], XA_ATOM, 20L, - ((unsigned char **) &protocols)); - if(res <= 0) { - return protos; - } - for(i = 0; i < res; i++) { - if(protocols[i] == wm_atom[WMDelete]) - protos |= WM_PROTOCOL_DELWIN; - } - free((char *) protocols); - return protos; -} - static void init_atoms() { - wm_atom[WMState] = XInternAtom(blz.dpy, "WM_STATE", False); - wm_atom[WMProtocols] = XInternAtom(blz.dpy, "WM_PROTOCOLS", False); - wm_atom[WMDelete] = XInternAtom(blz.dpy, "WM_DELETE_WINDOW", False); net_atom[NetSupported] = XInternAtom(blz.dpy, "_NET_SUPPORTED", False); net_atom[NetWMName] = XInternAtom(blz.dpy, "_NET_WM_NAME", False); tags_atom = XInternAtom(blz.dpy, "_WIN_TAGS", False); diff --git a/cmd/wm/wm.h b/cmd/wm/wm.h @@ -11,14 +11,6 @@ #include <ixp.h> #include <blitz.h> -/* WM atoms */ -enum { - WMState, - WMProtocols, - WMDelete, - WMLast -}; - /* NET atoms */ enum { NetSupported, @@ -102,7 +94,6 @@ struct Client { char props[512]; unsigned short id; unsigned int border; - int proto; Bool floating; Bool fixedsize; Window win; @@ -189,7 +180,6 @@ unsigned int num_screens; Blitz blz; GC xorgc; char *user; -Atom wm_atom[WMLast]; Atom net_atom[NetLast]; Atom tags_atom; Cursor cursor[CurLast]; @@ -324,5 +314,4 @@ void update_views(); unsigned int newcolw_of_view(View *v); /* wm.c */ -int win_proto(Window w); int wmii_error_handler(Display *dpy, XErrorEvent *error);