aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/sway/server.h4
-rw-r--r--sway/desktop/output.c14
-rw-r--r--sway/server.c17
3 files changed, 34 insertions, 1 deletions
diff --git a/include/sway/server.h b/include/sway/server.h
index 3c972bc5..e26571e9 100644
--- a/include/sway/server.h
+++ b/include/sway/server.h
@@ -8,6 +8,7 @@
8#include <wlr/types/wlr_compositor.h> 8#include <wlr/types/wlr_compositor.h>
9#include <wlr/types/wlr_data_device.h> 9#include <wlr/types/wlr_data_device.h>
10#include <wlr/types/wlr_input_method_v2.h> 10#include <wlr/types/wlr_input_method_v2.h>
11#include <wlr/types/wlr_drm_lease_v1.h>
11#include <wlr/types/wlr_layer_shell_v1.h> 12#include <wlr/types/wlr_layer_shell_v1.h>
12#include <wlr/types/wlr_output_management_v1.h> 13#include <wlr/types/wlr_output_management_v1.h>
13#include <wlr/types/wlr_output_power_management_v1.h> 14#include <wlr/types/wlr_output_power_management_v1.h>
@@ -69,6 +70,9 @@ struct sway_server {
69 struct wl_listener xdg_decoration; 70 struct wl_listener xdg_decoration;
70 struct wl_list xdg_decorations; // sway_xdg_decoration::link 71 struct wl_list xdg_decorations; // sway_xdg_decoration::link
71 72
73 struct wlr_drm_lease_manager_v1 *drm_lease_manager;
74 struct wl_listener drm_lease_requested;
75
72 struct wlr_presentation *presentation; 76 struct wlr_presentation *presentation;
73 77
74 struct wlr_pointer_constraints_v1 *pointer_constraints; 78 struct wlr_pointer_constraints_v1 *pointer_constraints;
diff --git a/sway/desktop/output.c b/sway/desktop/output.c
index a86622e1..563c04b8 100644
--- a/sway/desktop/output.c
+++ b/sway/desktop/output.c
@@ -4,9 +4,11 @@
4#include <strings.h> 4#include <strings.h>
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/render/wlr_renderer.h> 8#include <wlr/render/wlr_renderer.h>
8#include <wlr/types/wlr_box.h> 9#include <wlr/types/wlr_box.h>
9#include <wlr/types/wlr_buffer.h> 10#include <wlr/types/wlr_buffer.h>
11#include <wlr/types/wlr_drm_lease_v1.h>
10#include <wlr/types/wlr_matrix.h> 12#include <wlr/types/wlr_matrix.h>
11#include <wlr/types/wlr_output_damage.h> 13#include <wlr/types/wlr_output_damage.h>
12#include <wlr/types/wlr_output_layout.h> 14#include <wlr/types/wlr_output_layout.h>
@@ -920,7 +922,17 @@ static void handle_present(struct wl_listener *listener, void *data) {
920void handle_new_output(struct wl_listener *listener, void *data) { 922void handle_new_output(struct wl_listener *listener, void *data) {
921 struct sway_server *server = wl_container_of(listener, server, new_output); 923 struct sway_server *server = wl_container_of(listener, server, new_output);
922 struct wlr_output *wlr_output = data; 924 struct wlr_output *wlr_output = data;
923 sway_log(SWAY_DEBUG, "New output %p: %s", wlr_output, wlr_output->name); 925 sway_log(SWAY_DEBUG, "New output %p: %s (non-desktop: %d)",
926 wlr_output, wlr_output->name, wlr_output->non_desktop);
927
928 if (wlr_output->non_desktop) {
929 sway_log(SWAY_DEBUG, "Not configuring non-desktop output");
930 if (server->drm_lease_manager && wlr_output_is_drm(wlr_output)) {
931 wlr_drm_lease_manager_v1_offer_output(
932 server->drm_lease_manager, wlr_output);
933 }
934 return;
935 }
924 936
925 struct sway_output *output = output_create(wlr_output); 937 struct sway_output *output = output_create(wlr_output);
926 if (!output) { 938 if (!output) {
diff --git a/sway/server.c b/sway/server.c
index ec30430c..63b4bdd7 100644
--- a/sway/server.c
+++ b/sway/server.c
@@ -11,6 +11,7 @@
11#include <wlr/render/wlr_renderer.h> 11#include <wlr/render/wlr_renderer.h>
12#include <wlr/types/wlr_compositor.h> 12#include <wlr/types/wlr_compositor.h>
13#include <wlr/types/wlr_data_control_v1.h> 13#include <wlr/types/wlr_data_control_v1.h>
14#include <wlr/types/wlr_drm_lease_v1.h>
14#include <wlr/types/wlr_export_dmabuf_v1.h> 15#include <wlr/types/wlr_export_dmabuf_v1.h>
15#include <wlr/types/wlr_gamma_control_v1.h> 16#include <wlr/types/wlr_gamma_control_v1.h>
16#include <wlr/types/wlr_gtk_primary_selection.h> 17#include <wlr/types/wlr_gtk_primary_selection.h>
@@ -51,6 +52,14 @@ bool server_privileged_prepare(struct sway_server *server) {
51 return true; 52 return true;
52} 53}
53 54
55static void handle_drm_lease_requested(
56 struct wl_listener *listener, void *data) {
57 /* We only offer non-desktop outputs, but in the future we might want to do
58 * more logic here. */
59 struct wlr_drm_lease_request_v1 *req = data;
60 wlr_drm_lease_manager_v1_grant_lease_request(req->manager, req);
61}
62
54bool server_init(struct sway_server *server) { 63bool server_init(struct sway_server *server) {
55 sway_log(SWAY_DEBUG, "Initializing Wayland server"); 64 sway_log(SWAY_DEBUG, "Initializing Wayland server");
56 65
@@ -142,6 +151,14 @@ bool server_init(struct sway_server *server) {
142 server->input_method = wlr_input_method_manager_v2_create(server->wl_display); 151 server->input_method = wlr_input_method_manager_v2_create(server->wl_display);
143 server->text_input = wlr_text_input_manager_v3_create(server->wl_display); 152 server->text_input = wlr_text_input_manager_v3_create(server->wl_display);
144 153
154 server->drm_lease_manager =
155 wlr_drm_lease_manager_v1_create(server->wl_display, server->backend);
156 if (server->drm_lease_manager) {
157 server->drm_lease_requested.notify = handle_drm_lease_requested;
158 wl_signal_add(&server->drm_lease_manager->events.lease_requested,
159 &server->drm_lease_requested);
160 }
161
145 wlr_export_dmabuf_manager_v1_create(server->wl_display); 162 wlr_export_dmabuf_manager_v1_create(server->wl_display);
146 wlr_screencopy_manager_v1_create(server->wl_display); 163 wlr_screencopy_manager_v1_create(server->wl_display);
147 wlr_data_control_manager_v1_create(server->wl_display); 164 wlr_data_control_manager_v1_create(server->wl_display);