commit ec26a17464bda3aa901df6658c0d1d8e5b222c0d
parent fd930e89a6725bd83f6c7bf306924c79bf323a6e
Author: Kris Maglione <kris@suckless.org>
Date: Fri, 4 Jun 2010 20:37:05 -0400
Fix some tedious client unmap bugs.
Diffstat:
6 files changed, 34 insertions(+), 23 deletions(-)
diff --git a/cmd/tray/tray.c b/cmd/tray/tray.c
@@ -103,6 +103,17 @@ tray_init(void) {
}
static void
+tray_unmap(void) {
+ unmapwin(tray.win);
+ sendevent(&scr.root, false, SubstructureNotifyMask,
+ &(XUnmapEvent){
+ .type = UnmapNotify,
+ .event = scr.root.xid,
+ .window = tray.win->xid
+ });
+}
+
+static void
tray_draw(Rectangle r) {
int borderwidth;
@@ -194,7 +205,7 @@ tray_update(void) {
}
if(eqpt(offset, padding))
- unmapwin(tray.win);
+ tray_unmap();
else {
if(tray.orientation == OHorizontal)
offset.y += tray.iconsize + tray.padding;
diff --git a/cmd/wmii/client.c b/cmd/wmii/client.c
@@ -601,24 +601,22 @@ client_setcursor(Client *c, Cursor cur) {
void
client_configure(Client *c) {
- XConfigureEvent e;
Rectangle r;
r = rectsubpt(c->r, Pt(c->border, c->border));
- e.type = ConfigureNotify;
- e.event = c->w.xid;
- e.window = c->w.xid;
- e.above = None;
- e.override_redirect = false;
-
- e.x = r.min.x;
- e.y = r.min.y;
- e.width = Dx(r);
- e.height = Dy(r);
- e.border_width = c->border;
-
- sendevent(&c->w, false, StructureNotifyMask, &e);
+ sendevent(&c->w, false, StructureNotifyMask,
+ &(XConfigureEvent) {
+ .type = ConfigureNotify,
+ .event = c->w.xid,
+ .window = c->w.xid,
+
+ .x = r.min.x,
+ .y = r.min.y,
+ .width = Dx(r),
+ .height = Dy(r),
+ .border_width = c->border,
+ });
}
void
@@ -988,6 +986,8 @@ unmap_event(Window *w, void *aux, XUnmapEvent *e) {
Client *c;
c = aux;
+ if(!e->send_event && w->parent != c->framewin)
+ c->w.unmapped++;
if(e->send_event || c->w.unmapped < 0)
client_destroy(c);
return false;
diff --git a/cmd/wmii/key.c b/cmd/wmii/key.c
@@ -145,7 +145,6 @@ fake_keypress(ulong mod, KeyCode key) {
e.time = CurrentTime;
e.window = c->w.xid;
- e.display = display;
e.state = mod;
e.keycode = key;
diff --git a/lib/libstuff/event/reparentnotify.c b/lib/libstuff/event/reparentnotify.c
@@ -5,10 +5,13 @@
void
event_reparentnotify(XReparentEvent *ev) {
- Window *w;
+ Window *target, *w;
+ w = nil;
+ if((target = findwin(ev->window)) && (w = findwin(ev->parent)))
+ target->parent = w;
if((w = findwin(ev->event)))
event_handle(w, reparent, ev);
- if(ev->send_event && (w = findwin(ev->window)))
- event_handle(w, reparent, ev);
+ if(ev->send_event && target)
+ event_handle(target, reparent, ev);
}
diff --git a/lib/libstuff/x11/sendevent.c b/lib/libstuff/x11/sendevent.c
@@ -4,7 +4,7 @@
#include "x11.h"
void
-sendevent(Window *w, bool propegate, long mask, void *e) {
- XSendEvent(display, w->xid, propegate, mask, e);
+sendevent(Window *w, bool propagate, long mask, void *e) {
+ XSendEvent(display, w->xid, propagate, mask, e);
}
diff --git a/lib/libstuff/x11/windows/reparentwindow.c b/lib/libstuff/x11/windows/reparentwindow.c
@@ -7,8 +7,6 @@ void
reparentwindow(Window *w, Window *par, Point p) {
assert(w->type == WWindow);
XReparentWindow(display, w->xid, par->xid, p.x, p.y);
- w->unmapped++;
- w->parent = par;
w->r = rectsubpt(w->r, w->r.min);
w->r = rectaddpt(w->r, p);
}