changeset: 2706:60eefd645467
tag: tip
user: Kris Maglione <kris_AT_suckless.org>
date: Fri Jun 04 20:37:05 2010 -0400
files: cmd/tray/tray.c cmd/wmii/client.c cmd/wmii/key.c lib/libstuff/event/reparentnotify.c lib/libstuff/x11/sendevent.c lib/libstuff/x11/windows/reparentwindow.c
description:
Fix some tedious client unmap bugs.
diff -r 5637453286cb -r 60eefd645467 cmd/tray/tray.c
--- a/cmd/tray/tray.c Fri Jun 04 19:38:35 2010 -0400
+++ b/cmd/tray/tray.c Fri Jun 04 20:37:05 2010 -0400
@@ -103,6 +103,17 @@
}
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 @@
}
if(eqpt(offset, padding))
- unmapwin(tray.win);
+ tray_unmap();
else {
if(tray.orientation == OHorizontal)
offset.y += tray.iconsize + tray.padding;
diff -r 5637453286cb -r 60eefd645467 cmd/wmii/client.c
--- a/cmd/wmii/client.c Fri Jun 04 19:38:35 2010 -0400
+++ b/cmd/wmii/client.c Fri Jun 04 20:37:05 2010 -0400
@@ -601,24 +601,22 @@
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;
+ sendevent(&c->w, false, StructureNotifyMask,
+ &(XConfigureEvent) {
+ .type = ConfigureNotify,
+ .event = c->w.xid,
+ .window = c->w.xid,
- 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);
+ .x = r.min.x,
+ .y = r.min.y,
+ .width = Dx(r),
+ .height = Dy(r),
+ .border_width = c->border,
+ });
}
void
@@ -988,6 +986,8 @@
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 -r 5637453286cb -r 60eefd645467 cmd/wmii/key.c
--- a/cmd/wmii/key.c Fri Jun 04 19:38:35 2010 -0400
+++ b/cmd/wmii/key.c Fri Jun 04 20:37:05 2010 -0400
@@ -145,7 +145,6 @@
e.time = CurrentTime;
e.window = c->w.xid;
- e.display = display;
e.state = mod;
e.keycode = key;
diff -r 5637453286cb -r 60eefd645467 lib/libstuff/event/reparentnotify.c
--- a/lib/libstuff/event/reparentnotify.c Fri Jun 04 19:38:35 2010 -0400
+++ b/lib/libstuff/event/reparentnotify.c Fri Jun 04 20:37:05 2010 -0400
@@ -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 -r 5637453286cb -r 60eefd645467 lib/libstuff/x11/sendevent.c
--- a/lib/libstuff/x11/sendevent.c Fri Jun 04 19:38:35 2010 -0400
+++ b/lib/libstuff/x11/sendevent.c Fri Jun 04 20:37:05 2010 -0400
@@ -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 -r 5637453286cb -r 60eefd645467 lib/libstuff/x11/windows/reparentwindow.c
--- a/lib/libstuff/x11/windows/reparentwindow.c Fri Jun 04 19:38:35 2010 -0400
+++ b/lib/libstuff/x11/windows/reparentwindow.c Fri Jun 04 20:37:05 2010 -0400
@@ -7,8 +7,6 @@
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);
}
Received on Sat Jun 05 2010 - 00:37:20 UTC
This archive was generated by hypermail 2.2.0 : Sat Jun 05 2010 - 00:48:03 UTC