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)

This commit is contained in:
Anselm R. Garbe 2006-07-11 12:12:29 +02:00
parent 7d808e3955
commit 6b83565318
3 changed files with 1 additions and 90 deletions

View File

@ -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;
@ -135,14 +134,6 @@ create_client(Window w, XWindowAttributes *wa)
return c;
}
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)
{
@ -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);

View File

@ -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);

View File

@ -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);