Implement input-inhibit in sway, swaylock
This commit is contained in:
parent
5e61e86883
commit
f3f3e642bd
10
main.c
10
main.c
@ -19,6 +19,7 @@
|
|||||||
#include "pool-buffer.h"
|
#include "pool-buffer.h"
|
||||||
#include "cairo.h"
|
#include "cairo.h"
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
|
#include "wlr-input-inhibitor-unstable-v1-client-protocol.h"
|
||||||
#include "wlr-layer-shell-unstable-v1-client-protocol.h"
|
#include "wlr-layer-shell-unstable-v1-client-protocol.h"
|
||||||
|
|
||||||
static void daemonize() {
|
static void daemonize() {
|
||||||
@ -71,6 +72,9 @@ static void handle_global(void *data, struct wl_registry *registry,
|
|||||||
} else if (strcmp(interface, zwlr_layer_shell_v1_interface.name) == 0) {
|
} else if (strcmp(interface, zwlr_layer_shell_v1_interface.name) == 0) {
|
||||||
state->layer_shell = wl_registry_bind(
|
state->layer_shell = wl_registry_bind(
|
||||||
registry, name, &zwlr_layer_shell_v1_interface, 1);
|
registry, name, &zwlr_layer_shell_v1_interface, 1);
|
||||||
|
} else if (strcmp(interface, zwlr_input_inhibit_manager_v1_interface.name) == 0) {
|
||||||
|
state->input_inhibit_manager = wl_registry_bind(
|
||||||
|
registry, name, &zwlr_input_inhibit_manager_v1_interface, 1);
|
||||||
} else if (strcmp(interface, wl_output_interface.name) == 0) {
|
} else if (strcmp(interface, wl_output_interface.name) == 0) {
|
||||||
struct swaylock_surface *surface =
|
struct swaylock_surface *surface =
|
||||||
calloc(1, sizeof(struct swaylock_surface));
|
calloc(1, sizeof(struct swaylock_surface));
|
||||||
@ -187,6 +191,10 @@ int main(int argc, char **argv) {
|
|||||||
wl_registry_add_listener(registry, ®istry_listener, &state);
|
wl_registry_add_listener(registry, ®istry_listener, &state);
|
||||||
wl_display_roundtrip(state.display);
|
wl_display_roundtrip(state.display);
|
||||||
assert(state.compositor && state.layer_shell && state.shm);
|
assert(state.compositor && state.layer_shell && state.shm);
|
||||||
|
if (!state.input_inhibit_manager) {
|
||||||
|
wlr_log(L_ERROR, "Compositor does not support the input inhibitor "
|
||||||
|
"protocol, refusing to run insecurely");
|
||||||
|
}
|
||||||
|
|
||||||
if (wl_list_empty(&state.surfaces)) {
|
if (wl_list_empty(&state.surfaces)) {
|
||||||
wlr_log(L_DEBUG, "Exiting - no outputs to show on.");
|
wlr_log(L_DEBUG, "Exiting - no outputs to show on.");
|
||||||
@ -220,6 +228,8 @@ int main(int argc, char **argv) {
|
|||||||
wl_display_roundtrip(state.display);
|
wl_display_roundtrip(state.display);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
zwlr_input_inhibit_manager_v1_get_inhibitor(state.input_inhibit_manager);
|
||||||
|
|
||||||
state.run_display = true;
|
state.run_display = true;
|
||||||
while (wl_display_dispatch(state.display) != -1 && state.run_display) {
|
while (wl_display_dispatch(state.display) != -1 && state.run_display) {
|
||||||
// This space intentionally left blank
|
// This space intentionally left blank
|
||||||
|
Loading…
Reference in New Issue
Block a user