+ if (focus_mode != SWM_FOCUS_FOLLOW)
+ pws->focus = pws->focus_pending;
+
+ if (focus_mode != SWM_FOCUS_FOLLOW)
+ pws->focus_pending = NULL;
+ }
+
+ /* Don't unmap parent if new ws is visible */
+ if (nws->r == NULL)
+ unmap_window(parent);
+
+ /* Transfer */
+ TAILQ_REMOVE(&ws->winlist, parent, entry);
+ TAILQ_INSERT_TAIL(&nws->winlist, parent, entry);
+ parent->ws = nws;
+
+ DNPRINTF(SWM_D_PROP, "send_to_ws: set "
+ "property: _SWM_WS: %s\n", ws_idx_str);
+ xcb_change_property(conn, XCB_PROP_MODE_REPLACE,
+ parent->id, a_swm_ws, XCB_ATOM_STRING, 8,
+ strlen(ws_idx_str), ws_idx_str);
+ }
+ }
+
+ unfocus_win(win);
+
+ /* Don't unmap if new ws is visible */
+ if (nws->r == NULL)
+ unmap_window(win);
+
+ /* Transfer */
+ TAILQ_REMOVE(&ws->winlist, win, entry);
+ TAILQ_INSERT_TAIL(&nws->winlist, win, entry);
+ win->ws = nws;
+
+ /* Set focus on new ws. */
+ unfocus_win(nws->focus);
+ nws->focus = win;
+
+ DNPRINTF(SWM_D_PROP, "send_to_ws: set property: _SWM_WS: %s\n",
+ ws_idx_str);
+ xcb_change_property(conn, XCB_PROP_MODE_REPLACE, win->id,
+ a_swm_ws, XCB_ATOM_STRING, 8, strlen(ws_idx_str),
+ ws_idx_str);
+
+ /* Restack and set new focus. */
+ stack();
+
+ if (focus_mode != SWM_FOCUS_FOLLOW) {
+ focus_win(ws->focus_pending);
+ ws->focus_pending = NULL;
+ }
+
+ focus_flush();
+ }
+
+ DNPRINTF(SWM_D_MOVE, "send_to_ws: done.\n");
+}
+
+void
+pressbutton(struct swm_region *r, union arg *args)
+{