aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/sway/input/input-manager.h5
-rw-r--r--include/sway/input/seat.h3
-rw-r--r--sway/input/input-manager.c27
-rw-r--r--sway/input/seat.c5
4 files changed, 40 insertions, 0 deletions
diff --git a/include/sway/input/input-manager.h b/include/sway/input/input-manager.h
index 8e39a4a7..89a3ac71 100644
--- a/include/sway/input/input-manager.h
+++ b/include/sway/input/input-manager.h
@@ -1,6 +1,7 @@
#ifndef _SWAY_INPUT_INPUT_MANAGER_H
#define _SWAY_INPUT_INPUT_MANAGER_H
#include <libinput.h>
+#include <wlr/types/wlr_input_inhibitor.h>
#include "sway/server.h"
#include "sway/config.h"
#include "list.h"
@@ -23,7 +24,11 @@ struct sway_input_manager {
struct wl_list devices;
struct wl_list seats;
+ struct wlr_input_inhibit_manager *inhibit;
+
struct wl_listener new_input;
+ struct wl_listener inhibit_activate;
+ struct wl_listener inhibit_deactivate;
};
struct sway_input_manager *input_manager_create(struct sway_server *server);
diff --git a/include/sway/input/seat.h b/include/sway/input/seat.h
index 137fcd22..53031d70 100644
--- a/include/sway/input/seat.h
+++ b/include/sway/input/seat.h
@@ -64,6 +64,9 @@ void seat_set_focus_warp(struct sway_seat *seat,
void seat_set_focus_layer(struct sway_seat *seat,
struct wlr_layer_surface *layer);
+void seat_set_exclusive_client(struct sway_seat *seat,
+ struct wl_client *client);
+
struct sway_container *seat_get_focus(struct sway_seat *seat);
/**
diff --git a/sway/input/input-manager.c b/sway/input/input-manager.c
index c3507f65..3b2d1d55 100644
--- a/sway/input/input-manager.c
+++ b/sway/input/input-manager.c
@@ -7,6 +7,7 @@
#include <libinput.h>
#include <math.h>
#include <wlr/backend/libinput.h>
+#include <wlr/types/wlr_input_inhibitor.h>
#include "sway/config.h"
#include "sway/input/input-manager.h"
#include "sway/input/seat.h"
@@ -263,6 +264,24 @@ static void handle_new_input(struct wl_listener *listener, void *data) {
input_device->device_destroy.notify = handle_device_destroy;
}
+static void handle_inhibit_activate(struct wl_listener *listener, void *data) {
+ struct sway_input_manager *input_manager = wl_container_of(
+ listener, input_manager, inhibit_activate);
+ struct sway_seat *seat;
+ wl_list_for_each(seat, &input_manager->seats, link) {
+ seat_set_exclusive_client(seat, input_manager->inhibit->active_client);
+ }
+}
+
+static void handle_inhibit_deactivate(struct wl_listener *listener, void *data) {
+ struct sway_input_manager *input_manager = wl_container_of(
+ listener, input_manager, inhibit_deactivate);
+ struct sway_seat *seat;
+ wl_list_for_each(seat, &input_manager->seats, link) {
+ seat_set_exclusive_client(seat, NULL);
+ }
+}
+
struct sway_input_manager *input_manager_create(
struct sway_server *server) {
struct sway_input_manager *input =
@@ -281,6 +300,14 @@ struct sway_input_manager *input_manager_create(
input->new_input.notify = handle_new_input;
wl_signal_add(&server->backend->events.new_input, &input->new_input);
+ input->inhibit = wlr_input_inhibit_manager_create(server->wl_display);
+ input->inhibit_activate.notify = handle_inhibit_activate;
+ wl_signal_add(&input->inhibit->events.activate,
+ &input->inhibit_activate);
+ input->inhibit_deactivate.notify = handle_inhibit_deactivate;
+ wl_signal_add(&input->inhibit->events.deactivate,
+ &input->inhibit_deactivate);
+
return input;
}
diff --git a/sway/input/seat.c b/sway/input/seat.c
index a6b42598..318fa9f6 100644
--- a/sway/input/seat.c
+++ b/sway/input/seat.c
@@ -460,6 +460,11 @@ void seat_set_focus_layer(struct sway_seat *seat,
}
}
+void seat_set_exclusive_client(struct sway_seat *seat,
+ struct wl_client *client) {
+ // TODO
+}
+
struct sway_container *seat_get_focus_inactive(struct sway_seat *seat,
struct sway_container *container) {
return seat_get_focus_by_type(seat, container, C_TYPES);