[hackers] [wmii] Send synthetic unmap events to affected windows, whatever their destination. This needs testing. (Fixes issue #184) || Kris Maglione

From: <hg_AT_suckless.org>
Date: Fri, 28 May 2010 19:51:14 +0000 (UTC)

changeset: 2667:e041f7ee20fe
tag: tip
user: Kris Maglione <kris_AT_suckless.org>
date: Fri May 28 15:51:00 2010 -0400
files: cmd/wmii/client.c cmd/wmii/dat.h cmd/wmii/event.c lib/libstuff/event/mapnotify.c lib/libstuff/event/reparentnotify.c lib/libstuff/event/unmapnotify.c lib/libstuff/x11/windows/reparentwindow.c
description:
Send synthetic unmap events to affected windows, whatever their destination. This needs testing. (Fixes issue #184)

diff -r abd1443bf69b -r e041f7ee20fe cmd/wmii/client.c
--- a/cmd/wmii/client.c Fri May 28 13:32:18 2010 -0400
+++ b/cmd/wmii/client.c Fri May 28 15:51:00 2010 -0400
@@ -944,9 +944,8 @@
         Client *c;
         
         c = aux;
- if(!e->send_event)
- c->unmapped--;
- client_destroy(c);
+ if(e->send_event || c->w.unmapped < 0)
+ client_destroy(c);
         return false;
 }
 
diff -r abd1443bf69b -r e041f7ee20fe cmd/wmii/dat.h
--- a/cmd/wmii/dat.h Fri May 28 13:32:18 2010 -0400
+++ b/cmd/wmii/dat.h Fri May 28 15:51:00 2010 -0400
@@ -161,7 +161,6 @@
         long proto;
         uint border;
         int fullscreen;
- int unmapped;
         bool floating;
         bool fixedsize;
         bool urgent;
diff -r abd1443bf69b -r e041f7ee20fe cmd/wmii/event.c
--- a/cmd/wmii/event.c Fri May 28 13:32:18 2010 -0400
+++ b/cmd/wmii/event.c Fri May 28 15:51:00 2010 -0400
@@ -11,16 +11,6 @@
 }
 
 void
-event_buttonpress(XButtonPressedEvent *ev) {
- Window *w;
-
- if((w = findwin(ev->window)))
- event_handle(w, bdown, ev);
- else
- XAllowEvents(display, ReplayPointer, ev->time);
-}
-
-void
 event_configurenotify(XConfigureEvent *ev) {
         Window *w;
 
@@ -110,11 +100,13 @@
 
 void
 event_mapnotify(XMapEvent *ev) {
- Window *w;
+ Window *w;
 
- ignoreenter = ev->serial;
- if((w = findwin(ev->window)))
- event_handle(w, map, ev);
+ ignoreenter = ev->serial;
+ if((w = findwin(ev->event)))
+ event_handle(w, map, ev);
+ if(ev->send_event && (w = findwin(ev->event)))
+ event_handle(w, map, ev);
 }
 
 void
@@ -122,10 +114,15 @@
         Window *w;
 
         ignoreenter = ev->serial;
- if((w = findwin(ev->window)) && (ev->event == w->parent->xid)) {
- w->mapped = false;
- if(ev->send_event || w->unmapped-- == 0)
+ if((w = findwin(ev->window))) {
+ if(!ev->send_event)
+ w->mapped = false;
+ if(!ev->send_event && ev->event == ev->window)
+ w->unmapped--;
+ if(ev->send_event && ev->event != ev->window)
                         event_handle(w, unmap, ev);
         }
+ if((w = findwin(ev->event)))
+ event_handle(w, unmap, ev);
 }
 
diff -r abd1443bf69b -r e041f7ee20fe lib/libstuff/event/mapnotify.c
--- a/lib/libstuff/event/mapnotify.c Fri May 28 13:32:18 2010 -0400
+++ b/lib/libstuff/event/mapnotify.c Fri May 28 15:51:00 2010 -0400
@@ -9,4 +9,6 @@
 
         if((w = findwin(ev->event)))
                 event_handle(w, map, ev);
+ if(ev->send_event && (w = findwin(ev->event)))
+ event_handle(w, map, ev);
 }
diff -r abd1443bf69b -r e041f7ee20fe lib/libstuff/event/reparentnotify.c
--- a/lib/libstuff/event/reparentnotify.c Fri May 28 13:32:18 2010 -0400
+++ b/lib/libstuff/event/reparentnotify.c Fri May 28 15:51:00 2010 -0400
@@ -9,4 +9,6 @@
 
         if((w = findwin(ev->event)))
                 event_handle(w, reparent, ev);
+ if(ev->send_event && (w = findwin(ev->window)))
+ event_handle(w, reparent, ev);
 }
diff -r abd1443bf69b -r e041f7ee20fe lib/libstuff/event/unmapnotify.c
--- a/lib/libstuff/event/unmapnotify.c Fri May 28 13:32:18 2010 -0400
+++ b/lib/libstuff/event/unmapnotify.c Fri May 28 15:51:00 2010 -0400
@@ -7,9 +7,14 @@
 event_unmapnotify(XUnmapEvent *ev) {
         Window *w;
 
- if((w = findwin(ev->window)) && (ev->event == w->parent->xid)) {
- w->mapped = false;
- if(w->parent && (ev->send_event || w->unmapped-- == 0))
+ if((w = findwin(ev->window))) {
+ if(!ev->send_event)
+ w->mapped = false;
+ if(!ev->send_event && ev->event == ev->window)
+ w->unmapped--;
+ if(ev->send_event && ev->event != ev->window)
                         event_handle(w, unmap, ev);
         }
+ if((w = findwin(ev->event)))
+ event_handle(w, unmap, ev);
 }
diff -r abd1443bf69b -r e041f7ee20fe lib/libstuff/x11/windows/reparentwindow.c
--- a/lib/libstuff/x11/windows/reparentwindow.c Fri May 28 13:32:18 2010 -0400
+++ b/lib/libstuff/x11/windows/reparentwindow.c Fri May 28 15:51:00 2010 -0400
@@ -7,6 +7,7 @@
 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 Fri May 28 2010 - 19:51:14 UTC

This archive was generated by hypermail 2.2.0 : Fri May 28 2010 - 20:00:09 UTC