aboutsummaryrefslogtreecommitdiffstats
path: root/sway/tree/layout.c
diff options
context:
space:
mode:
authorLibravatar emersion <contact@emersion.fr>2017-12-12 20:02:01 +0100
committerLibravatar emersion <contact@emersion.fr>2017-12-12 20:02:01 +0100
commitc7abb77f2217cc4d5642ef1650f7fc75e1c1a9a4 (patch)
tree8118cd69c22ec2545572a8e443080907f087d401 /sway/tree/layout.c
parentAdd scale and transform events to sway_output (diff)
downloadsway-c7abb77f2217cc4d5642ef1650f7fc75e1c1a9a4.tar.gz
sway-c7abb77f2217cc4d5642ef1650f7fc75e1c1a9a4.tar.zst
sway-c7abb77f2217cc4d5642ef1650f7fc75e1c1a9a4.zip
Listen to output layout change
Diffstat (limited to 'sway/tree/layout.c')
-rw-r--r--sway/tree/layout.c17
1 files changed, 16 insertions, 1 deletions
diff --git a/sway/tree/layout.c b/sway/tree/layout.c
index cb39a361..fd17f8a5 100644
--- a/sway/tree/layout.c
+++ b/sway/tree/layout.c
@@ -7,6 +7,7 @@
7#include <wlr/types/wlr_output.h> 7#include <wlr/types/wlr_output.h>
8#include <wlr/types/wlr_output_layout.h> 8#include <wlr/types/wlr_output_layout.h>
9#include "sway/container.h" 9#include "sway/container.h"
10#include "sway/layout.h"
10#include "sway/output.h" 11#include "sway/output.h"
11#include "sway/view.h" 12#include "sway/view.h"
12#include "list.h" 13#include "list.h"
@@ -14,13 +15,27 @@
14 15
15swayc_t root_container; 16swayc_t root_container;
16 17
18static void output_layout_change_notify(struct wl_listener *listener, void *data) {
19 struct wlr_box *box = wlr_output_layout_get_box(
20 root_container.sway_root->output_layout, NULL);
21 root_container.width = box->width;
22 root_container.height = box->height;
23}
24
17void init_layout(void) { 25void init_layout(void) {
18 root_container.id = 0; // normally assigned in new_swayc() 26 root_container.id = 0; // normally assigned in new_swayc()
19 root_container.type = C_ROOT; 27 root_container.type = C_ROOT;
20 root_container.layout = L_NONE; 28 root_container.layout = L_NONE;
21 root_container.name = strdup("root"); 29 root_container.name = strdup("root");
22 root_container.children = create_list(); 30 root_container.children = create_list();
23 root_container.output_layout = wlr_output_layout_create(); 31
32 root_container.sway_root = calloc(1, sizeof(*root_container.sway_root));
33 root_container.sway_root->output_layout = wlr_output_layout_create();
34
35 root_container.sway_root->output_layout_change.notify =
36 output_layout_change_notify;
37 wl_signal_add(&root_container.sway_root->output_layout->events.change,
38 &root_container.sway_root->output_layout_change);
24} 39}
25 40
26void add_child(swayc_t *parent, swayc_t *child) { 41void add_child(swayc_t *parent, swayc_t *child) {