diff --git a/client.c b/client.c index 5ac768062..db44c1440 100644 --- a/client.c +++ b/client.c @@ -932,20 +932,25 @@ uicb_client_moveresize(int screen, char *arg) if(globalconf.screens[sel->screen].resize_hints) geometry = client_geometry_hints(sel, geometry); client_resize(sel, geometry, false); - if (xqp && ox <= xqp->root_x && (ox + 2 * sel->border + ow) >= xqp->root_x && - oy <= xqp->root_y && (oy + 2 * sel->border + oh) >= xqp->root_y) + if (xqp) { - nmx = xqp->root_x - (ox + sel->border) + sel->geometry.width - ow; - nmy = xqp->root_y - (oy + sel->border) + sel->geometry.height - oh; + if(ox <= xqp->root_x && (ox + 2 * sel->border + ow) >= xqp->root_x && + oy <= xqp->root_y && (oy + 2 * sel->border + oh) >= xqp->root_y) + { + nmx = xqp->root_x - (ox + sel->border) + sel->geometry.width - ow; + nmy = xqp->root_y - (oy + sel->border) + sel->geometry.height - oh; - if(nmx < -sel->border) /* can happen on a resize */ - nmx = -sel->border; - if(nmy < -sel->border) - nmy = -sel->border; + if(nmx < -sel->border) /* can happen on a resize */ + nmx = -sel->border; + if(nmy < -sel->border) + nmy = -sel->border; - xcb_warp_pointer(globalconf.connection, - XCB_NONE, sel->win, - 0, 0, 0, 0, nmx, nmy); + xcb_warp_pointer(globalconf.connection, + XCB_NONE, sel->win, + 0, 0, 0, 0, nmx, nmy); + } + + p_delete(&xqp); } } diff --git a/event.c b/event.c index 951870821..525268fa1 100644 --- a/event.c +++ b/event.c @@ -403,6 +403,7 @@ event_handle_keypress(void *data __attribute__ ((unused)), * number with screen_get_bycoord: we'll get 0 in Zaphod mode * so it's the same, or maybe the real Xinerama screen */ screen = screen_get_bycoord(globalconf.screens_info, screen, qpr->root_x, qpr->root_y); + p_delete(&qpr); break; } @@ -457,6 +458,9 @@ event_handle_maprequest(void *data __attribute__ ((unused)), p_delete(&wa); return 0; } + + p_delete(&wa); + if(!client_get_bywin(globalconf.clients, ev->window)) { if((wgeom = xcb_get_geometry_reply(connection, @@ -468,13 +472,14 @@ event_handle_maprequest(void *data __attribute__ ((unused)), xcb_query_pointer(connection, xcb_aux_get_screen(globalconf.connection, screen_nbr)->root), NULL)) != NULL) - screen_nbr = screen_get_bycoord(globalconf.screens_info, screen_nbr, qpr->root_x, qpr->root_y); - else - for (iter = xcb_setup_roots_iterator (xcb_get_setup (connection)), screen_nbr = 0; - iter.rem && iter.data->root != wgeom->root; xcb_screen_next (&iter), ++screen_nbr); - - if(qpr) + { + screen_nbr = screen_get_bycoord(globalconf.screens_info, screen_nbr, + qpr->root_x, qpr->root_y); p_delete(&qpr); + } + else + for(iter = xcb_setup_roots_iterator (xcb_get_setup (connection)), screen_nbr = 0; + iter.rem && iter.data->root != wgeom->root; xcb_screen_next (&iter), ++screen_nbr); client_manage(ev->window, wgeom, screen_nbr); p_delete(&wgeom); diff --git a/layout.c b/layout.c index 87f73fc6e..6083e59d2 100644 --- a/layout.c +++ b/layout.c @@ -83,12 +83,14 @@ arrange(int screen) xcb_query_pointer_unchecked(globalconf.connection, xcb_aux_get_screen(globalconf.connection, phys_screen)->root), - NULL)) != NULL - && (xqp->root == XCB_NONE || xqp->child == XCB_NONE || xqp->root == xqp->child)) + NULL)) != NULL) { - window_root_grabbuttons(phys_screen); + if(xqp->root == XCB_NONE || xqp->child == XCB_NONE || xqp->root == xqp->child) + window_root_grabbuttons(phys_screen); + globalconf.pointer_x = xqp->root_x; globalconf.pointer_y = xqp->root_y; + p_delete(&xqp); } /* reset status */ diff --git a/mouse.c b/mouse.c index f9d99b0f5..6d92a04d2 100644 --- a/mouse.c +++ b/mouse.c @@ -222,7 +222,6 @@ uicb_client_movemouse(int screen, char *arg __attribute__ ((unused))) mouse_resizebar_draw(ctx, style, sw, c->geometry, c->border); xcb_aux_sync(globalconf.connection); - p_delete(&ev); } else { diff --git a/placement.c b/placement.c index ba9ced151..d58c80fb7 100644 --- a/placement.c +++ b/placement.c @@ -141,6 +141,8 @@ placement_under_mouse(Client *c) { finalgeometry.x = xqp->root_x - c->f_geometry.width / 2; finalgeometry.y = xqp->root_y - c->f_geometry.height / 2; + + p_delete(&xqp); } finalgeometry = titlebar_geometry_add(&c->titlebar, finalgeometry);