sway

i3-compatible Wayland compositor
git clone https://git.awy.one/sway
Log | Files | Refs | README | LICENSE

commit ec713125c6593b3671dc54e41b90333b42783dff
parent 298ccb539c5f9d538e49364f45e57ff0d88df717
Author: Jonathan Buch <jbuch@synyx.de>
Date:   Tue, 25 Sep 2018 10:29:58 +0200

Simplify raising a container in seat

* Factor out raising a floating window into s separate function to
  enable reuse.

Diffstat:
Msway/input/seat.c | 34+++++++++++++++-------------------
1 file changed, 15 insertions(+), 19 deletions(-)

diff --git a/sway/input/seat.c b/sway/input/seat.c @@ -606,6 +606,18 @@ static int handle_urgent_timeout(void *data) { return 0; } +static void container_raise_floating(struct sway_container *con) { + // Bring container to front by putting it at the end of the floating list. + struct sway_container *floater = con; + while (floater->parent) { + floater = floater->parent; + } + if (container_is_floating(floater)) { + list_move_to_end(floater->workspace->floating, floater); + node_set_dirty(&floater->workspace->node); + } +} + void seat_set_focus_warp(struct sway_seat *seat, struct sway_node *node, bool warp, bool notify) { if (seat->focused_layer) { @@ -733,16 +745,8 @@ void seat_set_focus_warp(struct sway_seat *seat, struct sway_node *node, } // If we've focused a floating container, bring it to the front. - // We do this by putting it at the end of the floating list. if (container && config->raise_floating) { - struct sway_container *floater = container; - while (floater->parent) { - floater = floater->parent; - } - if (container_is_floating(floater)) { - list_move_to_end(floater->workspace->floating, floater); - node_set_dirty(&floater->workspace->node); - } + container_raise_floating(container); } if (last_focus) { @@ -1018,17 +1022,9 @@ void seat_begin_down(struct sway_seat *seat, struct sway_container *con, seat->op_ref_con_ly = sy; seat->op_moved = false; - // If we've focused a floating container, bring it to the front. - // We do this by putting it at the end of the floating list. + // In case the container was not raised by gaining focus, raise on click if (con && !config->raise_floating) { - struct sway_container *floater = con; - while (floater->parent) { - floater = floater->parent; - } - if (container_is_floating(floater)) { - list_move_to_end(floater->workspace->floating, floater); - node_set_dirty(&floater->workspace->node); - } + container_raise_floating(con); } }