+/*
+ * Checks if con’s coordinates are within its workspace and re-assigns it to
+ * the actual workspace if not.
+ *
+ */
+bool floating_maybe_reassign_ws(Con *con) {
+ Output *output = get_output_containing(
+ con->rect.x + (con->rect.width / 2),
+ con->rect.y + (con->rect.height / 2));
+
+ if (!output) {
+ ELOG("No output found at destination coordinates?\n");
+ return false;
+ }
+
+ if (con_get_output(con) == output->con) {
+ DLOG("still the same ws\n");
+ return false;
+ }
+
+ DLOG("Need to re-assign!\n");
+
+ Con *content = output_get_content(output->con);
+ Con *ws = TAILQ_FIRST(&(content->focus_head));
+ DLOG("Moving con %p / %s to workspace %p / %s\n", con, con->name, ws, ws->name);
+ con_move_to_workspace(con, ws);
+ con_focus(con_descend_focused(con));
+ return true;
+}
+