aboutsummaryrefslogtreecommitdiffstats
path: root/sway/tree
diff options
context:
space:
mode:
authorLibravatar Drew DeVault <sir@cmpwn.com>2017-11-11 11:58:43 -0500
committerLibravatar Drew DeVault <sir@cmpwn.com>2017-11-11 11:58:43 -0500
commit7eafcc75f6f8abd2346e0d72b063bc10ce24378f (patch)
treece8a4cebdf5bc484643ec78f3cf59e0943ce50e8 /sway/tree
parentMove sway's internal tree code to sway/tree/ (diff)
downloadsway-7eafcc75f6f8abd2346e0d72b063bc10ce24378f.tar.gz
sway-7eafcc75f6f8abd2346e0d72b063bc10ce24378f.tar.zst
sway-7eafcc75f6f8abd2346e0d72b063bc10ce24378f.zip
Initialize outputs from backend and add to tree
Diffstat (limited to 'sway/tree')
-rw-r--r--sway/tree/container.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/sway/tree/container.c b/sway/tree/container.c
index 829fde69..61c9c5e3 100644
--- a/sway/tree/container.c
+++ b/sway/tree/container.c
@@ -4,6 +4,8 @@
4#include <stdbool.h> 4#include <stdbool.h>
5#include <strings.h> 5#include <strings.h>
6#include <string.h> 6#include <string.h>
7#include <wlr/types/wlr_box.h>
8#include <wlr/types/wlr_output.h>
7#include "sway/config.h" 9#include "sway/config.h"
8#include "sway/container.h" 10#include "sway/container.h"
9#include "sway/workspace.h" 11#include "sway/workspace.h"
@@ -118,10 +120,10 @@ static void update_root_geometry() {
118 120
119// New containers 121// New containers
120 122
121swayc_t *new_output(wlc_handle handle) { 123swayc_t *new_output(struct wlr_output *wlr_output) {
122 struct wlc_size size; 124 struct wlr_box size;
123 output_get_scaled_size(handle, &size); 125 wlr_output_effective_resolution(wlr_output, &size.width, &size.height);
124 const char *name = wlc_output_get_name(handle); 126 const char *name = wlr_output->name;
125 // Find current outputs to see if this already exists 127 // Find current outputs to see if this already exists
126 { 128 {
127 int i, len = root_container.children->length; 129 int i, len = root_container.children->length;
@@ -129,14 +131,12 @@ swayc_t *new_output(wlc_handle handle) {
129 swayc_t *op = root_container.children->items[i]; 131 swayc_t *op = root_container.children->items[i];
130 const char *op_name = op->name; 132 const char *op_name = op->name;
131 if (op_name && name && strcmp(op_name, name) == 0) { 133 if (op_name && name && strcmp(op_name, name) == 0) {
132 sway_log(L_DEBUG, "restoring output %" PRIuPTR ":%s", handle, op_name); 134 sway_log(L_DEBUG, "restoring output %p: %s", wlr_output, op_name);
133 return op; 135 return op;
134 } 136 }
135 } 137 }
136 } 138 }
137 139
138 sway_log(L_DEBUG, "New output %" PRIuPTR ":%s", handle, name);
139
140 struct output_config *oc = NULL, *all = NULL; 140 struct output_config *oc = NULL, *all = NULL;
141 int i; 141 int i;
142 for (i = 0; i < config->output_configs->length; ++i) { 142 for (i = 0; i < config->output_configs->length; ++i) {
@@ -164,10 +164,10 @@ swayc_t *new_output(wlc_handle handle) {
164 } 164 }
165 165
166 swayc_t *output = new_swayc(C_OUTPUT); 166 swayc_t *output = new_swayc(C_OUTPUT);
167 output->handle = handle; 167 output->_handle.output = wlr_output;
168 output->name = name ? strdup(name) : NULL; 168 output->name = name ? strdup(name) : NULL;
169 output->width = size.w; 169 output->width = size.width;
170 output->height = size.h; 170 output->height = size.width;
171 output->unmanaged = create_list(); 171 output->unmanaged = create_list();
172 output->bg_pid = 0; 172 output->bg_pid = 0;
173 173