mirror of
https://github.com/gwenhael-le-moine/sway-patched-tray-menu.git
synced 2024-12-28 22:23:42 +01:00
eeac0aa170
Adding support for the keyboard shortcuts inhibit protocol allows remote desktop and virtualisation software to receive all keyboard input in order to pass it through to their clients so users can fully interact the their remote/virtual session. The software usually provides its own key combination to release its "grab" to all keyboard input. The inhibitor can be deactivated by the user by removing focus from the surface using another input device such as the pointer. Use support for the procotol in wlroots to add support to sway. Extend the input manager with handlers for inhibitor creation and destruction and appropriate bookkeeping. Attach the inhibitors to the seats they apply to to avoid having to search the list of all currently existing inhibitors on every keystroke and passing the inhibitor manager around. Add a helper function to retrieve the inhibitor applying to the currently focused surface of a seat, if one exists. Extend bindsym with a flag for bindings that should be processed even if an inhibitor is active. Conversely this disables all normal shortcuts if an inhibitor is found for the currently focused surface in keyboard::handle_key_event() since they don't have that flag set. Use above helper function to determine if an inhibitor exists for the surface that would eventually receive input. Signed-off-by: Michael Weiser <michael.weiser@gmx.de>
73 lines
2.2 KiB
C
73 lines
2.2 KiB
C
#ifndef _SWAY_INPUT_INPUT_MANAGER_H
|
|
#define _SWAY_INPUT_INPUT_MANAGER_H
|
|
#include <libinput.h>
|
|
#include <wlr/types/wlr_input_inhibitor.h>
|
|
#include <wlr/types/wlr_keyboard_shortcuts_inhibit_v1.h>
|
|
#include <wlr/types/wlr_virtual_keyboard_v1.h>
|
|
#include <wlr/types/wlr_virtual_pointer_v1.h>
|
|
#include "sway/server.h"
|
|
#include "sway/config.h"
|
|
#include "list.h"
|
|
|
|
struct sway_input_device {
|
|
char *identifier;
|
|
struct wlr_input_device *wlr_device;
|
|
struct wl_list link;
|
|
struct wl_listener device_destroy;
|
|
};
|
|
|
|
struct sway_input_manager {
|
|
struct wl_list devices;
|
|
struct wl_list seats;
|
|
|
|
struct wlr_input_inhibit_manager *inhibit;
|
|
struct wlr_keyboard_shortcuts_inhibit_manager_v1 *keyboard_shortcuts_inhibit;
|
|
struct wlr_virtual_keyboard_manager_v1 *virtual_keyboard;
|
|
struct wlr_virtual_pointer_manager_v1 *virtual_pointer;
|
|
|
|
struct wl_listener new_input;
|
|
struct wl_listener inhibit_activate;
|
|
struct wl_listener inhibit_deactivate;
|
|
struct wl_listener keyboard_shortcuts_inhibit_new_inhibitor;
|
|
struct wl_listener virtual_keyboard_new;
|
|
struct wl_listener virtual_pointer_new;
|
|
};
|
|
|
|
struct sway_input_manager *input_manager_create(struct sway_server *server);
|
|
|
|
bool input_manager_has_focus(struct sway_node *node);
|
|
|
|
void input_manager_set_focus(struct sway_node *node);
|
|
|
|
void input_manager_configure_xcursor(void);
|
|
|
|
void input_manager_apply_input_config(struct input_config *input_config);
|
|
|
|
void input_manager_reset_input(struct sway_input_device *input_device);
|
|
|
|
void input_manager_reset_all_inputs();
|
|
|
|
void input_manager_apply_seat_config(struct seat_config *seat_config);
|
|
|
|
struct sway_seat *input_manager_get_default_seat(void);
|
|
|
|
struct sway_seat *input_manager_get_seat(const char *seat_name, bool create);
|
|
|
|
/**
|
|
* If none of the seat configs have a fallback setting (either true or false),
|
|
* create the default seat (if needed) and set it as the fallback
|
|
*/
|
|
void input_manager_verify_fallback_seat(void);
|
|
|
|
/**
|
|
* Gets the last seat the user interacted with
|
|
*/
|
|
struct sway_seat *input_manager_current_seat(void);
|
|
|
|
struct input_config *input_device_get_config(struct sway_input_device *device);
|
|
|
|
char *input_device_get_identifier(struct wlr_input_device *device);
|
|
|
|
const char *input_device_get_type(struct sway_input_device *device);
|
|
|
|
#endif
|