aboutsummaryrefslogtreecommitdiffstats
path: root/include/sway/server.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/sway/server.h')
-rw-r--r--include/sway/server.h85
1 files changed, 44 insertions, 41 deletions
diff --git a/include/sway/server.h b/include/sway/server.h
index 3d59ca56..c71851f6 100644
--- a/include/sway/server.h
+++ b/include/sway/server.h
@@ -2,45 +2,41 @@
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/allocator.h>
8#include <wlr/render/wlr_renderer.h>
9#include <wlr/types/wlr_compositor.h>
10#include <wlr/types/wlr_data_device.h>
11#include <wlr/types/wlr_input_method_v2.h>
12#include <wlr/types/wlr_foreign_toplevel_management_v1.h>
13#include <wlr/types/wlr_drm_lease_v1.h>
14#include <wlr/types/wlr_layer_shell_v1.h>
15#include <wlr/types/wlr_output_management_v1.h>
16#include <wlr/types/wlr_output_power_management_v1.h>
17#include <wlr/types/wlr_presentation_time.h>
18#include <wlr/types/wlr_relative_pointer_v1.h>
19#include <wlr/types/wlr_session_lock_v1.h>
20#include <wlr/types/wlr_server_decoration.h>
21#include <wlr/types/wlr_text_input_v3.h>
22#include <wlr/types/wlr_xdg_shell.h>
23#include "config.h" 5#include "config.h"
24#include "list.h" 6#include "list.h"
7#include "sway/desktop/idle_inhibit_v1.h"
25#if HAVE_XWAYLAND 8#if HAVE_XWAYLAND
26#include "sway/xwayland.h" 9#include "sway/xwayland.h"
27#endif 10#endif
28 11
29struct sway_transaction; 12struct sway_transaction;
30 13
14struct 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
31struct sway_server { 27struct sway_server {
32 struct wl_display *wl_display; 28 struct wl_display *wl_display;
33 struct wl_event_loop *wl_event_loop; 29 struct wl_event_loop *wl_event_loop;
34 const char *socket; 30 const char *socket;
35 31
36 struct wlr_backend *backend; 32 struct wlr_backend *backend;
33 struct wlr_session *session;
37 // secondary headless backend used for creating virtual outputs on-the-fly 34 // secondary headless backend used for creating virtual outputs on-the-fly
38 struct wlr_backend *headless_backend; 35 struct wlr_backend *headless_backend;
39 struct wlr_renderer *renderer; 36 struct wlr_renderer *renderer;
40 struct wlr_allocator *allocator; 37 struct wlr_allocator *allocator;
41 38
42 struct wlr_compositor *compositor; 39 struct wlr_compositor *compositor;
43 struct wl_listener compositor_new_surface;
44 40
45 struct wlr_linux_dmabuf_v1 *linux_dmabuf_v1; 41 struct wlr_linux_dmabuf_v1 *linux_dmabuf_v1;
46 42
@@ -50,15 +46,16 @@ struct sway_server {
50 46
51 struct wl_listener new_output; 47 struct wl_listener new_output;
52 struct wl_listener output_layout_change; 48 struct wl_listener output_layout_change;
49 struct wl_listener renderer_lost;
53 50
54 struct wlr_idle *idle; 51 struct wlr_idle_notifier_v1 *idle_notifier_v1;
55 struct sway_idle_inhibit_manager_v1 *idle_inhibit_manager_v1; 52 struct sway_idle_inhibit_manager_v1 idle_inhibit_manager_v1;
56 53
57 struct wlr_layer_shell_v1 *layer_shell; 54 struct wlr_layer_shell_v1 *layer_shell;
58 struct wl_listener layer_shell_surface; 55 struct wl_listener layer_shell_surface;
59 56
60 struct wlr_xdg_shell *xdg_shell; 57 struct wlr_xdg_shell *xdg_shell;
61 struct wl_listener xdg_shell_surface; 58 struct wl_listener xdg_shell_toplevel;
62 59
63 struct wlr_tablet_manager_v2 *tablet_v2; 60 struct wlr_tablet_manager_v2 *tablet_v2;
64 61
@@ -81,8 +78,6 @@ struct sway_server {
81 struct wlr_drm_lease_v1_manager *drm_lease_manager; 78 struct wlr_drm_lease_v1_manager *drm_lease_manager;
82 struct wl_listener drm_lease_request; 79 struct wl_listener drm_lease_request;
83 80
84 struct wlr_presentation *presentation;
85
86 struct wlr_pointer_constraints_v1 *pointer_constraints; 81 struct wlr_pointer_constraints_v1 *pointer_constraints;
87 struct wl_listener pointer_constraint; 82 struct wl_listener pointer_constraint;
88 83
@@ -90,15 +85,13 @@ struct sway_server {
90 struct wl_listener output_manager_apply; 85 struct wl_listener output_manager_apply;
91 struct wl_listener output_manager_test; 86 struct wl_listener output_manager_test;
92 87
88 struct wlr_gamma_control_manager_v1 *gamma_control_manager_v1;
89 struct wl_listener gamma_control_set_gamma;
90
93 struct { 91 struct {
94 bool locked; 92 struct sway_session_lock *lock;
95 struct wlr_session_lock_manager_v1 *manager; 93 struct wlr_session_lock_manager_v1 *manager;
96 94
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; 95 struct wl_listener new_lock;
103 struct wl_listener manager_destroy; 96 struct wl_listener manager_destroy;
104 } session_lock; 97 } session_lock;
@@ -107,10 +100,21 @@ struct sway_server {
107 struct wl_listener output_power_manager_set_mode; 100 struct wl_listener output_power_manager_set_mode;
108 struct wlr_input_method_manager_v2 *input_method; 101 struct wlr_input_method_manager_v2 *input_method;
109 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;
110 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;
111 110
112 struct wlr_xdg_activation_v1 *xdg_activation_v1; 111 struct wlr_xdg_activation_v1 *xdg_activation_v1;
113 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
114 118
115 // The timeout for transactions, after which a transaction is applied 119 // The timeout for transactions, after which a transaction is applied
116 // regardless of readiness. 120 // regardless of readiness.
@@ -137,19 +141,13 @@ struct sway_debug {
137 bool noatomic; // Ignore atomic layout updates 141 bool noatomic; // Ignore atomic layout updates
138 bool txn_timings; // Log verbose messages about transactions 142 bool txn_timings; // Log verbose messages about transactions
139 bool txn_wait; // Always wait for the timeout before applying 143 bool txn_wait; // Always wait for the timeout before applying
140 bool noscanout; // Disable direct scan-out 144 bool legacy_wl_drm; // Enable the legacy wl_drm interface
141
142 enum {
143 DAMAGE_DEFAULT, // Default behaviour
144 DAMAGE_HIGHLIGHT, // Highlight regions of the screen being damaged
145 DAMAGE_RERENDER, // Render the full output when any damage occurs
146 } damage;
147}; 145};
148 146
149extern struct sway_debug debug; 147extern struct sway_debug debug;
150 148
151/* Prepares an unprivileged server_init by performing all privileged operations in advance */ 149extern bool allow_unsupported_gpu;
152bool server_privileged_prepare(struct sway_server *server); 150
153bool server_init(struct sway_server *server); 151bool server_init(struct sway_server *server);
154void server_fini(struct sway_server *server); 152void server_fini(struct sway_server *server);
155bool server_start(struct sway_server *server); 153bool server_start(struct sway_server *server);
@@ -157,13 +155,16 @@ void server_run(struct sway_server *server);
157 155
158void restore_nofile_limit(void); 156void restore_nofile_limit(void);
159 157
160void handle_compositor_new_surface(struct wl_listener *listener, void *data);
161void handle_new_output(struct wl_listener *listener, void *data); 158void handle_new_output(struct wl_listener *listener, void *data);
162 159
163void handle_idle_inhibitor_v1(struct wl_listener *listener, void *data); 160void handle_idle_inhibitor_v1(struct wl_listener *listener, void *data);
164void handle_layer_shell_surface(struct wl_listener *listener, void *data); 161void handle_layer_shell_surface(struct wl_listener *listener, void *data);
165void sway_session_lock_init(void); 162void sway_session_lock_init(void);
166void handle_xdg_shell_surface(struct wl_listener *listener, void *data); 163void sway_session_lock_add_output(struct sway_session_lock *lock,
164 struct sway_output *output);
165bool sway_session_lock_has_surface(struct sway_session_lock *lock,
166 struct wlr_surface *surface);
167void handle_xdg_shell_toplevel(struct wl_listener *listener, void *data);
167#if HAVE_XWAYLAND 168#if HAVE_XWAYLAND
168void handle_xwayland_surface(struct wl_listener *listener, void *data); 169void handle_xwayland_surface(struct wl_listener *listener, void *data);
169#endif 170#endif
@@ -172,6 +173,8 @@ void handle_xdg_decoration(struct wl_listener *listener, void *data);
172void handle_pointer_constraint(struct wl_listener *listener, void *data); 173void handle_pointer_constraint(struct wl_listener *listener, void *data);
173void xdg_activation_v1_handle_request_activate(struct wl_listener *listener, 174void xdg_activation_v1_handle_request_activate(struct wl_listener *listener,
174 void *data); 175 void *data);
176void xdg_activation_v1_handle_new_token(struct wl_listener *listener,
177 void *data);
175 178
176void set_rr_scheduling(void); 179void set_rr_scheduling(void);
177 180