- workspace_show(workspace);
-
- /* If a workspace has an active fullscreen container, one of its
- * children should always be focused. The above workspace_show()
- * should be adequate for that, so return. */
- if (con_get_fullscreen_con(workspace, CF_OUTPUT))
- return true;
-
- Con *focus = con_descend_direction(workspace, direction);
-
- /* special case: if there was no tiling con to focus and the workspace
- * has a floating con in the focus stack, focus the top of the focus
- * stack (which may be floating) */
- if (focus == workspace)
- focus = con_descend_focused(workspace);
-
- if (focus) {
- con_focus(focus);
- x_set_warp_to(&(focus->rect));
+ /* Use descend_focused first to give higher priority to floating or
+ * tiling fullscreen containers. */
+ Con *focus = con_descend_focused(workspace);
+ if (focus->fullscreen_mode == CF_NONE) {
+ Con *focus_tiling = con_descend_tiling_focused(workspace);
+ /* If descend_tiling returned a workspace then focus is either a
+ * floating container or the same workspace. */
+ if (focus_tiling != workspace) {
+ focus = focus_tiling;
+ }