diff options
author | Drew DeVault <sir@cmpwn.com> | 2017-11-11 11:58:43 -0500 |
---|---|---|
committer | Drew DeVault <sir@cmpwn.com> | 2017-11-11 11:58:43 -0500 |
commit | 7eafcc75f6f8abd2346e0d72b063bc10ce24378f (patch) | |
tree | ce8a4cebdf5bc484643ec78f3cf59e0943ce50e8 /sway/desktop | |
parent | 0ba6554c4f6c923274062862d895240eea4de350 (diff) |
Initialize outputs from backend and add to tree
Diffstat (limited to 'sway/desktop')
-rw-r--r-- | sway/desktop/output.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/sway/desktop/output.c b/sway/desktop/output.c new file mode 100644 index 00000000..51363e76 --- /dev/null +++ b/sway/desktop/output.c @@ -0,0 +1,21 @@ +#include <wayland-server.h> +#include <wlr/types/wlr_output.h> +#include "sway/server.h" +#include "sway/container.h" +#include "sway/workspace.h" +#include "log.h" + +void output_add_notify(struct wl_listener *listener, void *data) { + struct sway_server *server = wl_container_of(listener, server, output_add); + struct wlr_output *wlr_output = data; + sway_log(L_DEBUG, "New output %p: %s", wlr_output, wlr_output->name); + swayc_t *op = new_output(wlr_output); + if (!sway_assert(op, "Failed to allocate output")) { + return; + } + // Switch to workspace if we need to + if (swayc_active_workspace() == NULL) { + swayc_t *ws = op->children->items[0]; + workspace_switch(ws); + } +} |