+#include "efence.h"
+
#include "screen.h"
#include "window.h"
#include "list.h"
sc = display_screen_from_root(dpy, cev->parent);
if (!sc) break;
w = screen_add_window(sc, cev->window);
- printf("created 0x%x\n", w);
break;
}
case XCB_DESTROY_NOTIFY:
sc = display_screen_from_root(dpy, dev->event);
if (!sc) break;
w = screen_find_window(sc, dev->window);
- printf("destroyed 0x%x\n", w);
vis = window_is_mapped(w);
- sc->window_hide(w);
+ if (vis)
+ sc->window_hide(w);
screen_remove_window(sc, w);
if (vis) screen_refresh(sc);
break;
if (rev->parent == sc->super.root)
screen_add_window(sc, rev->window);
else {
- sc->window_hide(w);
+ if (window_is_mapped(w))
+ sc->window_hide(w);
screen_remove_window(sc, w);
- printf("reparent lost 0x%x\n", w);
}
- screen_refresh(w->sc);
+ screen_refresh(sc);
break;
}
case XCB_MAP_NOTIFY:
sc = display_screen_from_root(dpy, mev->event);
if (!sc) break;
w = screen_find_window(sc, mev->window);
- printf("mapping 0x%x\n", w);
sc->window_show(w);
screen_refresh(w->sc);
break;
cev = (xcb_configure_notify_event_t*)ev;
sc = display_screen_from_root(dpy, cev->event);
if (!sc) break;
+ //printf("configure 0x%x", cev->window);
w = screen_find_window(sc, cev->window);
window_get_area(w, &x, &y, &width, &height, &bwidth);
if (x != cev->x || y != cev->y || width != cev->width ||
window_configure(w, cev->x, cev->y,
cev->width, cev->height,
cev->border_width);
- if (window_is_mapped(w) &&
- (width != cev->width ||
- height != cev->height || bwidth != cev->border_width))
- sc->window_resize(w);
+ if (window_is_mapped(w)) {
+ if (x != cev->x || y != cev->y)
+ sc->window_move(w);
+ if (width != cev->width ||
+ height != cev->height || bwidth != cev->border_width)
+ sc->window_resize(w);
+ }
}
above = screen_find_window(sc, cev->above_sibling);
screen_stacking_move_above(sc, w, above);
for (sc_it = list_top(dpy->screens); sc_it; sc_it = sc_it->next) {
d_screen_t *sc = sc_it->data;
d_list_it_t *it;
- for (it = list_top(sc->stacking); it; it = it->next)
- if (window_is_mapped(it->data))
+ for (it = list_bottom(sc->stacking); it; it = it->prev)
+ if (window_is_mapped(it->data)) {
+ /* make the window think it is unmapped so that the
+ show works right */
+ window_fake_unmapped(it->data);
sc->window_show(it->data);
+ }
}
}
for (sc_it = list_top(dpy->screens); sc_it; sc_it = sc_it->next) {
d_screen_t *sc = sc_it->data;
d_list_it_t *it;
- for (it = list_top(sc->stacking); it; it = it->next)
- sc->window_hide(it->data);
+ for (it = list_top(sc->stacking); it; it = it->next) {
+ if (window_is_mapped(it->data))
+ sc->window_hide(it->data);
+ }
}
}