2 #define I3__FILE__ "floating.c"
4 * vim:ts=4:sw=4:expandtab
6 * i3 - an improved dynamic tiling window manager
7 * © 2009-2011 Michael Stapelberg and contributors (see also: LICENSE)
9 * floating.c: Floating windows.
14 extern xcb_connection_t *conn;
17 * Calculates sum of heights and sum of widths of all currently active outputs
20 static Rect total_outputs_dimensions(void) {
22 /* Use Rect to encapsulate dimensions, ignoring x/y */
23 Rect outputs_dimensions = {0, 0, 0, 0};
24 TAILQ_FOREACH(output, &outputs, outputs) {
25 outputs_dimensions.height += output->rect.height;
26 outputs_dimensions.width += output->rect.width;
28 return outputs_dimensions;
31 void floating_enable(Con *con, bool automatic) {
32 bool set_focus = (con == focused);
34 if (con->parent && con->parent->type == CT_DOCKAREA) {
35 LOG("Container is a dock window, not enabling floating mode.\n");
39 if (con_is_floating(con)) {
40 LOG("Container is already in floating mode, not doing anything.\n");
44 /* 1: If the container is a workspace container, we need to create a new
45 * split-container with the same layout and make that one floating. We
46 * cannot touch the workspace container itself because floating containers
47 * are children of the workspace. */
48 if (con->type == CT_WORKSPACE) {
49 LOG("This is a workspace, creating new container around content\n");
50 if (con_num_children(con) == 0) {
51 LOG("Workspace is empty, aborting\n");
54 /* TODO: refactor this with src/con.c:con_set_layout */
55 Con *new = con_new(NULL, NULL);
57 new->layout = con->layout;
59 /* since the new container will be set into floating mode directly
60 * afterwards, we need to copy the workspace rect. */
61 memcpy(&(new->rect), &(con->rect), sizeof(Rect));
63 Con *old_focused = TAILQ_FIRST(&(con->focus_head));
64 if (old_focused == TAILQ_END(&(con->focus_head)))
67 /* 4: move the existing cons of this workspace below the new con */
68 DLOG("Moving cons\n");
70 while (!TAILQ_EMPTY(&(con->nodes_head))) {
71 child = TAILQ_FIRST(&(con->nodes_head));
73 con_attach(child, new, true);
76 /* 4: attach the new split container to the workspace */
77 DLOG("Attaching new split to ws\n");
78 con_attach(new, con, false);
81 con_focus(old_focused);
87 /* 1: detach the container from its parent */
88 /* TODO: refactor this with tree_close() */
89 TAILQ_REMOVE(&(con->parent->nodes_head), con, nodes);
90 TAILQ_REMOVE(&(con->parent->focus_head), con, focused);
92 con_fix_percent(con->parent);
94 /* 2: create a new container to render the decoration on, add
95 * it as a floating window to the workspace */
96 Con *nc = con_new(NULL, NULL);
97 /* we need to set the parent afterwards instead of passing it as an
98 * argument to con_new() because nc would be inserted into the tiling layer
100 Con *ws = con_get_workspace(con);
102 nc->type = CT_FLOATING_CON;
103 nc->layout = L_SPLITH;
104 /* We insert nc already, even though its rect is not yet calculated. This
105 * is necessary because otherwise the workspace might be empty (and get
106 * closed in tree_close()) even though it’s not. */
107 TAILQ_INSERT_TAIL(&(ws->floating_head), nc, floating_windows);
108 TAILQ_INSERT_TAIL(&(ws->focus_head), nc, focused);
110 /* check if the parent container is empty and close it if so */
111 if ((con->parent->type == CT_CON || con->parent->type == CT_FLOATING_CON) &&
112 con_num_children(con->parent) == 0) {
113 DLOG("Old container empty after setting this child to floating, closing\n");
114 tree_close(con->parent, DONT_KILL_WINDOW, false, false);
118 sasprintf(&name, "[i3 con] floatingcon around %p", con);
119 x_set_name(nc, name);
122 /* find the height for the decorations */
123 int deco_height = config.font.height + 5;
125 DLOG("Original rect: (%d, %d) with %d x %d\n", con->rect.x, con->rect.y, con->rect.width, con->rect.height);
126 DLOG("Geometry = (%d, %d) with %d x %d\n", con->geometry.x, con->geometry.y, con->geometry.width, con->geometry.height);
127 Rect zero = { 0, 0, 0, 0 };
128 nc->rect = con->geometry;
129 /* If the geometry was not set (split containers), we need to determine a
130 * sensible one by combining the geometry of all children */
131 if (memcmp(&(nc->rect), &zero, sizeof(Rect)) == 0) {
132 DLOG("Geometry not set, combining children\n");
134 TAILQ_FOREACH(child, &(con->nodes_head), nodes) {
135 DLOG("child geometry: %d x %d\n", child->geometry.width, child->geometry.height);
136 nc->rect.width += child->geometry.width;
137 nc->rect.height = max(nc->rect.height, child->geometry.height);
141 /* Define reasonable minimal and maximal sizes for floating windows */
142 const int floating_sane_min_height = 50;
143 const int floating_sane_min_width = 75;
145 Rect floating_sane_max_dimensions;
146 floating_sane_max_dimensions = total_outputs_dimensions();
148 /* Unless user requests otherwise (-1), ensure width/height do not exceed
149 * configured maxima or, if unconfigured, limit to combined width of all
151 if (config.floating_maximum_height != -1) {
152 if (config.floating_maximum_height == 0)
153 nc->rect.height = min(nc->rect.height, floating_sane_max_dimensions.height);
155 nc->rect.height = min(nc->rect.height, config.floating_maximum_height);
157 if (config.floating_maximum_width != -1) {
158 if (config.floating_maximum_width == 0)
159 nc->rect.width = min(nc->rect.width, floating_sane_max_dimensions.width);
161 nc->rect.width = min(nc->rect.width, config.floating_maximum_width);
164 /* Unless user requests otherwise (-1), raise the width/height to
165 * reasonable minimum dimensions */
166 if (config.floating_minimum_height != -1) {
167 if (config.floating_minimum_height == 0)
168 nc->rect.height = max(nc->rect.height, floating_sane_min_height);
170 nc->rect.height = max(nc->rect.height, config.floating_minimum_height);
172 if (config.floating_minimum_width != -1) {
173 if (config.floating_minimum_width == 0)
174 nc->rect.width = max(nc->rect.width, floating_sane_min_width);
176 nc->rect.width = max(nc->rect.width, config.floating_minimum_width);
179 /* 3: attach the child to the new parent container. We need to do this
180 * because con_border_style_rect() needs to access con->parent. */
183 con->floating = FLOATING_USER_ON;
185 /* 4: set the border style as specified with new_float */
187 con->border_style = config.default_floating_border;
189 /* Add pixels for the decoration. */
190 Rect border_style_rect = con_border_style_rect(con);
192 nc->rect.height -= border_style_rect.height;
193 nc->rect.width -= border_style_rect.width;
195 /* Add some more pixels for the title bar */
196 if(con_border_style(con) == BS_NORMAL)
197 nc->rect.height += deco_height;
199 /* Honor the X11 border */
200 nc->rect.height += con->border_width * 2;
201 nc->rect.width += con->border_width * 2;
203 /* Some clients (like GIMP’s color picker window) get mapped
204 * to (0, 0), so we push them to a reasonable position
205 * (centered over their leader) */
206 if (nc->rect.x == 0 && nc->rect.y == 0) {
208 if (con->window && con->window->leader != XCB_NONE &&
209 (leader = con_by_window_id(con->window->leader)) != NULL) {
210 DLOG("Centering above leader\n");
211 nc->rect.x = leader->rect.x + (leader->rect.width / 2) - (nc->rect.width / 2);
212 nc->rect.y = leader->rect.y + (leader->rect.height / 2) - (nc->rect.height / 2);
214 /* center the window on workspace as fallback */
215 nc->rect.x = ws->rect.x + (ws->rect.width / 2) - (nc->rect.width / 2);
216 nc->rect.y = ws->rect.y + (ws->rect.height / 2) - (nc->rect.height / 2);
220 /* Sanity check: Are the coordinates on the appropriate output? If not, we
221 * need to change them */
222 Output *current_output = get_output_containing(nc->rect.x +
223 (nc->rect.width / 2), nc->rect.y + (nc->rect.height / 2));
225 Con *correct_output = con_get_output(ws);
226 if (!current_output || current_output->con != correct_output) {
227 DLOG("This floating window is on the wrong output, fixing coordinates (currently (%d, %d))\n",
228 nc->rect.x, nc->rect.y);
230 /* If moving from one output to another, keep the relative position
231 * consistent (e.g. a centered dialog will remain centered). */
233 floating_fix_coordinates(nc, ¤t_output->con->rect, &correct_output->rect);
235 nc->rect.x = correct_output->rect.x;
236 nc->rect.y = correct_output->rect.y;
240 DLOG("Floating rect: (%d, %d) with %d x %d\n", nc->rect.x, nc->rect.y, nc->rect.width, nc->rect.height);
242 /* 5: Subtract the deco_height in order to make the floating window appear
243 * at precisely the position it specified in its original geometry (which
244 * is what applications might remember). */
245 deco_height = (con->border_style == BS_NORMAL ? config.font.height + 5 : 0);
246 nc->rect.y -= deco_height;
248 DLOG("Corrected y = %d (deco_height = %d)\n", nc->rect.y, deco_height);
250 TAILQ_INSERT_TAIL(&(nc->nodes_head), con, nodes);
251 TAILQ_INSERT_TAIL(&(nc->focus_head), con, focused);
253 /* render the cons to get initial window_rect correct */
254 render_con(nc, false);
255 render_con(con, false);
260 /* Check if we need to re-assign it to a different workspace because of its
261 * coordinates and exit if that was done successfully. */
262 if (floating_maybe_reassign_ws(nc))
265 /* Sanitize coordinates: Check if they are on any output */
266 if (get_output_containing(nc->rect.x, nc->rect.y) != NULL)
269 ELOG("No output found at destination coordinates, centering floating window on current ws\n");
270 nc->rect.x = ws->rect.x + (ws->rect.width / 2) - (nc->rect.width / 2);
271 nc->rect.y = ws->rect.y + (ws->rect.height / 2) - (nc->rect.height / 2);
274 void floating_disable(Con *con, bool automatic) {
275 if (!con_is_floating(con)) {
276 LOG("Container isn't floating, not doing anything.\n");
280 Con *ws = con_get_workspace(con);
282 /* 1: detach from parent container */
283 TAILQ_REMOVE(&(con->parent->nodes_head), con, nodes);
284 TAILQ_REMOVE(&(con->parent->focus_head), con, focused);
286 /* 2: kill parent container */
287 TAILQ_REMOVE(&(con->parent->parent->floating_head), con->parent, floating_windows);
288 TAILQ_REMOVE(&(con->parent->parent->focus_head), con->parent, focused);
289 tree_close(con->parent, DONT_KILL_WINDOW, true, false);
291 /* 3: re-attach to the parent of the currently focused con on the workspace
292 * this floating con was on */
293 Con *focused = con_descend_tiling_focused(ws);
295 /* if there is no other container on this workspace, focused will be the
296 * workspace itself */
297 if (focused->type == CT_WORKSPACE)
298 con->parent = focused;
299 else con->parent = focused->parent;
301 /* con_fix_percent will adjust the percent value */
304 con->floating = FLOATING_USER_OFF;
306 con_attach(con, con->parent, false);
308 con_fix_percent(con->parent);
309 // TODO: don’t influence focus handling when Con was not focused before.
314 * Toggles floating mode for the given container.
316 * If the automatic flag is set to true, this was an automatic update by a change of the
317 * window class from the application which can be overwritten by the user.
320 void toggle_floating_mode(Con *con, bool automatic) {
321 /* see if the client is already floating */
322 if (con_is_floating(con)) {
323 LOG("already floating, re-setting to tiling\n");
325 floating_disable(con, automatic);
329 floating_enable(con, automatic);
333 * Raises the given container in the list of floating containers
336 void floating_raise_con(Con *con) {
337 DLOG("Raising floating con %p / %s\n", con, con->name);
338 TAILQ_REMOVE(&(con->parent->floating_head), con, floating_windows);
339 TAILQ_INSERT_TAIL(&(con->parent->floating_head), con, floating_windows);
343 * Checks if con’s coordinates are within its workspace and re-assigns it to
344 * the actual workspace if not.
347 bool floating_maybe_reassign_ws(Con *con) {
348 Output *output = get_output_containing(
349 con->rect.x + (con->rect.width / 2),
350 con->rect.y + (con->rect.height / 2));
353 ELOG("No output found at destination coordinates?\n");
357 if (con_get_output(con) == output->con) {
358 DLOG("still the same ws\n");
362 DLOG("Need to re-assign!\n");
364 Con *content = output_get_content(output->con);
365 Con *ws = TAILQ_FIRST(&(content->focus_head));
366 DLOG("Moving con %p / %s to workspace %p / %s\n", con, con->name, ws, ws->name);
367 con_move_to_workspace(con, ws, false, true);
368 con_focus(con_descend_focused(con));
372 DRAGGING_CB(drag_window_callback) {
373 const struct xcb_button_press_event_t *event = extra;
375 /* Reposition the client correctly while moving */
376 con->rect.x = old_rect->x + (new_x - event->root_x);
377 con->rect.y = old_rect->y + (new_y - event->root_y);
379 render_con(con, false);
383 /* Check if we cross workspace boundaries while moving */
384 if (!floating_maybe_reassign_ws(con))
390 * Called when the user clicked on the titlebar of a floating window.
391 * Calls the drag_pointer function with the drag_window callback
394 void floating_drag_window(Con *con, const xcb_button_press_event_t *event) {
395 DLOG("floating_drag_window\n");
397 /* Push changes before dragging, so that the window gets raised now and not
398 * after the user releases the mouse button */
401 /* Drag the window */
402 drag_pointer(con, event, XCB_NONE, BORDER_TOP /* irrelevant */, XCURSOR_CURSOR_MOVE, drag_window_callback, event);
407 * This is an ugly data structure which we need because there is no standard
408 * way of having nested functions (only available as a gcc extension at the
409 * moment, clang doesn’t support it) or blocks (only available as a clang
410 * extension and only on Mac OS X systems at the moment).
413 struct resize_window_callback_params {
414 const border_t corner;
415 const bool proportional;
416 const xcb_button_press_event_t *event;
419 DRAGGING_CB(resize_window_callback) {
420 const struct resize_window_callback_params *params = extra;
421 const xcb_button_press_event_t *event = params->event;
422 border_t corner = params->corner;
424 int32_t dest_x = con->rect.x;
425 int32_t dest_y = con->rect.y;
427 uint32_t dest_height;
429 double ratio = (double) old_rect->width / old_rect->height;
431 /* First guess: We resize by exactly the amount the mouse moved,
432 * taking into account in which corner the client was grabbed */
433 if (corner & BORDER_LEFT)
434 dest_width = old_rect->width - (new_x - event->root_x);
435 else dest_width = old_rect->width + (new_x - event->root_x);
437 if (corner & BORDER_TOP)
438 dest_height = old_rect->height - (new_y - event->root_y);
439 else dest_height = old_rect->height + (new_y - event->root_y);
441 /* Obey minimum window size */
442 Rect minimum = con_minimum_size(con);
443 dest_width = max(dest_width, minimum.width);
444 dest_height = max(dest_height, minimum.height);
446 /* User wants to keep proportions, so we may have to adjust our values */
447 if (params->proportional) {
448 dest_width = max(dest_width, (int) (dest_height * ratio));
449 dest_height = max(dest_height, (int) (dest_width / ratio));
452 /* If not the lower right corner is grabbed, we must also reposition
453 * the client by exactly the amount we resized it */
454 if (corner & BORDER_LEFT)
455 dest_x = old_rect->x + (old_rect->width - dest_width);
457 if (corner & BORDER_TOP)
458 dest_y = old_rect->y + (old_rect->height - dest_height);
460 con->rect = (Rect) { dest_x, dest_y, dest_width, dest_height };
462 /* TODO: don’t re-render the whole tree just because we change
463 * coordinates of a floating window */
465 x_push_changes(croot);
469 * Called when the user clicked on a floating window while holding the
470 * floating_modifier and the right mouse button.
471 * Calls the drag_pointer function with the resize_window callback
474 void floating_resize_window(Con *con, const bool proportional,
475 const xcb_button_press_event_t *event) {
476 DLOG("floating_resize_window\n");
478 /* corner saves the nearest corner to the original click. It contains
479 * a bitmask of the nearest borders (BORDER_LEFT, BORDER_RIGHT, …) */
482 if (event->event_x <= (con->rect.width / 2))
483 corner |= BORDER_LEFT;
484 else corner |= BORDER_RIGHT;
487 if (event->event_y <= (con->rect.height / 2)) {
488 corner |= BORDER_TOP;
489 cursor = (corner & BORDER_LEFT) ?
490 XCURSOR_CURSOR_TOP_LEFT_CORNER : XCURSOR_CURSOR_TOP_RIGHT_CORNER;
493 corner |= BORDER_BOTTOM;
494 cursor = (corner & BORDER_LEFT) ?
495 XCURSOR_CURSOR_BOTTOM_LEFT_CORNER : XCURSOR_CURSOR_BOTTOM_RIGHT_CORNER;
498 struct resize_window_callback_params params = { corner, proportional, event };
500 drag_pointer(con, event, XCB_NONE, BORDER_TOP /* irrelevant */, cursor, resize_window_callback, ¶ms);
504 * This function grabs your pointer and lets you drag stuff around (borders).
505 * Every time you move your mouse, an XCB_MOTION_NOTIFY event will be received
506 * and the given callback will be called with the parameters specified (client,
507 * border on which the click originally was), the original rect of the client,
508 * the event and the new coordinates (x, y).
511 void drag_pointer(Con *con, const xcb_button_press_event_t *event, xcb_window_t
512 confine_to, border_t border, int cursor, callback_t callback, const void *extra)
514 uint32_t new_x, new_y;
515 Rect old_rect = { 0, 0, 0, 0 };
517 memcpy(&old_rect, &(con->rect), sizeof(Rect));
519 Cursor xcursor = (cursor && xcursor_supported) ?
520 xcursor_get_cursor(cursor) : XCB_NONE;
522 /* Grab the pointer */
523 xcb_grab_pointer_cookie_t cookie;
524 xcb_grab_pointer_reply_t *reply;
525 cookie = xcb_grab_pointer(conn,
526 false, /* get all pointer events specified by the following mask */
527 root, /* grab the root window */
528 XCB_EVENT_MASK_BUTTON_RELEASE | XCB_EVENT_MASK_POINTER_MOTION, /* which events to let through */
529 XCB_GRAB_MODE_ASYNC, /* pointer events should continue as normal */
530 XCB_GRAB_MODE_ASYNC, /* keyboard mode */
531 confine_to, /* confine_to = in which window should the cursor stay */
532 xcursor, /* possibly display a special cursor */
535 if ((reply = xcb_grab_pointer_reply(conn, cookie, NULL)) == NULL) {
536 ELOG("Could not grab pointer\n");
542 /* Go into our own event loop */
545 xcb_generic_event_t *inside_event, *last_motion_notify = NULL;
546 bool loop_done = false;
547 /* I’ve always wanted to have my own eventhandler… */
548 while (!loop_done && (inside_event = xcb_wait_for_event(conn))) {
549 /* We now handle all events we can get using xcb_poll_for_event */
551 /* skip x11 errors */
552 if (inside_event->response_type == 0) {
556 /* Strip off the highest bit (set if the event is generated) */
557 int type = (inside_event->response_type & 0x7F);
560 case XCB_BUTTON_RELEASE:
564 case XCB_MOTION_NOTIFY:
565 /* motion_notify events are saved for later */
566 FREE(last_motion_notify);
567 last_motion_notify = inside_event;
570 case XCB_UNMAP_NOTIFY:
572 case XCB_KEY_RELEASE:
573 DLOG("Unmap-notify, aborting\n");
574 handle_event(type, inside_event);
579 DLOG("Passing to original handler\n");
580 /* Use original handler */
581 handle_event(type, inside_event);
584 if (last_motion_notify != inside_event)
586 } while ((inside_event = xcb_poll_for_event(conn)) != NULL);
588 if (last_motion_notify == NULL || loop_done)
591 new_x = ((xcb_motion_notify_event_t*)last_motion_notify)->root_x;
592 new_y = ((xcb_motion_notify_event_t*)last_motion_notify)->root_y;
594 callback(con, &old_rect, new_x, new_y, extra);
595 FREE(last_motion_notify);
598 xcb_ungrab_pointer(conn, XCB_CURRENT_TIME);
603 * Repositions the CT_FLOATING_CON to have the coordinates specified by
604 * newrect, but only if the coordinates are not out-of-bounds. Also reassigns
605 * the floating con to a different workspace if this move was across different
609 void floating_reposition(Con *con, Rect newrect) {
610 /* Sanity check: Are the new coordinates on any output? If not, we
611 * ignore that request. */
612 Output *output = get_output_containing(
613 newrect.x + (newrect.width / 2),
614 newrect.y + (newrect.height / 2));
617 ELOG("No output found at destination coordinates. Not repositioning.\n");
623 floating_maybe_reassign_ws(con);
628 * Fixes the coordinates of the floating window whenever the window gets
629 * reassigned to a different output (or when the output’s rect changes).
632 void floating_fix_coordinates(Con *con, Rect *old_rect, Rect *new_rect) {
633 DLOG("Fixing coordinates of floating window %p (rect (%d, %d), %d x %d)\n",
634 con, con->rect.x, con->rect.y, con->rect.width, con->rect.height);
635 DLOG("old_rect = (%d, %d), %d x %d\n",
636 old_rect->x, old_rect->y, old_rect->width, old_rect->height);
637 DLOG("new_rect = (%d, %d), %d x %d\n",
638 new_rect->x, new_rect->y, new_rect->width, new_rect->height);
639 /* First we get the x/y coordinates relative to the x/y coordinates
640 * of the output on which the window is on */
641 int32_t rel_x = con->rect.x - old_rect->x + (int32_t)(con->rect.width / 2);
642 int32_t rel_y = con->rect.y - old_rect->y + (int32_t)(con->rect.height / 2);
643 /* Then we calculate a fraction, for example 0.63 for a window
644 * which is at y = 1212 of a 1920 px high output */
645 DLOG("rel_x = %d, rel_y = %d, fraction_x = %f, fraction_y = %f, output->w = %d, output->h = %d\n",
646 rel_x, rel_y, (double)rel_x / old_rect->width, (double)rel_y / old_rect->height,
647 old_rect->width, old_rect->height);
648 /* Here we have to multiply at first. Or we will lose precision when not compiled with -msse2 */
649 con->rect.x = (int32_t)new_rect->x + (double)(rel_x * (int32_t)new_rect->width)
650 / (int32_t)old_rect->width - (int32_t)(con->rect.width / 2);
651 con->rect.y = (int32_t)new_rect->y + (double)(rel_y * (int32_t)new_rect->height)
652 / (int32_t)old_rect->height - (int32_t)(con->rect.height / 2);
653 DLOG("Resulting coordinates: x = %d, y = %d\n", con->rect.x, con->rect.y);
658 * Moves the client 10px to the specified direction.
661 void floating_move(xcb_connection_t *conn, Client *currently_focused, direction_t direction) {
662 DLOG("floating move\n");
664 Rect destination = currently_focused->rect;
665 Rect *screen = &(currently_focused->workspace->output->rect);
680 /* to make static analyzers happy */
685 /* Prevent windows from vanishing completely */
686 if ((int32_t)(destination.x + destination.width - 5) <= (int32_t)screen->x ||
687 (int32_t)(destination.x + 5) >= (int32_t)(screen->x + screen->width) ||
688 (int32_t)(destination.y + destination.height - 5) <= (int32_t)screen->y ||
689 (int32_t)(destination.y + 5) >= (int32_t)(screen->y + screen->height)) {
690 DLOG("boundary check failed, not moving\n");
694 currently_focused->rect = destination;
695 reposition_client(conn, currently_focused);
697 /* Because reposition_client does not send a faked configure event (only resize does),
698 * we need to initiate that on our own */
699 fake_absolute_configure_notify(conn, currently_focused);
700 /* fake_absolute_configure_notify flushes */
704 * Hides all floating clients (or show them if they are currently hidden) on
705 * the specified workspace.
708 void floating_toggle_hide(xcb_connection_t *conn, Workspace *workspace) {
711 workspace->floating_hidden = !workspace->floating_hidden;
712 DLOG("floating_hidden is now: %d\n", workspace->floating_hidden);
713 TAILQ_FOREACH(client, &(workspace->floating_clients), floating_clients) {
714 if (workspace->floating_hidden)
715 client_unmap(conn, client);
716 else client_map(conn, client);
719 /* If we just unmapped all floating windows we should ensure that the focus
720 * is set correctly, that ist, to the first non-floating client in stack */
721 if (workspace->floating_hidden)
722 SLIST_FOREACH(client, &(workspace->focus_stack), focus_clients) {
723 if (client_is_floating(client))
725 set_focus(conn, client, true);