]> git.sur5r.net Git - i3/i3/blobdiff - src/floating.c
Rename new_container to workspace_layout
[i3/i3] / src / floating.c
index fe878f75420185ae72ff76ceaddb097a3714fd7e..6cc9a16817adbac4574f5b7538cf18fc5fc44e93 100644 (file)
@@ -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)