glazier

the original window manipulator
Log | Files | Refs | Submodules | README | LICENSE

commit 87cff64d07f4fc4bcf5737fd026b6d43e12dd6da
parent 48dda2dad2bb45959ae90b0b869ad033a377c057
Author: Willy Goiffon <dev@z3bra.org>
Date:   Wed, 23 Oct 2019 08:35:49 +0200

Handle unmapping windows from display

Diffstat:
glazier.c | 21+++++++++++++++++++++
1 file changed, 21 insertions(+), 0 deletions(-)

diff --git a/glazier.c b/glazier.c @@ -26,6 +26,7 @@ static int ev_callback(xcb_generic_event_t *); /* XCB events callbacks */ static int cb_default(xcb_generic_event_t *); static int cb_mapreq(xcb_generic_event_t *); +static int cb_unmap(xcb_generic_event_t *); static int cb_destroy(xcb_generic_event_t *); static int cb_mouse_press(xcb_generic_event_t *); static int cb_mouse_release(xcb_generic_event_t *); @@ -76,6 +77,7 @@ static const char *evname[] = { static const struct ev_callback_t cb[] = { /* event, function */ { XCB_MAP_REQUEST, cb_mapreq }, + { XCB_UNMAP_NOTIFY, cb_unmap }, { XCB_DESTROY_NOTIFY, cb_destroy }, { XCB_BUTTON_PRESS, cb_mouse_press }, { XCB_BUTTON_RELEASE, cb_mouse_release }, @@ -206,6 +208,25 @@ cb_mapreq(xcb_generic_event_t *ev) } static int +cb_unmap(xcb_generic_event_t *ev) +{ + int x, y; + xcb_unmap_notify_event_t *e; + + e = (xcb_unmap_notify_event_t *)ev; + + if (verbose) + fprintf(stderr, "%s 0x%08x\n", XEV(e), e->window); + + x = wm_get_attribute(e->event, ATTR_X); + y = wm_get_attribute(e->event, ATTR_Y); + xcb_reparent_window(conn, e->window, scrn->root, x, y + titlebar); + xcb_destroy_window(conn, e->event); + + return 0; +} + +static int cb_destroy(xcb_generic_event_t *ev) { xcb_create_notify_event_t *e;