diff options
Diffstat (limited to 'include/sway/server.h')
-rw-r--r-- | include/sway/server.h | 55 |
1 files changed, 51 insertions, 4 deletions
diff --git a/include/sway/server.h b/include/sway/server.h index 0f5e3ab2..4cce17cc 100644 --- a/include/sway/server.h +++ b/include/sway/server.h | |||
@@ -4,16 +4,19 @@ | |||
4 | #include <wayland-server-core.h> | 4 | #include <wayland-server-core.h> |
5 | #include <wlr/backend.h> | 5 | #include <wlr/backend.h> |
6 | #include <wlr/backend/session.h> | 6 | #include <wlr/backend/session.h> |
7 | #include <wlr/render/allocator.h> | ||
7 | #include <wlr/render/wlr_renderer.h> | 8 | #include <wlr/render/wlr_renderer.h> |
8 | #include <wlr/types/wlr_compositor.h> | 9 | #include <wlr/types/wlr_compositor.h> |
9 | #include <wlr/types/wlr_data_device.h> | 10 | #include <wlr/types/wlr_data_device.h> |
10 | #include <wlr/types/wlr_input_method_v2.h> | 11 | #include <wlr/types/wlr_input_method_v2.h> |
11 | #include <wlr/types/wlr_foreign_toplevel_management_v1.h> | 12 | #include <wlr/types/wlr_foreign_toplevel_management_v1.h> |
13 | #include <wlr/types/wlr_drm_lease_v1.h> | ||
12 | #include <wlr/types/wlr_layer_shell_v1.h> | 14 | #include <wlr/types/wlr_layer_shell_v1.h> |
13 | #include <wlr/types/wlr_output_management_v1.h> | 15 | #include <wlr/types/wlr_output_management_v1.h> |
14 | #include <wlr/types/wlr_output_power_management_v1.h> | 16 | #include <wlr/types/wlr_output_power_management_v1.h> |
15 | #include <wlr/types/wlr_presentation_time.h> | 17 | #include <wlr/types/wlr_presentation_time.h> |
16 | #include <wlr/types/wlr_relative_pointer_v1.h> | 18 | #include <wlr/types/wlr_relative_pointer_v1.h> |
19 | #include <wlr/types/wlr_session_lock_v1.h> | ||
17 | #include <wlr/types/wlr_server_decoration.h> | 20 | #include <wlr/types/wlr_server_decoration.h> |
18 | #include <wlr/types/wlr_text_input_v3.h> | 21 | #include <wlr/types/wlr_text_input_v3.h> |
19 | #include <wlr/types/wlr_xdg_shell.h> | 22 | #include <wlr/types/wlr_xdg_shell.h> |
@@ -23,19 +26,24 @@ | |||
23 | #include "sway/xwayland.h" | 26 | #include "sway/xwayland.h" |
24 | #endif | 27 | #endif |
25 | 28 | ||
29 | struct sway_transaction; | ||
30 | |||
26 | struct sway_server { | 31 | struct sway_server { |
27 | struct wl_display *wl_display; | 32 | struct wl_display *wl_display; |
28 | struct wl_event_loop *wl_event_loop; | 33 | struct wl_event_loop *wl_event_loop; |
29 | const char *socket; | 34 | const char *socket; |
30 | 35 | ||
31 | struct wlr_backend *backend; | 36 | struct wlr_backend *backend; |
32 | struct wlr_backend *noop_backend; | ||
33 | // secondary headless backend used for creating virtual outputs on-the-fly | 37 | // secondary headless backend used for creating virtual outputs on-the-fly |
34 | struct wlr_backend *headless_backend; | 38 | struct wlr_backend *headless_backend; |
39 | struct wlr_renderer *renderer; | ||
40 | struct wlr_allocator *allocator; | ||
35 | 41 | ||
36 | struct wlr_compositor *compositor; | 42 | struct wlr_compositor *compositor; |
37 | struct wl_listener compositor_new_surface; | 43 | struct wl_listener compositor_new_surface; |
38 | 44 | ||
45 | struct wlr_linux_dmabuf_v1 *linux_dmabuf_v1; | ||
46 | |||
39 | struct wlr_data_device_manager *data_device_manager; | 47 | struct wlr_data_device_manager *data_device_manager; |
40 | 48 | ||
41 | struct sway_input_manager *input; | 49 | struct sway_input_manager *input; |
@@ -70,6 +78,9 @@ struct sway_server { | |||
70 | struct wl_listener xdg_decoration; | 78 | struct wl_listener xdg_decoration; |
71 | struct wl_list xdg_decorations; // sway_xdg_decoration::link | 79 | struct wl_list xdg_decorations; // sway_xdg_decoration::link |
72 | 80 | ||
81 | struct wlr_drm_lease_v1_manager *drm_lease_manager; | ||
82 | struct wl_listener drm_lease_request; | ||
83 | |||
73 | struct wlr_presentation *presentation; | 84 | struct wlr_presentation *presentation; |
74 | 85 | ||
75 | struct wlr_pointer_constraints_v1 *pointer_constraints; | 86 | struct wlr_pointer_constraints_v1 *pointer_constraints; |
@@ -79,14 +90,44 @@ struct sway_server { | |||
79 | struct wl_listener output_manager_apply; | 90 | struct wl_listener output_manager_apply; |
80 | struct wl_listener output_manager_test; | 91 | struct wl_listener output_manager_test; |
81 | 92 | ||
93 | struct { | ||
94 | bool locked; | ||
95 | struct wlr_session_lock_manager_v1 *manager; | ||
96 | |||
97 | struct wlr_session_lock_v1 *lock; | ||
98 | struct wl_listener lock_new_surface; | ||
99 | struct wl_listener lock_unlock; | ||
100 | struct wl_listener lock_destroy; | ||
101 | |||
102 | struct wl_listener new_lock; | ||
103 | struct wl_listener manager_destroy; | ||
104 | } session_lock; | ||
105 | |||
82 | struct wlr_output_power_manager_v1 *output_power_manager_v1; | 106 | struct wlr_output_power_manager_v1 *output_power_manager_v1; |
83 | struct wl_listener output_power_manager_set_mode; | 107 | struct wl_listener output_power_manager_set_mode; |
84 | struct wlr_input_method_manager_v2 *input_method; | 108 | struct wlr_input_method_manager_v2 *input_method; |
85 | struct wlr_text_input_manager_v3 *text_input; | 109 | struct wlr_text_input_manager_v3 *text_input; |
86 | struct wlr_foreign_toplevel_manager_v1 *foreign_toplevel_manager; | 110 | struct wlr_foreign_toplevel_manager_v1 *foreign_toplevel_manager; |
87 | 111 | ||
112 | struct wlr_xdg_activation_v1 *xdg_activation_v1; | ||
113 | struct wl_listener xdg_activation_v1_request_activate; | ||
114 | |||
115 | // The timeout for transactions, after which a transaction is applied | ||
116 | // regardless of readiness. | ||
88 | size_t txn_timeout_ms; | 117 | size_t txn_timeout_ms; |
89 | list_t *transactions; | 118 | |
119 | // Stores a transaction after it has been committed, but is waiting for | ||
120 | // views to ack the new dimensions before being applied. A queued | ||
121 | // transaction is frozen and must not have new instructions added to it. | ||
122 | struct sway_transaction *queued_transaction; | ||
123 | |||
124 | // Stores a pending transaction that will be committed once the existing | ||
125 | // queued transaction is applied and freed. The pending transaction can be | ||
126 | // updated with new instructions as needed. | ||
127 | struct sway_transaction *pending_transaction; | ||
128 | |||
129 | // Stores the nodes that have been marked as "dirty" and will be put into | ||
130 | // the pending transaction. | ||
90 | list_t *dirty_nodes; | 131 | list_t *dirty_nodes; |
91 | }; | 132 | }; |
92 | 133 | ||
@@ -96,6 +137,7 @@ struct sway_debug { | |||
96 | bool noatomic; // Ignore atomic layout updates | 137 | bool noatomic; // Ignore atomic layout updates |
97 | bool txn_timings; // Log verbose messages about transactions | 138 | bool txn_timings; // Log verbose messages about transactions |
98 | bool txn_wait; // Always wait for the timeout before applying | 139 | bool txn_wait; // Always wait for the timeout before applying |
140 | bool noscanout; // Disable direct scan-out | ||
99 | 141 | ||
100 | enum { | 142 | enum { |
101 | DAMAGE_DEFAULT, // Default behaviour | 143 | DAMAGE_DEFAULT, // Default behaviour |
@@ -106,18 +148,19 @@ struct sway_debug { | |||
106 | 148 | ||
107 | extern struct sway_debug debug; | 149 | extern struct sway_debug debug; |
108 | 150 | ||
109 | /* Prepares an unprivileged server_init by performing all privileged operations in advance */ | ||
110 | bool server_privileged_prepare(struct sway_server *server); | ||
111 | bool server_init(struct sway_server *server); | 151 | bool server_init(struct sway_server *server); |
112 | void server_fini(struct sway_server *server); | 152 | void server_fini(struct sway_server *server); |
113 | bool server_start(struct sway_server *server); | 153 | bool server_start(struct sway_server *server); |
114 | void server_run(struct sway_server *server); | 154 | void server_run(struct sway_server *server); |
115 | 155 | ||
156 | void restore_nofile_limit(void); | ||
157 | |||
116 | void handle_compositor_new_surface(struct wl_listener *listener, void *data); | 158 | void handle_compositor_new_surface(struct wl_listener *listener, void *data); |
117 | void handle_new_output(struct wl_listener *listener, void *data); | 159 | void handle_new_output(struct wl_listener *listener, void *data); |
118 | 160 | ||
119 | void handle_idle_inhibitor_v1(struct wl_listener *listener, void *data); | 161 | void handle_idle_inhibitor_v1(struct wl_listener *listener, void *data); |
120 | void handle_layer_shell_surface(struct wl_listener *listener, void *data); | 162 | void handle_layer_shell_surface(struct wl_listener *listener, void *data); |
163 | void sway_session_lock_init(void); | ||
121 | void handle_xdg_shell_surface(struct wl_listener *listener, void *data); | 164 | void handle_xdg_shell_surface(struct wl_listener *listener, void *data); |
122 | #if HAVE_XWAYLAND | 165 | #if HAVE_XWAYLAND |
123 | void handle_xwayland_surface(struct wl_listener *listener, void *data); | 166 | void handle_xwayland_surface(struct wl_listener *listener, void *data); |
@@ -125,5 +168,9 @@ void handle_xwayland_surface(struct wl_listener *listener, void *data); | |||
125 | void handle_server_decoration(struct wl_listener *listener, void *data); | 168 | void handle_server_decoration(struct wl_listener *listener, void *data); |
126 | void handle_xdg_decoration(struct wl_listener *listener, void *data); | 169 | void handle_xdg_decoration(struct wl_listener *listener, void *data); |
127 | void handle_pointer_constraint(struct wl_listener *listener, void *data); | 170 | void handle_pointer_constraint(struct wl_listener *listener, void *data); |
171 | void xdg_activation_v1_handle_request_activate(struct wl_listener *listener, | ||
172 | void *data); | ||
173 | |||
174 | void set_rr_scheduling(void); | ||
128 | 175 | ||
129 | #endif | 176 | #endif |