From 5dd614b9adc97bf1c89c8e2ebe8504841f8635ea Mon Sep 17 00:00:00 2001 From: Kirill Primak Date: Tue, 21 Nov 2023 20:10:18 +0300 Subject: [PATCH] input-inhibitor: drop wlr_input_inhibitor.h has been marked as deprecated in 0.17.0. --- include/wlr/types/wlr_input_inhibitor.h | 37 ----- protocol/meson.build | 1 - protocol/wlr-input-inhibitor-unstable-v1.xml | 67 --------- types/meson.build | 1 - types/wlr_input_inhibitor.c | 137 ------------------- 5 files changed, 243 deletions(-) delete mode 100644 include/wlr/types/wlr_input_inhibitor.h delete mode 100644 protocol/wlr-input-inhibitor-unstable-v1.xml delete mode 100644 types/wlr_input_inhibitor.c diff --git a/include/wlr/types/wlr_input_inhibitor.h b/include/wlr/types/wlr_input_inhibitor.h deleted file mode 100644 index 49bc3ac2..00000000 --- a/include/wlr/types/wlr_input_inhibitor.h +++ /dev/null @@ -1,37 +0,0 @@ -/* - * This an unstable interface of wlroots. No guarantees are made regarding the - * future consistency of this API. - */ -#ifndef WLR_USE_UNSTABLE -#error "Add -DWLR_USE_UNSTABLE to enable unstable wlroots features" -#endif - -#ifndef WLR_TYPES_INPUT_INHIBITOR_H -#define WLR_TYPES_INPUT_INHIBITOR_H -#include - -/* - * NOTE: Following the protocol deprecation, wlr/types/wlr_input_inhibitor.h is - * deprecated and will be removed in the next release. - */ - -struct wlr_input_inhibit_manager { - struct wl_global *global; - struct wl_client *active_client; - struct wl_resource *active_inhibitor; - - struct wl_listener display_destroy; - - struct { - struct wl_signal activate; // struct wlr_input_inhibit_manager - struct wl_signal deactivate; // struct wlr_input_inhibit_manager - struct wl_signal destroy; - } events; - - void *data; -}; - -struct wlr_input_inhibit_manager *wlr_input_inhibit_manager_create( - struct wl_display *display); - -#endif diff --git a/protocol/meson.build b/protocol/meson.build index af0ae03f..c9c0977c 100644 --- a/protocol/meson.build +++ b/protocol/meson.build @@ -55,7 +55,6 @@ protocols = { 'wlr-export-dmabuf-unstable-v1': 'wlr-export-dmabuf-unstable-v1.xml', 'wlr-foreign-toplevel-management-unstable-v1': 'wlr-foreign-toplevel-management-unstable-v1.xml', 'wlr-gamma-control-unstable-v1': 'wlr-gamma-control-unstable-v1.xml', - 'wlr-input-inhibitor-unstable-v1': 'wlr-input-inhibitor-unstable-v1.xml', 'wlr-layer-shell-unstable-v1': 'wlr-layer-shell-unstable-v1.xml', 'wlr-output-management-unstable-v1': 'wlr-output-management-unstable-v1.xml', 'wlr-output-power-management-unstable-v1': 'wlr-output-power-management-unstable-v1.xml', diff --git a/protocol/wlr-input-inhibitor-unstable-v1.xml b/protocol/wlr-input-inhibitor-unstable-v1.xml deleted file mode 100644 index b62d1bb4..00000000 --- a/protocol/wlr-input-inhibitor-unstable-v1.xml +++ /dev/null @@ -1,67 +0,0 @@ - - - - Copyright © 2018 Drew DeVault - - Permission to use, copy, modify, distribute, and sell this - software and its documentation for any purpose is hereby granted - without fee, provided that the above copyright notice appear in - all copies and that both that copyright notice and this permission - notice appear in supporting documentation, and that the name of - the copyright holders not be used in advertising or publicity - pertaining to distribution of the software without specific, - written prior permission. The copyright holders make no - representations about the suitability of this software for any - purpose. It is provided "as is" without express or implied - warranty. - - THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS - SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND - FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY - SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN - AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, - ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF - THIS SOFTWARE. - - - - - Clients can use this interface to prevent input events from being sent to - any surfaces but its own, which is useful for example in lock screen - software. It is assumed that access to this interface will be locked down - to whitelisted clients by the compositor. - - - - - Activates the input inhibitor. As long as the inhibitor is active, the - compositor will not send input events to other clients. - - - - - - - - - - - - While this resource exists, input to clients other than the owner of the - inhibitor resource will not receive input events. The client that owns - this resource will receive all input events normally. The compositor will - also disable all of its own input processing (such as keyboard shortcuts) - while the inhibitor is active. - - The compositor may continue to send input events to selected clients, - such as an on-screen keyboard (via the input-method protocol). - - - - - Destroy the inhibitor and allow other clients to receive input. - - - - diff --git a/types/meson.build b/types/meson.build index ba41e3e2..e358cc33 100644 --- a/types/meson.build +++ b/types/meson.build @@ -48,7 +48,6 @@ wlr_files += files( 'wlr_idle_inhibit_v1.c', 'wlr_idle_notify_v1.c', 'wlr_input_device.c', - 'wlr_input_inhibitor.c', 'wlr_input_method_v2.c', 'wlr_keyboard.c', 'wlr_keyboard_group.c', diff --git a/types/wlr_input_inhibitor.c b/types/wlr_input_inhibitor.c deleted file mode 100644 index 44a7f098..00000000 --- a/types/wlr_input_inhibitor.c +++ /dev/null @@ -1,137 +0,0 @@ -#include -#include -#include -#include -#include "wlr/types/wlr_input_inhibitor.h" -#include "wlr-input-inhibitor-unstable-v1-protocol.h" - -static const struct zwlr_input_inhibit_manager_v1_interface inhibit_manager_implementation; -static const struct zwlr_input_inhibitor_v1_interface input_inhibitor_implementation; - -static struct wlr_input_inhibit_manager *input_inhibit_manager_from_resource( - struct wl_resource *resource) { - assert(wl_resource_instance_of(resource, - &zwlr_input_inhibit_manager_v1_interface, - &inhibit_manager_implementation) - || wl_resource_instance_of(resource, - &zwlr_input_inhibitor_v1_interface, - &input_inhibitor_implementation)); - return wl_resource_get_user_data(resource); -} - -static void input_inhibit_manager_deactivate( - struct wlr_input_inhibit_manager *manager) { - if (manager->active_client == NULL && manager->active_inhibitor == NULL) { - return; - } - manager->active_client = NULL; - manager->active_inhibitor = NULL; - wl_signal_emit_mutable(&manager->events.deactivate, manager); -} - -static void input_inhibitor_destroy(struct wl_client *client, - struct wl_resource *resource) { - struct wlr_input_inhibit_manager *manager = - input_inhibit_manager_from_resource(resource); - input_inhibit_manager_deactivate(manager); - wl_resource_destroy(resource); -} - -static void input_inhibitor_resource_destroy(struct wl_resource *resource) { - struct wlr_input_inhibit_manager *manager = - input_inhibit_manager_from_resource(resource); - input_inhibit_manager_deactivate(manager); -} - -static const struct zwlr_input_inhibitor_v1_interface input_inhibitor_implementation = { - .destroy = input_inhibitor_destroy, -}; - -static void inhibit_manager_get_inhibitor(struct wl_client *client, - struct wl_resource *resource, uint32_t id) { - struct wlr_input_inhibit_manager *manager = - input_inhibit_manager_from_resource(resource); - if (manager->active_client || manager->active_inhibitor) { - wl_resource_post_error(resource, - ZWLR_INPUT_INHIBIT_MANAGER_V1_ERROR_ALREADY_INHIBITED, - "this compositor already has input inhibited"); - return; - } - - struct wl_resource *wl_resource = wl_resource_create(client, - &zwlr_input_inhibitor_v1_interface, - wl_resource_get_version(resource), id); - if (!wl_resource) { - wl_client_post_no_memory(client); - } - wl_resource_set_implementation(wl_resource, &input_inhibitor_implementation, - manager, input_inhibitor_resource_destroy); - - manager->active_client = client; - manager->active_inhibitor = wl_resource; - - wl_signal_emit_mutable(&manager->events.activate, manager); -} - -static const struct zwlr_input_inhibit_manager_v1_interface inhibit_manager_implementation = { - .get_inhibitor = inhibit_manager_get_inhibitor -}; - -static void input_manager_resource_destroy(struct wl_resource *resource) { - struct wlr_input_inhibit_manager *manager = - input_inhibit_manager_from_resource(resource); - struct wl_client *client = wl_resource_get_client(resource); - if (manager->active_client == client) { - input_inhibit_manager_deactivate(manager); - } -} - -static void inhibit_manager_bind(struct wl_client *wl_client, void *data, - uint32_t version, uint32_t id) { - struct wlr_input_inhibit_manager *manager = data; - - struct wl_resource *wl_resource = wl_resource_create(wl_client, - &zwlr_input_inhibit_manager_v1_interface, version, id); - if (wl_resource == NULL) { - wl_client_post_no_memory(wl_client); - return; - } - wl_resource_set_implementation(wl_resource, - &inhibit_manager_implementation, manager, - input_manager_resource_destroy); -} - -static void handle_display_destroy(struct wl_listener *listener, void *data) { - struct wlr_input_inhibit_manager *manager = - wl_container_of(listener, manager, display_destroy); - wl_signal_emit_mutable(&manager->events.destroy, manager); - wl_list_remove(&manager->display_destroy.link); - wl_global_destroy(manager->global); - free(manager); -} - -struct wlr_input_inhibit_manager *wlr_input_inhibit_manager_create( - struct wl_display *display) { - // TODO: Client destroy - struct wlr_input_inhibit_manager *manager = calloc(1, sizeof(*manager)); - if (!manager) { - return NULL; - } - - manager->global = wl_global_create(display, - &zwlr_input_inhibit_manager_v1_interface, - 1, manager, inhibit_manager_bind); - if (manager->global == NULL){ - free(manager); - return NULL; - } - - wl_signal_init(&manager->events.activate); - wl_signal_init(&manager->events.deactivate); - wl_signal_init(&manager->events.destroy); - - manager->display_destroy.notify = handle_display_destroy; - wl_display_add_destroy_listener(display, &manager->display_destroy); - - return manager; -}