summaryrefslogtreecommitdiffstats
path: root/sway/desktop/output.c
diff options
context:
space:
mode:
Diffstat (limited to 'sway/desktop/output.c')
-rw-r--r--sway/desktop/output.c17
1 files changed, 14 insertions, 3 deletions
diff --git a/sway/desktop/output.c b/sway/desktop/output.c
index 4b407f41..8a4fb4a2 100644
--- a/sway/desktop/output.c
+++ b/sway/desktop/output.c
@@ -2,6 +2,7 @@
2#include <assert.h> 2#include <assert.h>
3#include <stdlib.h> 3#include <stdlib.h>
4#include <time.h> 4#include <time.h>
5#include <strings.h>
5#include <wayland-server.h> 6#include <wayland-server.h>
6#include <wlr/render/wlr_renderer.h> 7#include <wlr/render/wlr_renderer.h>
7#include <wlr/types/wlr_box.h> 8#include <wlr/types/wlr_box.h>
@@ -21,6 +22,16 @@
21#include "sway/tree/layout.h" 22#include "sway/tree/layout.h"
22#include "sway/tree/view.h" 23#include "sway/tree/view.h"
23 24
25struct sway_container *output_by_name(const char *name) {
26 for (int i = 0; i < root_container.children->length; ++i) {
27 struct sway_container *output = root_container.children->items[i];
28 if (strcasecmp(output->name, name) == 0) {
29 return output;
30 }
31 }
32 return NULL;
33}
34
24/** 35/**
25 * Rotate a child's position relative to a parent. The parent size is (pw, ph), 36 * Rotate a child's position relative to a parent. The parent size is (pw, ph),
26 * the child position is (*sx, *sy) and its size is (sw, sh). 37 * the child position is (*sx, *sy) and its size is (sw, sh).
@@ -334,12 +345,12 @@ void output_damage_whole_view(struct sway_output *output,
334static void damage_handle_destroy(struct wl_listener *listener, void *data) { 345static void damage_handle_destroy(struct wl_listener *listener, void *data) {
335 struct sway_output *output = 346 struct sway_output *output =
336 wl_container_of(listener, output, damage_destroy); 347 wl_container_of(listener, output, damage_destroy);
337 container_output_destroy(output->swayc); 348 container_destroy(output->swayc);
338} 349}
339 350
340static void handle_destroy(struct wl_listener *listener, void *data) { 351static void handle_destroy(struct wl_listener *listener, void *data) {
341 struct sway_output *output = wl_container_of(listener, output, destroy); 352 struct sway_output *output = wl_container_of(listener, output, destroy);
342 container_output_destroy(output->swayc); 353 container_destroy(output->swayc);
343} 354}
344 355
345static void handle_mode(struct wl_listener *listener, void *data) { 356static void handle_mode(struct wl_listener *listener, void *data) {
@@ -381,7 +392,7 @@ void handle_new_output(struct wl_listener *listener, void *data) {
381 392
382 output->damage = wlr_output_damage_create(wlr_output); 393 output->damage = wlr_output_damage_create(wlr_output);
383 394
384 output->swayc = container_output_create(output); 395 output->swayc = output_create(output);
385 if (!output->swayc) { 396 if (!output->swayc) {
386 free(output); 397 free(output);
387 return; 398 return;