diff options
Diffstat (limited to 'sway/server.c')
-rw-r--r-- | sway/server.c | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/sway/server.c b/sway/server.c index 2e5ab104..b187fcd5 100644 --- a/sway/server.c +++ b/sway/server.c | |||
@@ -13,6 +13,7 @@ | |||
13 | #include <wlr/render/wlr_renderer.h> | 13 | #include <wlr/render/wlr_renderer.h> |
14 | #include <wlr/types/wlr_compositor.h> | 14 | #include <wlr/types/wlr_compositor.h> |
15 | #include <wlr/types/wlr_data_control_v1.h> | 15 | #include <wlr/types/wlr_data_control_v1.h> |
16 | #include <wlr/types/wlr_drm_lease_v1.h> | ||
16 | #include <wlr/types/wlr_export_dmabuf_v1.h> | 17 | #include <wlr/types/wlr_export_dmabuf_v1.h> |
17 | #include <wlr/types/wlr_gamma_control_v1.h> | 18 | #include <wlr/types/wlr_gamma_control_v1.h> |
18 | #include <wlr/types/wlr_idle.h> | 19 | #include <wlr/types/wlr_idle.h> |
@@ -57,6 +58,18 @@ bool server_privileged_prepare(struct sway_server *server) { | |||
57 | return true; | 58 | return true; |
58 | } | 59 | } |
59 | 60 | ||
61 | static void handle_drm_lease_request(struct wl_listener *listener, void *data) { | ||
62 | /* We only offer non-desktop outputs, but in the future we might want to do | ||
63 | * more logic here. */ | ||
64 | |||
65 | struct wlr_drm_lease_request_v1 *req = data; | ||
66 | struct wlr_drm_lease_v1 *lease = wlr_drm_lease_request_v1_grant(req); | ||
67 | if (!lease) { | ||
68 | sway_log(SWAY_ERROR, "Failed to grant lease request"); | ||
69 | wlr_drm_lease_request_v1_reject(req); | ||
70 | } | ||
71 | } | ||
72 | |||
60 | bool server_init(struct sway_server *server) { | 73 | bool server_init(struct sway_server *server) { |
61 | sway_log(SWAY_DEBUG, "Initializing Wayland server"); | 74 | sway_log(SWAY_DEBUG, "Initializing Wayland server"); |
62 | 75 | ||
@@ -149,6 +162,17 @@ bool server_init(struct sway_server *server) { | |||
149 | server->foreign_toplevel_manager = | 162 | server->foreign_toplevel_manager = |
150 | wlr_foreign_toplevel_manager_v1_create(server->wl_display); | 163 | wlr_foreign_toplevel_manager_v1_create(server->wl_display); |
151 | 164 | ||
165 | server->drm_lease_manager= | ||
166 | wlr_drm_lease_v1_manager_create(server->wl_display, server->backend); | ||
167 | if (server->drm_lease_manager) { | ||
168 | server->drm_lease_request.notify = handle_drm_lease_request; | ||
169 | wl_signal_add(&server->drm_lease_manager->events.request, | ||
170 | &server->drm_lease_request); | ||
171 | } else { | ||
172 | sway_log(SWAY_DEBUG, "Failed to create wlr_drm_lease_device_v1"); | ||
173 | sway_log(SWAY_INFO, "VR will not be available"); | ||
174 | } | ||
175 | |||
152 | wlr_export_dmabuf_manager_v1_create(server->wl_display); | 176 | wlr_export_dmabuf_manager_v1_create(server->wl_display); |
153 | wlr_screencopy_manager_v1_create(server->wl_display); | 177 | wlr_screencopy_manager_v1_create(server->wl_display); |
154 | wlr_data_control_manager_v1_create(server->wl_display); | 178 | wlr_data_control_manager_v1_create(server->wl_display); |