wlroots-hyprland/include/wlr/types/wlr_keyboard_shortcuts_inhi...

86 lines
2.6 KiB
C
Raw Normal View History

keyboard-shortcuts-inhibit: Implement the protocol The keyboard shortcuts inhibitor protocol is useful for remote desktop and virtualization software in order to request all keyboard events to be passed to it and (almost) none being resonded to by the compositor. This allows the session at the other end of the remote desktop connection or inside the virtual machine to be interacted with as usual (e.g. Alt+Tab to switch windows on the remote system instead of locally). Add the wayland protocol to the meson build files. Copy'n'search'n'replace the very similar idle inhibit protocol implementation. This already provides all the basic functionality: - creating and destroying inhibitors upon request by a client, - destruction in reaction to destruction of surfaces or displays, - a list of inhibitors to search through for existing ones as well as - a signal to be sent to the compositor upon registration of a new inhibitor. Beyond that we add the active and inactive events to be sent to the client and wire those to activate and deactivate functions for the compositor to call in confirmation of activation of a new inhibitor or (un-)suspending of an existing inhibitor e.g. in response to a special key combination entered by the user as suggested by the protocol. As mandated by the protocol, we check the existance of an inhibitor for a given surface and seat upon creation and return the error provided by the protocol for that purpose. Signed-off-by: Michael Weiser <michael.weiser@gmx.de> Closes: https://github.com/swaywm/wlroots/issues/1817
2020-02-12 22:45:54 +01:00
/*
* 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_WLR_KEYBOARD_SHORTCUTS_INHIBIT_V1_H
#define WLR_TYPES_WLR_KEYBOARD_SHORTCUTS_INHIBIT_V1_H
#include <wayland-server-core.h>
#include <wlr/types/wlr_seat.h>
/* This interface permits clients to inhibit keyboard shortcut processing by
* the compositor.
*
* This allows clients to pass them on to e.g. remote desktops or virtual
* machine guests.
*
* Inhibitors are created for surfaces and seats. They should only be in effect
* while this surface has focus.
*/
struct wlr_keyboard_shortcuts_inhibit_manager_v1 {
// wlr_keyboard_shortcuts_inhibitor_v1.link
keyboard-shortcuts-inhibit: Implement the protocol The keyboard shortcuts inhibitor protocol is useful for remote desktop and virtualization software in order to request all keyboard events to be passed to it and (almost) none being resonded to by the compositor. This allows the session at the other end of the remote desktop connection or inside the virtual machine to be interacted with as usual (e.g. Alt+Tab to switch windows on the remote system instead of locally). Add the wayland protocol to the meson build files. Copy'n'search'n'replace the very similar idle inhibit protocol implementation. This already provides all the basic functionality: - creating and destroying inhibitors upon request by a client, - destruction in reaction to destruction of surfaces or displays, - a list of inhibitors to search through for existing ones as well as - a signal to be sent to the compositor upon registration of a new inhibitor. Beyond that we add the active and inactive events to be sent to the client and wire those to activate and deactivate functions for the compositor to call in confirmation of activation of a new inhibitor or (un-)suspending of an existing inhibitor e.g. in response to a special key combination entered by the user as suggested by the protocol. As mandated by the protocol, we check the existance of an inhibitor for a given surface and seat upon creation and return the error provided by the protocol for that purpose. Signed-off-by: Michael Weiser <michael.weiser@gmx.de> Closes: https://github.com/swaywm/wlroots/issues/1817
2020-02-12 22:45:54 +01:00
struct wl_list inhibitors;
struct wl_global *global;
struct wl_listener display_destroy;
struct {
struct wl_signal new_inhibitor; // struct wlr_keyboard_shortcuts_inhibitor_v1
keyboard-shortcuts-inhibit: Implement the protocol The keyboard shortcuts inhibitor protocol is useful for remote desktop and virtualization software in order to request all keyboard events to be passed to it and (almost) none being resonded to by the compositor. This allows the session at the other end of the remote desktop connection or inside the virtual machine to be interacted with as usual (e.g. Alt+Tab to switch windows on the remote system instead of locally). Add the wayland protocol to the meson build files. Copy'n'search'n'replace the very similar idle inhibit protocol implementation. This already provides all the basic functionality: - creating and destroying inhibitors upon request by a client, - destruction in reaction to destruction of surfaces or displays, - a list of inhibitors to search through for existing ones as well as - a signal to be sent to the compositor upon registration of a new inhibitor. Beyond that we add the active and inactive events to be sent to the client and wire those to activate and deactivate functions for the compositor to call in confirmation of activation of a new inhibitor or (un-)suspending of an existing inhibitor e.g. in response to a special key combination entered by the user as suggested by the protocol. As mandated by the protocol, we check the existance of an inhibitor for a given surface and seat upon creation and return the error provided by the protocol for that purpose. Signed-off-by: Michael Weiser <michael.weiser@gmx.de> Closes: https://github.com/swaywm/wlroots/issues/1817
2020-02-12 22:45:54 +01:00
struct wl_signal destroy;
} events;
void *data;
};
struct wlr_keyboard_shortcuts_inhibitor_v1 {
struct wlr_surface *surface;
struct wlr_seat *seat;
bool active;
struct wl_resource *resource;
struct wl_listener surface_destroy;
struct wl_listener seat_destroy;
// wlr_keyboard_shortcuts_inhibit_manager_v1.inhibitors
keyboard-shortcuts-inhibit: Implement the protocol The keyboard shortcuts inhibitor protocol is useful for remote desktop and virtualization software in order to request all keyboard events to be passed to it and (almost) none being resonded to by the compositor. This allows the session at the other end of the remote desktop connection or inside the virtual machine to be interacted with as usual (e.g. Alt+Tab to switch windows on the remote system instead of locally). Add the wayland protocol to the meson build files. Copy'n'search'n'replace the very similar idle inhibit protocol implementation. This already provides all the basic functionality: - creating and destroying inhibitors upon request by a client, - destruction in reaction to destruction of surfaces or displays, - a list of inhibitors to search through for existing ones as well as - a signal to be sent to the compositor upon registration of a new inhibitor. Beyond that we add the active and inactive events to be sent to the client and wire those to activate and deactivate functions for the compositor to call in confirmation of activation of a new inhibitor or (un-)suspending of an existing inhibitor e.g. in response to a special key combination entered by the user as suggested by the protocol. As mandated by the protocol, we check the existance of an inhibitor for a given surface and seat upon creation and return the error provided by the protocol for that purpose. Signed-off-by: Michael Weiser <michael.weiser@gmx.de> Closes: https://github.com/swaywm/wlroots/issues/1817
2020-02-12 22:45:54 +01:00
struct wl_list link;
struct {
struct wl_signal destroy;
} events;
void *data;
};
/*
* A compositor creating a manager will handle the new_inhibitor event and call
* wlr_keyboard_shortcuts_inhibitor_v1_activate() if it decides to honour the
* inhibitor. This will send the active event to the client, confirming
* activation of the inhibitor. From then on the compositor should respect the
* inhibitor until it calls wlr_keyboard_shortcuts_inhibitor_v1_deactivate() to
* suspend the inhibitor with an inactive event to the client or receives the
* destroy signal from wlroots, telling it that the inhibitor has been
* destroyed.
*
* Not sending the active event to the client is the only way under the
* protocol to let the client know that the compositor will not be honouring an
* inhibitor. It's the client's job to somehow deal with not receiving the
* event, i.e. not assume that shortcuts are inhibited and maybe destroy the
* pending and request a new inhibitor after a timeout.
*/
struct wlr_keyboard_shortcuts_inhibit_manager_v1 *
wlr_keyboard_shortcuts_inhibit_v1_create(struct wl_display *display);
void wlr_keyboard_shortcuts_inhibitor_v1_activate(
struct wlr_keyboard_shortcuts_inhibitor_v1 *inhibitor);
void wlr_keyboard_shortcuts_inhibitor_v1_deactivate(
struct wlr_keyboard_shortcuts_inhibitor_v1 *inhibitor);
#endif