mirror of
https://github.com/hyprwm/wlroots-hyprland.git
synced 2024-11-04 20:55:58 +01:00
input-inhibitor: drop
wlr_input_inhibitor.h has been marked as deprecated in 0.17.0.
This commit is contained in:
parent
3b4d7d2a92
commit
5dd614b9ad
5 changed files with 0 additions and 243 deletions
|
@ -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 <wayland-server-core.h>
|
||||
|
||||
/*
|
||||
* 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
|
|
@ -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',
|
||||
|
|
|
@ -1,67 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<protocol name="wlr_input_inhibit_unstable_v1">
|
||||
<copyright>
|
||||
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.
|
||||
</copyright>
|
||||
|
||||
<interface name="zwlr_input_inhibit_manager_v1" version="1">
|
||||
<description summary="inhibits input events to other clients">
|
||||
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.
|
||||
</description>
|
||||
|
||||
<request name="get_inhibitor">
|
||||
<description summary="inhibit input to other clients">
|
||||
Activates the input inhibitor. As long as the inhibitor is active, the
|
||||
compositor will not send input events to other clients.
|
||||
</description>
|
||||
<arg name="id" type="new_id" interface="zwlr_input_inhibitor_v1"/>
|
||||
</request>
|
||||
|
||||
<enum name="error">
|
||||
<entry name="already_inhibited" value="0" summary="an input inhibitor is already in use on the compositor"/>
|
||||
</enum>
|
||||
</interface>
|
||||
|
||||
<interface name="zwlr_input_inhibitor_v1" version="1">
|
||||
<description summary="inhibits input 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).
|
||||
</description>
|
||||
|
||||
<request name="destroy" type="destructor">
|
||||
<description summary="destroy the input inhibitor object">
|
||||
Destroy the inhibitor and allow other clients to receive input.
|
||||
</description>
|
||||
</request>
|
||||
</interface>
|
||||
</protocol>
|
|
@ -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',
|
||||
|
|
|
@ -1,137 +0,0 @@
|
|||
#include <assert.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdlib.h>
|
||||
#include <wayland-server-core.h>
|
||||
#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;
|
||||
}
|
Loading…
Reference in a new issue