diff options
-rw-r--r-- | include/sway/output.h | 8 | ||||
-rw-r--r-- | include/sway/tree/root.h | 1 | ||||
-rw-r--r-- | sway/desktop/output.c | 2 | ||||
-rw-r--r-- | sway/tree/output.c | 28 | ||||
-rw-r--r-- | sway/tree/root.c | 1 |
5 files changed, 40 insertions, 0 deletions
diff --git a/include/sway/output.h b/include/sway/output.h index 6d8319bf..d72bf1b2 100644 --- a/include/sway/output.h +++ b/include/sway/output.h | |||
@@ -57,6 +57,12 @@ struct sway_output { | |||
57 | struct wl_event_source *repaint_timer; | 57 | struct wl_event_source *repaint_timer; |
58 | }; | 58 | }; |
59 | 59 | ||
60 | struct sway_output_non_desktop { | ||
61 | struct wlr_output *wlr_output; | ||
62 | |||
63 | struct wl_listener destroy; | ||
64 | }; | ||
65 | |||
60 | struct sway_output *output_create(struct wlr_output *wlr_output); | 66 | struct sway_output *output_create(struct wlr_output *wlr_output); |
61 | 67 | ||
62 | void output_destroy(struct sway_output *output); | 68 | void output_destroy(struct sway_output *output); |
@@ -177,4 +183,6 @@ void handle_output_manager_test(struct wl_listener *listener, void *data); | |||
177 | void handle_output_power_manager_set_mode(struct wl_listener *listener, | 183 | void handle_output_power_manager_set_mode(struct wl_listener *listener, |
178 | void *data); | 184 | void *data); |
179 | 185 | ||
186 | struct sway_output_non_desktop *output_non_desktop_create(struct wlr_output *wlr_output); | ||
187 | |||
180 | #endif | 188 | #endif |
diff --git a/include/sway/tree/root.h b/include/sway/tree/root.h index 5d4a2f2d..af4124a1 100644 --- a/include/sway/tree/root.h +++ b/include/sway/tree/root.h | |||
@@ -28,6 +28,7 @@ struct sway_root { | |||
28 | double width, height; | 28 | double width, height; |
29 | 29 | ||
30 | list_t *outputs; // struct sway_output | 30 | list_t *outputs; // struct sway_output |
31 | list_t *non_desktop_outputs; // struct sway_output_non_desktop | ||
31 | list_t *scratchpad; // struct sway_container | 32 | list_t *scratchpad; // struct sway_container |
32 | 33 | ||
33 | // For when there's no connected outputs | 34 | // For when there's no connected outputs |
diff --git a/sway/desktop/output.c b/sway/desktop/output.c index 7bb9dab2..3f3f9494 100644 --- a/sway/desktop/output.c +++ b/sway/desktop/output.c | |||
@@ -883,10 +883,12 @@ void handle_new_output(struct wl_listener *listener, void *data) { | |||
883 | 883 | ||
884 | if (wlr_output->non_desktop) { | 884 | if (wlr_output->non_desktop) { |
885 | sway_log(SWAY_DEBUG, "Not configuring non-desktop output"); | 885 | sway_log(SWAY_DEBUG, "Not configuring non-desktop output"); |
886 | struct sway_output_non_desktop *non_desktop = output_non_desktop_create(wlr_output); | ||
886 | if (server->drm_lease_manager) { | 887 | if (server->drm_lease_manager) { |
887 | wlr_drm_lease_v1_manager_offer_output(server->drm_lease_manager, | 888 | wlr_drm_lease_v1_manager_offer_output(server->drm_lease_manager, |
888 | wlr_output); | 889 | wlr_output); |
889 | } | 890 | } |
891 | list_add(root->non_desktop_outputs, non_desktop); | ||
890 | return; | 892 | return; |
891 | } | 893 | } |
892 | 894 | ||
diff --git a/sway/tree/output.c b/sway/tree/output.c index 52826c91..b30e646e 100644 --- a/sway/tree/output.c +++ b/sway/tree/output.c | |||
@@ -9,6 +9,7 @@ | |||
9 | #include "sway/output.h" | 9 | #include "sway/output.h" |
10 | #include "sway/tree/arrange.h" | 10 | #include "sway/tree/arrange.h" |
11 | #include "sway/tree/workspace.h" | 11 | #include "sway/tree/workspace.h" |
12 | #include "sway/server.h" | ||
12 | #include "log.h" | 13 | #include "log.h" |
13 | #include "util.h" | 14 | #include "util.h" |
14 | 15 | ||
@@ -390,6 +391,33 @@ void output_get_box(struct sway_output *output, struct wlr_box *box) { | |||
390 | box->height = output->height; | 391 | box->height = output->height; |
391 | } | 392 | } |
392 | 393 | ||
394 | static void handle_destroy_non_desktop(struct wl_listener *listener, void *data) { | ||
395 | struct sway_output_non_desktop *output = | ||
396 | wl_container_of(listener, output, destroy); | ||
397 | |||
398 | sway_log(SWAY_DEBUG, "Destroying non-desktop output '%s'", output->wlr_output->name); | ||
399 | |||
400 | int index = list_find(root->non_desktop_outputs, output); | ||
401 | list_del(root->non_desktop_outputs, index); | ||
402 | |||
403 | wl_list_remove(&output->destroy.link); | ||
404 | |||
405 | free(output); | ||
406 | } | ||
407 | |||
408 | struct sway_output_non_desktop *output_non_desktop_create( | ||
409 | struct wlr_output *wlr_output) { | ||
410 | struct sway_output_non_desktop *output = | ||
411 | calloc(1, sizeof(struct sway_output_non_desktop)); | ||
412 | |||
413 | output->wlr_output = wlr_output; | ||
414 | |||
415 | wl_signal_add(&wlr_output->events.destroy, &output->destroy); | ||
416 | output->destroy.notify = handle_destroy_non_desktop; | ||
417 | |||
418 | return output; | ||
419 | } | ||
420 | |||
393 | enum sway_container_layout output_get_default_layout( | 421 | enum sway_container_layout output_get_default_layout( |
394 | struct sway_output *output) { | 422 | struct sway_output *output) { |
395 | if (config->default_orientation != L_NONE) { | 423 | if (config->default_orientation != L_NONE) { |
diff --git a/sway/tree/root.c b/sway/tree/root.c index 8508e9eb..7df0b237 100644 --- a/sway/tree/root.c +++ b/sway/tree/root.c | |||
@@ -38,6 +38,7 @@ struct sway_root *root_create(void) { | |||
38 | wl_list_init(&root->drag_icons); | 38 | wl_list_init(&root->drag_icons); |
39 | wl_signal_init(&root->events.new_node); | 39 | wl_signal_init(&root->events.new_node); |
40 | root->outputs = create_list(); | 40 | root->outputs = create_list(); |
41 | root->non_desktop_outputs = create_list(); | ||
41 | root->scratchpad = create_list(); | 42 | root->scratchpad = create_list(); |
42 | 43 | ||
43 | root->output_layout_change.notify = output_layout_handle_change; | 44 | root->output_layout_change.notify = output_layout_handle_change; |