diff options
Diffstat (limited to 'swaylock/main.c')
-rw-r--r-- | swaylock/main.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/swaylock/main.c b/swaylock/main.c index 7f502eb1..6cd4e41d 100644 --- a/swaylock/main.c +++ b/swaylock/main.c | |||
@@ -19,6 +19,7 @@ | |||
19 | #include "pool-buffer.h" | 19 | #include "pool-buffer.h" |
20 | #include "cairo.h" | 20 | #include "cairo.h" |
21 | #include "util.h" | 21 | #include "util.h" |
22 | #include "wlr-input-inhibitor-unstable-v1-client-protocol.h" | ||
22 | #include "wlr-layer-shell-unstable-v1-client-protocol.h" | 23 | #include "wlr-layer-shell-unstable-v1-client-protocol.h" |
23 | 24 | ||
24 | static void daemonize() { | 25 | static void daemonize() { |
@@ -71,6 +72,9 @@ static void handle_global(void *data, struct wl_registry *registry, | |||
71 | } else if (strcmp(interface, zwlr_layer_shell_v1_interface.name) == 0) { | 72 | } else if (strcmp(interface, zwlr_layer_shell_v1_interface.name) == 0) { |
72 | state->layer_shell = wl_registry_bind( | 73 | state->layer_shell = wl_registry_bind( |
73 | registry, name, &zwlr_layer_shell_v1_interface, 1); | 74 | registry, name, &zwlr_layer_shell_v1_interface, 1); |
75 | } else if (strcmp(interface, zwlr_input_inhibit_manager_v1_interface.name) == 0) { | ||
76 | state->input_inhibit_manager = wl_registry_bind( | ||
77 | registry, name, &zwlr_input_inhibit_manager_v1_interface, 1); | ||
74 | } else if (strcmp(interface, wl_output_interface.name) == 0) { | 78 | } else if (strcmp(interface, wl_output_interface.name) == 0) { |
75 | struct swaylock_surface *surface = | 79 | struct swaylock_surface *surface = |
76 | calloc(1, sizeof(struct swaylock_surface)); | 80 | calloc(1, sizeof(struct swaylock_surface)); |
@@ -187,6 +191,10 @@ int main(int argc, char **argv) { | |||
187 | wl_registry_add_listener(registry, ®istry_listener, &state); | 191 | wl_registry_add_listener(registry, ®istry_listener, &state); |
188 | wl_display_roundtrip(state.display); | 192 | wl_display_roundtrip(state.display); |
189 | assert(state.compositor && state.layer_shell && state.shm); | 193 | assert(state.compositor && state.layer_shell && state.shm); |
194 | if (!state.input_inhibit_manager) { | ||
195 | wlr_log(L_ERROR, "Compositor does not support the input inhibitor " | ||
196 | "protocol, refusing to run insecurely"); | ||
197 | } | ||
190 | 198 | ||
191 | if (wl_list_empty(&state.surfaces)) { | 199 | if (wl_list_empty(&state.surfaces)) { |
192 | wlr_log(L_DEBUG, "Exiting - no outputs to show on."); | 200 | wlr_log(L_DEBUG, "Exiting - no outputs to show on."); |
@@ -220,6 +228,8 @@ int main(int argc, char **argv) { | |||
220 | wl_display_roundtrip(state.display); | 228 | wl_display_roundtrip(state.display); |
221 | } | 229 | } |
222 | 230 | ||
231 | zwlr_input_inhibit_manager_v1_get_inhibitor(state.input_inhibit_manager); | ||
232 | |||
223 | state.run_display = true; | 233 | state.run_display = true; |
224 | while (wl_display_dispatch(state.display) != -1 && state.run_display) { | 234 | while (wl_display_dispatch(state.display) != -1 && state.run_display) { |
225 | // This space intentionally left blank | 235 | // This space intentionally left blank |