diff --git a/sway/config/output.c b/sway/config/output.c index 9c7082d0..914cf6c4 100644 --- a/sway/config/output.c +++ b/sway/config/output.c @@ -6,10 +6,10 @@ #include #include #include +#include #include #include #include -#include #include "sway/config.h" #include "sway/input/cursor.h" #include "sway/output.h" @@ -17,6 +17,10 @@ #include "log.h" #include "util.h" +#if WLR_HAS_DRM_BACKEND +#include +#endif + int output_name_cmp(const void *item, const void *data) { const struct output_config *output = item; const char *name = data; @@ -286,6 +290,7 @@ static void set_mode(struct wlr_output *output, struct wlr_output_state *pending static void set_modeline(struct wlr_output *output, struct wlr_output_state *pending, drmModeModeInfo *drm_mode) { +#if WLR_HAS_DRM_BACKEND if (!wlr_output_is_drm(output)) { sway_log(SWAY_ERROR, "Modeline can only be set to DRM output"); return; @@ -295,6 +300,9 @@ static void set_modeline(struct wlr_output *output, if (mode) { wlr_output_state_set_mode(pending, mode); } +#else + sway_log(SWAY_ERROR, "Modeline can only be set to DRM output"); +#endif } /* Some manufacturers hardcode the aspect-ratio of the output in the physical @@ -436,9 +444,11 @@ static void queue_output_config(struct output_config *oc, enum wl_output_transform tr = WL_OUTPUT_TRANSFORM_NORMAL; if (oc && oc->transform >= 0) { tr = oc->transform; +#if WLR_HAS_DRM_BACKEND } else if (wlr_output_is_drm(wlr_output)) { tr = wlr_drm_connector_get_panel_orientation(wlr_output); sway_log(SWAY_DEBUG, "Auto-detected output transform: %d", tr); +#endif } if (wlr_output->transform != tr) { sway_log(SWAY_DEBUG, "Set %s transform to %d", oc->name, tr); diff --git a/sway/desktop/output.c b/sway/desktop/output.c index 04bddf86..6999a382 100644 --- a/sway/desktop/output.c +++ b/sway/desktop/output.c @@ -4,11 +4,10 @@ #include #include #include -#include +#include #include #include #include -#include #include #include #include @@ -31,6 +30,11 @@ #include "sway/tree/view.h" #include "sway/tree/workspace.h" +#if WLR_HAS_DRM_BACKEND +#include +#include +#endif + struct sway_output *output_by_name_or_id(const char *name_or_id) { for (int i = 0; i < root->outputs->length; ++i) { struct sway_output *output = root->outputs->items[i]; @@ -923,10 +927,12 @@ void handle_new_output(struct wl_listener *listener, void *data) { if (wlr_output->non_desktop) { sway_log(SWAY_DEBUG, "Not configuring non-desktop output"); struct sway_output_non_desktop *non_desktop = output_non_desktop_create(wlr_output); +#if WLR_HAS_DRM_BACKEND if (server->drm_lease_manager) { wlr_drm_lease_v1_manager_offer_output(server->drm_lease_manager, wlr_output); } +#endif list_add(root->non_desktop_outputs, non_desktop); return; } diff --git a/sway/server.c b/sway/server.c index b750d10c..9208a838 100644 --- a/sway/server.c +++ b/sway/server.c @@ -7,13 +7,11 @@ #include #include #include -#include #include #include #include #include #include -#include #include #include #include @@ -46,13 +44,19 @@ #include "sway/output.h" #include "sway/server.h" #include "sway/tree/root.h" + #if HAVE_XWAYLAND #include "sway/xwayland.h" #endif +#if WLR_HAS_DRM_BACKEND +#include +#endif + #define SWAY_XDG_SHELL_VERSION 2 #define SWAY_LAYER_SHELL_VERSION 3 +#if WLR_HAS_DRM_BACKEND static void handle_drm_lease_request(struct wl_listener *listener, void *data) { /* We only offer non-desktop outputs, but in the future we might want to do * more logic here. */ @@ -64,6 +68,7 @@ static void handle_drm_lease_request(struct wl_listener *listener, void *data) { wlr_drm_lease_request_v1_reject(req); } } +#endif bool server_init(struct sway_server *server) { sway_log(SWAY_DEBUG, "Initializing Wayland server"); @@ -189,6 +194,7 @@ bool server_init(struct sway_server *server) { sway_session_lock_init(); +#if WLR_HAS_DRM_BACKEND server->drm_lease_manager= wlr_drm_lease_v1_manager_create(server->wl_display, server->backend); if (server->drm_lease_manager) { @@ -199,6 +205,7 @@ bool server_init(struct sway_server *server) { sway_log(SWAY_DEBUG, "Failed to create wlr_drm_lease_device_v1"); sway_log(SWAY_INFO, "VR will not be available"); } +#endif wlr_export_dmabuf_manager_v1_create(server->wl_display); wlr_screencopy_manager_v1_create(server->wl_display);