Separate root-related code

This creates a root.c and moves bits and pieces from elsewhere into it.

* layout_init has been renamed to root_create and moved into root.c
* root_destroy has been created and is called on shutdown
* scratchpad code has been moved into root.c, because hidden scratchpad
containers are stored in the root struct
This commit is contained in:
Ryan Dwyer 2018-08-03 23:06:01 +10:00
parent 5de2223c6d
commit 04489ff420
12 changed files with 292 additions and 275 deletions

View file

@ -17,7 +17,6 @@
#include "sway/input/seat.h"
#include "sway/ipc-server.h"
#include "sway/output.h"
#include "sway/scratchpad.h"
#include "sway/server.h"
#include "sway/tree/arrange.h"
#include "sway/tree/layout.h"
@ -336,7 +335,6 @@ static struct sway_container *container_destroy_noreaping(
// Workspaces will refuse to be destroyed if they're the last workspace
// on their output.
if (!container_workspace_destroy(con)) {
wlr_log(WLR_ERROR, "workspace doesn't want to destroy");
return NULL;
}
}
@ -347,7 +345,7 @@ static struct sway_container *container_destroy_noreaping(
container_set_dirty(con);
if (con->scratchpad) {
scratchpad_remove_container(con);
root_scratchpad_remove_container(con);
}
if (!con->parent) {
@ -1097,7 +1095,7 @@ void container_set_floating(struct sway_container *container, bool enable) {
} else {
// Returning to tiled
if (container->scratchpad) {
scratchpad_remove_container(container);
root_scratchpad_remove_container(container);
}
container_remove_child(container);
struct sway_container *reference =