ClientMessage bug

This commit is contained in:
seanpringle
2012-09-11 17:08:13 +10:00
parent 323da794f5
commit cdaca35a6f
2 changed files with 8 additions and 13 deletions

16
xoat.c
View File

@@ -147,10 +147,8 @@ void ewmh_client_list()
memset(&wins, 0, sizeof(stack)); memset(&wins, 0, sizeof(stack));
for_windows_rev(i, c) if (c->manage) for_windows_rev(i, c) if (c->manage)
{
wins.clients[wins.depth] = c;
wins.windows[wins.depth++] = c->window; wins.windows[wins.depth++] = c->window;
}
window_set_window_prop(root, atoms[_NET_CLIENT_LIST_STACKING], wins.windows, wins.depth); window_set_window_prop(root, atoms[_NET_CLIENT_LIST_STACKING], wins.windows, wins.depth);
// hack for now, since we dont track window mapping history // hack for now, since we dont track window mapping history
window_set_window_prop(root, atoms[_NET_CLIENT_LIST], wins.windows, wins.depth); window_set_window_prop(root, atoms[_NET_CLIENT_LIST], wins.windows, wins.depth);
@@ -741,11 +739,6 @@ void button_press(XEvent *ev)
XAllowEvents(display, ReplayPointer, CurrentTime); XAllowEvents(display, ReplayPointer, CurrentTime);
} }
message messages[ATOMS] = {
[_NET_ACTIVE_WINDOW] = client_activate,
[_NET_CLOSE_WINDOW] = client_close,
};
void client_message(XEvent *ev) void client_message(XEvent *ev)
{ {
XClientMessageEvent *e = &ev->xclient; XClientMessageEvent *e = &ev->xclient;
@@ -760,8 +753,11 @@ void client_message(XEvent *ev)
execsh(self); execsh(self);
} }
client *c = window_build_client(e->window); client *c = window_build_client(e->window);
if (c && c->manage && messages[e->message_type]) if (c && c->manage)
messages[e->message_type](c); {
if (e->message_type == atoms[_NET_ACTIVE_WINDOW]) client_activate(c);
if (e->message_type == atoms[_NET_CLOSE_WINDOW]) client_close(c);
}
client_free(c); client_free(c);
} }

5
xoat.h
View File

@@ -113,11 +113,11 @@ Window current = None;
stack windows, snapshot; stack windows, snapshot;
#define for_windows(i,c)\ #define for_windows(i,c)\
for ((i) = 0, query_windows(); (i) < windows.depth; (i)++)\ for (query_windows(), (i) = 0; (i) < windows.depth; (i)++)\
if (((c) = windows.clients[(i)])) if (((c) = windows.clients[(i)]))
#define for_windows_rev(i,c)\ #define for_windows_rev(i,c)\
for ((i) = windows.depth-1, query_windows(); (i) > -1; (i)--)\ for (query_windows(), (i) = windows.depth-1; (i) > -1; (i)--)\
if (((c) = windows.clients[(i)])) if (((c) = windows.clients[(i)]))
#define for_spots(i)\ #define for_spots(i)\
@@ -195,7 +195,6 @@ enum {
typedef void (*handler)(XEvent*); typedef void (*handler)(XEvent*);
typedef void (*action)(void*, int, client*); typedef void (*action)(void*, int, client*);
typedef void (*message)(client*);
typedef struct { typedef struct {
unsigned int mod; unsigned int mod;