diff options
Diffstat (limited to 'include/sway/server.h')
-rw-r--r-- | include/sway/server.h | 93 |
1 files changed, 62 insertions, 31 deletions
diff --git a/include/sway/server.h b/include/sway/server.h index 3a5670d9..c71851f6 100644 --- a/include/sway/server.h +++ b/include/sway/server.h | |||
@@ -2,41 +2,43 @@ | |||
2 | #define _SWAY_SERVER_H | 2 | #define _SWAY_SERVER_H |
3 | #include <stdbool.h> | 3 | #include <stdbool.h> |
4 | #include <wayland-server-core.h> | 4 | #include <wayland-server-core.h> |
5 | #include <wlr/backend.h> | ||
6 | #include <wlr/backend/session.h> | ||
7 | #include <wlr/render/wlr_renderer.h> | ||
8 | #include <wlr/types/wlr_compositor.h> | ||
9 | #include <wlr/types/wlr_data_device.h> | ||
10 | #include <wlr/types/wlr_input_method_v2.h> | ||
11 | #include <wlr/types/wlr_foreign_toplevel_management_v1.h> | ||
12 | #include <wlr/types/wlr_layer_shell_v1.h> | ||
13 | #include <wlr/types/wlr_output_management_v1.h> | ||
14 | #include <wlr/types/wlr_output_power_management_v1.h> | ||
15 | #include <wlr/types/wlr_presentation_time.h> | ||
16 | #include <wlr/types/wlr_relative_pointer_v1.h> | ||
17 | #include <wlr/types/wlr_server_decoration.h> | ||
18 | #include <wlr/types/wlr_text_input_v3.h> | ||
19 | #include <wlr/types/wlr_xdg_shell.h> | ||
20 | #include "config.h" | 5 | #include "config.h" |
21 | #include "list.h" | 6 | #include "list.h" |
7 | #include "sway/desktop/idle_inhibit_v1.h" | ||
22 | #if HAVE_XWAYLAND | 8 | #if HAVE_XWAYLAND |
23 | #include "sway/xwayland.h" | 9 | #include "sway/xwayland.h" |
24 | #endif | 10 | #endif |
25 | 11 | ||
26 | struct sway_transaction; | 12 | struct sway_transaction; |
27 | 13 | ||
14 | struct sway_session_lock { | ||
15 | struct wlr_session_lock_v1 *lock; | ||
16 | struct wlr_surface *focused; | ||
17 | bool abandoned; | ||
18 | |||
19 | struct wl_list outputs; // struct sway_session_lock_output | ||
20 | |||
21 | // invalid if the session is abandoned | ||
22 | struct wl_listener new_surface; | ||
23 | struct wl_listener unlock; | ||
24 | struct wl_listener destroy; | ||
25 | }; | ||
26 | |||
28 | struct sway_server { | 27 | struct sway_server { |
29 | struct wl_display *wl_display; | 28 | struct wl_display *wl_display; |
30 | struct wl_event_loop *wl_event_loop; | 29 | struct wl_event_loop *wl_event_loop; |
31 | const char *socket; | 30 | const char *socket; |
32 | 31 | ||
33 | struct wlr_backend *backend; | 32 | struct wlr_backend *backend; |
34 | struct wlr_backend *noop_backend; | 33 | struct wlr_session *session; |
35 | // secondary headless backend used for creating virtual outputs on-the-fly | 34 | // secondary headless backend used for creating virtual outputs on-the-fly |
36 | struct wlr_backend *headless_backend; | 35 | struct wlr_backend *headless_backend; |
36 | struct wlr_renderer *renderer; | ||
37 | struct wlr_allocator *allocator; | ||
37 | 38 | ||
38 | struct wlr_compositor *compositor; | 39 | struct wlr_compositor *compositor; |
39 | struct wl_listener compositor_new_surface; | 40 | |
41 | struct wlr_linux_dmabuf_v1 *linux_dmabuf_v1; | ||
40 | 42 | ||
41 | struct wlr_data_device_manager *data_device_manager; | 43 | struct wlr_data_device_manager *data_device_manager; |
42 | 44 | ||
@@ -44,15 +46,16 @@ struct sway_server { | |||
44 | 46 | ||
45 | struct wl_listener new_output; | 47 | struct wl_listener new_output; |
46 | struct wl_listener output_layout_change; | 48 | struct wl_listener output_layout_change; |
49 | struct wl_listener renderer_lost; | ||
47 | 50 | ||
48 | struct wlr_idle *idle; | 51 | struct wlr_idle_notifier_v1 *idle_notifier_v1; |
49 | struct sway_idle_inhibit_manager_v1 *idle_inhibit_manager_v1; | 52 | struct sway_idle_inhibit_manager_v1 idle_inhibit_manager_v1; |
50 | 53 | ||
51 | struct wlr_layer_shell_v1 *layer_shell; | 54 | struct wlr_layer_shell_v1 *layer_shell; |
52 | struct wl_listener layer_shell_surface; | 55 | struct wl_listener layer_shell_surface; |
53 | 56 | ||
54 | struct wlr_xdg_shell *xdg_shell; | 57 | struct wlr_xdg_shell *xdg_shell; |
55 | struct wl_listener xdg_shell_surface; | 58 | struct wl_listener xdg_shell_toplevel; |
56 | 59 | ||
57 | struct wlr_tablet_manager_v2 *tablet_v2; | 60 | struct wlr_tablet_manager_v2 *tablet_v2; |
58 | 61 | ||
@@ -72,7 +75,8 @@ struct sway_server { | |||
72 | struct wl_listener xdg_decoration; | 75 | struct wl_listener xdg_decoration; |
73 | struct wl_list xdg_decorations; // sway_xdg_decoration::link | 76 | struct wl_list xdg_decorations; // sway_xdg_decoration::link |
74 | 77 | ||
75 | struct wlr_presentation *presentation; | 78 | struct wlr_drm_lease_v1_manager *drm_lease_manager; |
79 | struct wl_listener drm_lease_request; | ||
76 | 80 | ||
77 | struct wlr_pointer_constraints_v1 *pointer_constraints; | 81 | struct wlr_pointer_constraints_v1 *pointer_constraints; |
78 | struct wl_listener pointer_constraint; | 82 | struct wl_listener pointer_constraint; |
@@ -81,14 +85,36 @@ struct sway_server { | |||
81 | struct wl_listener output_manager_apply; | 85 | struct wl_listener output_manager_apply; |
82 | struct wl_listener output_manager_test; | 86 | struct wl_listener output_manager_test; |
83 | 87 | ||
88 | struct wlr_gamma_control_manager_v1 *gamma_control_manager_v1; | ||
89 | struct wl_listener gamma_control_set_gamma; | ||
90 | |||
91 | struct { | ||
92 | struct sway_session_lock *lock; | ||
93 | struct wlr_session_lock_manager_v1 *manager; | ||
94 | |||
95 | struct wl_listener new_lock; | ||
96 | struct wl_listener manager_destroy; | ||
97 | } session_lock; | ||
98 | |||
84 | struct wlr_output_power_manager_v1 *output_power_manager_v1; | 99 | struct wlr_output_power_manager_v1 *output_power_manager_v1; |
85 | struct wl_listener output_power_manager_set_mode; | 100 | struct wl_listener output_power_manager_set_mode; |
86 | struct wlr_input_method_manager_v2 *input_method; | 101 | struct wlr_input_method_manager_v2 *input_method; |
87 | struct wlr_text_input_manager_v3 *text_input; | 102 | struct wlr_text_input_manager_v3 *text_input; |
103 | struct wlr_ext_foreign_toplevel_list_v1 *foreign_toplevel_list; | ||
88 | struct wlr_foreign_toplevel_manager_v1 *foreign_toplevel_manager; | 104 | struct wlr_foreign_toplevel_manager_v1 *foreign_toplevel_manager; |
105 | struct wlr_content_type_manager_v1 *content_type_manager_v1; | ||
106 | struct wlr_data_control_manager_v1 *data_control_manager_v1; | ||
107 | struct wlr_screencopy_manager_v1 *screencopy_manager_v1; | ||
108 | struct wlr_export_dmabuf_manager_v1 *export_dmabuf_manager_v1; | ||
109 | struct wlr_security_context_manager_v1 *security_context_manager_v1; | ||
89 | 110 | ||
90 | struct wlr_xdg_activation_v1 *xdg_activation_v1; | 111 | struct wlr_xdg_activation_v1 *xdg_activation_v1; |
91 | struct wl_listener xdg_activation_v1_request_activate; | 112 | struct wl_listener xdg_activation_v1_request_activate; |
113 | struct wl_listener xdg_activation_v1_new_token; | ||
114 | |||
115 | struct wl_listener request_set_cursor_shape; | ||
116 | |||
117 | struct wl_list pending_launcher_ctxs; // launcher_ctx::link | ||
92 | 118 | ||
93 | // The timeout for transactions, after which a transaction is applied | 119 | // The timeout for transactions, after which a transaction is applied |
94 | // regardless of readiness. | 120 | // regardless of readiness. |
@@ -115,29 +141,30 @@ struct sway_debug { | |||
115 | bool noatomic; // Ignore atomic layout updates | 141 | bool noatomic; // Ignore atomic layout updates |
116 | bool txn_timings; // Log verbose messages about transactions | 142 | bool txn_timings; // Log verbose messages about transactions |
117 | bool txn_wait; // Always wait for the timeout before applying | 143 | bool txn_wait; // Always wait for the timeout before applying |
118 | 144 | bool legacy_wl_drm; // Enable the legacy wl_drm interface | |
119 | enum { | ||
120 | DAMAGE_DEFAULT, // Default behaviour | ||
121 | DAMAGE_HIGHLIGHT, // Highlight regions of the screen being damaged | ||
122 | DAMAGE_RERENDER, // Render the full output when any damage occurs | ||
123 | } damage; | ||
124 | }; | 145 | }; |
125 | 146 | ||
126 | extern struct sway_debug debug; | 147 | extern struct sway_debug debug; |
127 | 148 | ||
128 | /* Prepares an unprivileged server_init by performing all privileged operations in advance */ | 149 | extern bool allow_unsupported_gpu; |
129 | bool server_privileged_prepare(struct sway_server *server); | 150 | |
130 | bool server_init(struct sway_server *server); | 151 | bool server_init(struct sway_server *server); |
131 | void server_fini(struct sway_server *server); | 152 | void server_fini(struct sway_server *server); |
132 | bool server_start(struct sway_server *server); | 153 | bool server_start(struct sway_server *server); |
133 | void server_run(struct sway_server *server); | 154 | void server_run(struct sway_server *server); |
134 | 155 | ||
135 | void handle_compositor_new_surface(struct wl_listener *listener, void *data); | 156 | void restore_nofile_limit(void); |
157 | |||
136 | void handle_new_output(struct wl_listener *listener, void *data); | 158 | void handle_new_output(struct wl_listener *listener, void *data); |
137 | 159 | ||
138 | void handle_idle_inhibitor_v1(struct wl_listener *listener, void *data); | 160 | void handle_idle_inhibitor_v1(struct wl_listener *listener, void *data); |
139 | void handle_layer_shell_surface(struct wl_listener *listener, void *data); | 161 | void handle_layer_shell_surface(struct wl_listener *listener, void *data); |
140 | void handle_xdg_shell_surface(struct wl_listener *listener, void *data); | 162 | void sway_session_lock_init(void); |
163 | void sway_session_lock_add_output(struct sway_session_lock *lock, | ||
164 | struct sway_output *output); | ||
165 | bool sway_session_lock_has_surface(struct sway_session_lock *lock, | ||
166 | struct wlr_surface *surface); | ||
167 | void handle_xdg_shell_toplevel(struct wl_listener *listener, void *data); | ||
141 | #if HAVE_XWAYLAND | 168 | #if HAVE_XWAYLAND |
142 | void handle_xwayland_surface(struct wl_listener *listener, void *data); | 169 | void handle_xwayland_surface(struct wl_listener *listener, void *data); |
143 | #endif | 170 | #endif |
@@ -146,5 +173,9 @@ void handle_xdg_decoration(struct wl_listener *listener, void *data); | |||
146 | void handle_pointer_constraint(struct wl_listener *listener, void *data); | 173 | void handle_pointer_constraint(struct wl_listener *listener, void *data); |
147 | void xdg_activation_v1_handle_request_activate(struct wl_listener *listener, | 174 | void xdg_activation_v1_handle_request_activate(struct wl_listener *listener, |
148 | void *data); | 175 | void *data); |
176 | void xdg_activation_v1_handle_new_token(struct wl_listener *listener, | ||
177 | void *data); | ||
178 | |||
179 | void set_rr_scheduling(void); | ||
149 | 180 | ||
150 | #endif | 181 | #endif |