@ -821,6 +821,8 @@ void container_set_floating(struct sway_container *container, bool enable) {
struct sway_seat * seat = input_manager_current_seat ( ) ;
struct sway_seat * seat = input_manager_current_seat ( ) ;
struct sway_workspace * workspace = container - > pending . workspace ;
struct sway_workspace * workspace = container - > pending . workspace ;
struct sway_container * focus = seat_get_focused_container ( seat ) ;
bool set_focus = focus = = container ;
if ( enable ) {
if ( enable ) {
struct sway_container * old_parent = container - > pending . parent ;
struct sway_container * old_parent = container - > pending . parent ;
@ -835,6 +837,10 @@ void container_set_floating(struct sway_container *container, bool enable) {
container_floating_set_default_size ( container ) ;
container_floating_set_default_size ( container ) ;
container_floating_resize_and_center ( container ) ;
container_floating_resize_and_center ( container ) ;
if ( old_parent ) {
if ( old_parent ) {
if ( set_focus ) {
seat_set_raw_focus ( seat , & old_parent - > node ) ;
seat_set_raw_focus ( seat , & container - > node ) ;
}
container_reap_empty ( old_parent ) ;
container_reap_empty ( old_parent ) ;
}
}
} else {
} else {
@ -846,7 +852,11 @@ void container_set_floating(struct sway_container *container, bool enable) {
struct sway_container * reference =
struct sway_container * reference =
seat_get_focus_inactive_tiling ( seat , workspace ) ;
seat_get_focus_inactive_tiling ( seat , workspace ) ;
if ( reference ) {
if ( reference ) {
container_add_sibling ( reference , container , 1 ) ;
if ( reference - > view ) {
container_add_sibling ( reference , container , 1 ) ;
} else {
container_add_child ( reference , container ) ;
}
container - > pending . width = reference - > pending . width ;
container - > pending . width = reference - > pending . width ;
container - > pending . height = reference - > pending . height ;
container - > pending . height = reference - > pending . height ;
} else {
} else {