Introduce wlr_keyboard_group
A wlr_keyboard_group allows for multiple keyboard devices to be
combined into one logical keyboard. Each keyboard device can only be
added to one keyboard group. This helps with the situation where one
physical keyboard is exposed as multiple keyboard devices. It is up to
the compositors on how they group keyboards together, if at all.
Since a wlr_keyboard_group is one logical keyboard, the keys are a set.
This means that if a key is pressed on multiple keyboard devices, the
key event will only be emitted once, but the internal state will count
the number of devices that the key is pressed on. Likewise, the key
release will not be emitted until the key is released from all devices.
If the compositor wants access to which keys are pressed and released
on each keyboard device, the events for those devices can be listened
to, as they currently are, in addition to the group keyboard's events.
Also, all keyboard devices in the group must share the same keymap. If
the keymap's differ, the keyboard device will not be able to be added
to the group. Once in the group, if the keymap or effective layout for
one keyboard device changes, it will be synced to all keyboard devices
in the group. The repeat info and keyboard modifiers are also synced
2019-11-03 19:18:41 +00: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_GROUP_H
|
|
|
|
#define WLR_TYPES_WLR_KEYBOARD_GROUP_H
|
|
|
|
|
|
|
|
#include <wayland-server-core.h>
|
2021-04-06 07:18:16 +00:00
|
|
|
#include <wlr/types/wlr_keyboard.h>
|
|
|
|
#include <wlr/types/wlr_input_device.h>
|
Introduce wlr_keyboard_group
A wlr_keyboard_group allows for multiple keyboard devices to be
combined into one logical keyboard. Each keyboard device can only be
added to one keyboard group. This helps with the situation where one
physical keyboard is exposed as multiple keyboard devices. It is up to
the compositors on how they group keyboards together, if at all.
Since a wlr_keyboard_group is one logical keyboard, the keys are a set.
This means that if a key is pressed on multiple keyboard devices, the
key event will only be emitted once, but the internal state will count
the number of devices that the key is pressed on. Likewise, the key
release will not be emitted until the key is released from all devices.
If the compositor wants access to which keys are pressed and released
on each keyboard device, the events for those devices can be listened
to, as they currently are, in addition to the group keyboard's events.
Also, all keyboard devices in the group must share the same keymap. If
the keymap's differ, the keyboard device will not be able to be added
to the group. Once in the group, if the keymap or effective layout for
one keyboard device changes, it will be synced to all keyboard devices
in the group. The repeat info and keyboard modifiers are also synced
2019-11-03 19:18:41 +00:00
|
|
|
|
|
|
|
struct wlr_keyboard_group {
|
|
|
|
struct wlr_keyboard keyboard;
|
|
|
|
struct wlr_input_device *input_device;
|
|
|
|
struct wl_list devices; // keyboard_group_device::link
|
|
|
|
struct wl_list keys; // keyboard_group_key::link
|
2020-05-31 21:10:15 +00:00
|
|
|
|
|
|
|
struct {
|
|
|
|
/*
|
|
|
|
* Sent when a keyboard has entered the group with keys currently
|
|
|
|
* pressed that are not pressed by any other keyboard in the group. The
|
|
|
|
* data for this signal will be a wl_array containing the key codes.
|
|
|
|
* This should be used to update the compositor's internal state.
|
|
|
|
* Bindings should not be triggered based off of these key codes and
|
|
|
|
* they should also not notify any surfaces of the key press.
|
|
|
|
*/
|
|
|
|
struct wl_signal enter;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Sent when a keyboard has left the group with keys currently pressed
|
|
|
|
* that are not pressed by any other keyboard in the group. The data for
|
|
|
|
* this signal will be a wl_array containing the key codes. This should
|
|
|
|
* be used to update the compositor's internal state. Bindings should
|
|
|
|
* not be triggered based off of these key codes. Additionally, surfaces
|
|
|
|
* should only be notified if they received a corresponding key press
|
|
|
|
* for the key code.
|
|
|
|
*/
|
|
|
|
struct wl_signal leave;
|
|
|
|
} events;
|
|
|
|
|
Introduce wlr_keyboard_group
A wlr_keyboard_group allows for multiple keyboard devices to be
combined into one logical keyboard. Each keyboard device can only be
added to one keyboard group. This helps with the situation where one
physical keyboard is exposed as multiple keyboard devices. It is up to
the compositors on how they group keyboards together, if at all.
Since a wlr_keyboard_group is one logical keyboard, the keys are a set.
This means that if a key is pressed on multiple keyboard devices, the
key event will only be emitted once, but the internal state will count
the number of devices that the key is pressed on. Likewise, the key
release will not be emitted until the key is released from all devices.
If the compositor wants access to which keys are pressed and released
on each keyboard device, the events for those devices can be listened
to, as they currently are, in addition to the group keyboard's events.
Also, all keyboard devices in the group must share the same keymap. If
the keymap's differ, the keyboard device will not be able to be added
to the group. Once in the group, if the keymap or effective layout for
one keyboard device changes, it will be synced to all keyboard devices
in the group. The repeat info and keyboard modifiers are also synced
2019-11-03 19:18:41 +00:00
|
|
|
void *data;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct wlr_keyboard_group *wlr_keyboard_group_create(void);
|
|
|
|
|
|
|
|
struct wlr_keyboard_group *wlr_keyboard_group_from_wlr_keyboard(
|
|
|
|
struct wlr_keyboard *keyboard);
|
|
|
|
|
|
|
|
bool wlr_keyboard_group_add_keyboard(struct wlr_keyboard_group *group,
|
|
|
|
struct wlr_keyboard *keyboard);
|
|
|
|
|
|
|
|
void wlr_keyboard_group_remove_keyboard(struct wlr_keyboard_group *group,
|
|
|
|
struct wlr_keyboard *keyboard);
|
|
|
|
|
|
|
|
void wlr_keyboard_group_destroy(struct wlr_keyboard_group *group);
|
|
|
|
|
|
|
|
#endif
|