From 0ed70ce9532bbb9b270ee5556704a80dc66a661e Mon Sep 17 00:00:00 2001 From: garbeam Date: Mon, 12 Dec 2005 20:06:10 +0200 Subject: [PATCH] cleaned up things --- cmd/wm/client.c | 9 ++------- cmd/wm/event.c | 13 +++++++++---- cmd/wm/wm.c | 19 ++++++++++++++++--- cmd/wm/wm.h | 1 + libwmii/wm.c | 2 +- 5 files changed, 29 insertions(+), 15 deletions(-) diff --git a/cmd/wm/client.c b/cmd/wm/client.c index 83c10534..69b910da 100644 --- a/cmd/wm/client.c +++ b/cmd/wm/client.c @@ -134,21 +134,16 @@ void init_client(Client * c, XWindowAttributes * wa) XSetWindowBorderWidth(dpy, c->win, 0); c->proto = win_proto(c->win); XGetTransientForHint(dpy, c->win, &c->trans); - /* size hints */ - if (!XGetWMNormalHints(dpy, c->win, &c->size, &msize) - || !c->size.flags) + if (!XGetWMNormalHints(dpy, c->win, &c->size, &msize) || !c->size.flags) c->size.flags = PSize; XAddToSaveSet(dpy, c->win); } -void handle_client_property(Client * c, XPropertyEvent * e) +void handle_client_property(Client *c, XPropertyEvent *e) { XTextProperty name; long msize; - if (e->state == PropertyDelete) - return; /* ignore */ - if (e->atom == wm_protocols) { /* update */ c->proto = win_proto(c->win); diff --git a/cmd/wm/event.c b/cmd/wm/event.c index ee5bf63b..74f5337f 100644 --- a/cmd/wm/event.c +++ b/cmd/wm/event.c @@ -196,8 +196,11 @@ static void handle_maprequest(XEvent * e) fprintf(stderr, "%s\n", "handle_maprequest"); if (!XGetWindowAttributes(dpy, ev->window, &wa)) return; - if (wa.override_redirect) + if (wa.override_redirect) { + XSelectInput(dpy, ev->window, (StructureNotifyMask | PropertyChangeMask)); return; + } + /* there're client which send map requests twice */ c = win_to_client(ev->window); if (!c) @@ -225,10 +228,12 @@ static void handle_motionnotify(XEvent * e) static void handle_propertynotify(XEvent * e) { XPropertyEvent *ev = &e->xproperty; - Client *c = win_to_client(ev->window); + Client *c; - fprintf(stderr, "%s\n", "handle_propertynotify"); - if (c) + if (ev->state == PropertyDelete) + return; /* ignore */ + + if ((c = win_to_client(ev->window))) handle_client_property(c, ev); } diff --git a/cmd/wm/wm.c b/cmd/wm/wm.c index 0bb3af1d..0f05ddb4 100644 --- a/cmd/wm/wm.c +++ b/cmd/wm/wm.c @@ -314,7 +314,6 @@ static void draw_detached_clients() } } - static void detached_clients(void *obj, char *cmd) { XEvent ev; @@ -449,8 +448,11 @@ void scan_wins() for (i = 0; i < num; i++) { if (!XGetWindowAttributes(dpy, wins[i], &wa)) continue; - if (wa.override_redirect - || XGetTransientForHint(dpy, wins[i], &d1)) + if (wa.override_redirect) { + XSelectInput(dpy, wins[i], (StructureNotifyMask | PropertyChangeMask)); + continue; + } + if (XGetTransientForHint(dpy, wins[i], &d1)) continue; if (wa.map_state == IsViewable) { c = alloc_client(wins[i]); @@ -474,6 +476,17 @@ void *get_func(void *acttbl[][2], int rows, char *fname) return 0; } +void update_areas_sizes(Window ignore_win) +{ + XWindowAttributes wa; + + fprintf(stderr, "%s", "update_areas_sizes: \n"); + if(!XGetWindowAttributes(dpy, ignore_win, &wa)) + return; + fprintf(stderr, "update_areas_sizes: %d, %d, %d, %d\n", + wa.x, wa.y, wa.width, wa.height); +} + int win_proto(Window w) { Atom *protocols; diff --git a/cmd/wm/wm.h b/cmd/wm/wm.h index 4956492f..a34ff4be 100644 --- a/cmd/wm/wm.h +++ b/cmd/wm/wm.h @@ -285,3 +285,4 @@ int win_state(Window w); void handle_after_write(IXPServer * s, File * f); void detach(Frame * f, int client_destroyed); void set_client_state(Client * c, int state); +void update_areas_sizes(Window ignore_win); diff --git a/libwmii/wm.c b/libwmii/wm.c index fb4dc0c9..d1245562 100644 --- a/libwmii/wm.c +++ b/libwmii/wm.c @@ -31,7 +31,7 @@ int wmii_property(Display * dpy, Window w, Atom a, Atom t, long l, unsigned char return res; } -void wmii_send_message(Display * dpy, Window w, Atom a, long value) +void wmii_send_message(Display *dpy, Window w, Atom a, long value) { XEvent e; e.type = ClientMessage;