X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=src%2Ffloating.c;h=6cc9a16817adbac4574f5b7538cf18fc5fc44e93;hb=c3b4006f6b11578020238b1aa3d51eeab80d29e3;hp=fe878f75420185ae72ff76ceaddb097a3714fd7e;hpb=f162e7efaa4817c327d84c79854a5c3102a60105;p=i3%2Fi3 diff --git a/src/floating.c b/src/floating.c index fe878f75..6cc9a168 100644 --- a/src/floating.c +++ b/src/floating.c @@ -175,7 +175,8 @@ void floating_disable(Con *con, bool automatic) { /* 3: re-attach to the parent of the currently focused con on the workspace * this floating con was on */ - Con *focused = con_descend_focused(con_get_workspace(con)); + Con *focused = con_descend_tiling_focused(con_get_workspace(con)); + /* if there is no other container on this workspace, focused will be the * workspace itself */ if (focused->type == CT_WORKSPACE) @@ -230,10 +231,10 @@ DRAGGING_CB(drag_window_callback) { /* Reposition the client correctly while moving */ con->rect.x = old_rect->x + (new_x - event->root_x); con->rect.y = old_rect->y + (new_y - event->root_y); - /* TODO: don’t re-render the whole tree just because we change - * coordinates of a floating window */ - tree_render(); - x_push_changes(croot); + + render_con(con, false); + x_push_node(con, true); + xcb_flush(conn); } /* @@ -373,19 +374,15 @@ void drag_pointer(Con *con, xcb_button_press_event_t *event, xcb_window_t while ((inside_event = xcb_wait_for_event(conn))) { /* We now handle all events we can get using xcb_poll_for_event */ do { - /* Same as get_event_handler in xcb */ - int nr = inside_event->response_type; - if (nr == 0) { - /* An error occured */ - //handle_event(NULL, conn, inside_event); + /* skip x11 errors */ + if (inside_event->response_type == 0) { free(inside_event); continue; } - assert(nr < 256); - nr &= XCB_EVENT_RESPONSE_TYPE_MASK; - assert(nr >= 2); + /* Strip off the highest bit (set if the event is generated) */ + int type = (inside_event->response_type & 0x7F); - switch (nr) { + switch (type) { case XCB_BUTTON_RELEASE: goto done; @@ -397,13 +394,13 @@ void drag_pointer(Con *con, xcb_button_press_event_t *event, xcb_window_t case XCB_UNMAP_NOTIFY: DLOG("Unmap-notify, aborting\n"); - xcb_event_handle(&evenths, inside_event); + handle_event(type, inside_event); goto done; default: DLOG("Passing to original handler\n"); /* Use original handler */ - xcb_event_handle(&evenths, inside_event); + handle_event(type, inside_event); break; } if (last_motion_notify != inside_event)