mirror of
https://github.com/0intro/wmii
synced 2024-11-21 21:31:33 +03:00
Fix some tedious client unmap bugs.
This commit is contained in:
parent
fd930e89a6
commit
ec26a17464
@ -102,6 +102,17 @@ tray_init(void) {
|
||||
tray_resize(tray.win->r);
|
||||
}
|
||||
|
||||
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;
|
||||
|
@ -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;
|
||||
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 @@ 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;
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user