diff options
-rw-r--r-- | sway/desktop/output.c | 10 | ||||
-rw-r--r-- | sway/server.c | 1 |
2 files changed, 11 insertions, 0 deletions
diff --git a/sway/desktop/output.c b/sway/desktop/output.c index e0d76349..3ae97e66 100644 --- a/sway/desktop/output.c +++ b/sway/desktop/output.c | |||
@@ -5,6 +5,7 @@ | |||
5 | #include <time.h> | 5 | #include <time.h> |
6 | #include <wayland-server-core.h> | 6 | #include <wayland-server-core.h> |
7 | #include <wlr/backend/drm.h> | 7 | #include <wlr/backend/drm.h> |
8 | #include <wlr/backend/headless.h> | ||
8 | #include <wlr/render/wlr_renderer.h> | 9 | #include <wlr/render/wlr_renderer.h> |
9 | #include <wlr/types/wlr_buffer.h> | 10 | #include <wlr/types/wlr_buffer.h> |
10 | #include <wlr/types/wlr_drm_lease_v1.h> | 11 | #include <wlr/types/wlr_drm_lease_v1.h> |
@@ -833,13 +834,22 @@ static void handle_present(struct wl_listener *listener, void *data) { | |||
833 | output->refresh_nsec = output_event->refresh; | 834 | output->refresh_nsec = output_event->refresh; |
834 | } | 835 | } |
835 | 836 | ||
837 | static unsigned int last_headless_num = 0; | ||
838 | |||
836 | void handle_new_output(struct wl_listener *listener, void *data) { | 839 | void handle_new_output(struct wl_listener *listener, void *data) { |
837 | struct sway_server *server = wl_container_of(listener, server, new_output); | 840 | struct sway_server *server = wl_container_of(listener, server, new_output); |
838 | struct wlr_output *wlr_output = data; | 841 | struct wlr_output *wlr_output = data; |
842 | |||
839 | if (wlr_output == root->fallback_output->wlr_output) { | 843 | if (wlr_output == root->fallback_output->wlr_output) { |
840 | return; | 844 | return; |
841 | } | 845 | } |
842 | 846 | ||
847 | if (wlr_output_is_headless(wlr_output)) { | ||
848 | char name[64]; | ||
849 | snprintf(name, sizeof(name), "HEADLESS-%u", ++last_headless_num); | ||
850 | wlr_output_set_name(wlr_output, name); | ||
851 | } | ||
852 | |||
843 | sway_log(SWAY_DEBUG, "New output %p: %s (non-desktop: %d)", | 853 | sway_log(SWAY_DEBUG, "New output %p: %s (non-desktop: %d)", |
844 | wlr_output, wlr_output->name, wlr_output->non_desktop); | 854 | wlr_output, wlr_output->name, wlr_output->non_desktop); |
845 | 855 | ||
diff --git a/sway/server.c b/sway/server.c index ff269c79..582a04ab 100644 --- a/sway/server.c +++ b/sway/server.c | |||
@@ -227,6 +227,7 @@ bool server_init(struct sway_server *server) { | |||
227 | 227 | ||
228 | struct wlr_output *wlr_output = | 228 | struct wlr_output *wlr_output = |
229 | wlr_headless_add_output(server->headless_backend, 800, 600); | 229 | wlr_headless_add_output(server->headless_backend, 800, 600); |
230 | wlr_output_set_name(wlr_output, "FALLBACK"); | ||
230 | root->fallback_output = output_create(wlr_output); | 231 | root->fallback_output = output_create(wlr_output); |
231 | 232 | ||
232 | // This may have been set already via -Dtxn-timeout | 233 | // This may have been set already via -Dtxn-timeout |