mirror of
https://gitlab.freedesktop.org/wlroots/wlroots.git
synced 2025-11-02 09:01:38 -05:00
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
This commit is contained in:
parent
626c98d754
commit
f2d3b1000f
6 changed files with 364 additions and 1 deletions
|
|
@ -16,6 +16,7 @@ install_headers(
|
|||
'wlr_input_inhibitor.h',
|
||||
'wlr_input_method_v2.h',
|
||||
'wlr_keyboard.h',
|
||||
'wlr_keyboard_group.h',
|
||||
'wlr_layer_shell_v1.h',
|
||||
'wlr_linux_dmabuf_v1.h',
|
||||
'wlr_list.h',
|
||||
|
|
|
|||
|
|
@ -49,6 +49,7 @@ struct wlr_keyboard_modifiers {
|
|||
|
||||
struct wlr_keyboard {
|
||||
const struct wlr_keyboard_impl *impl;
|
||||
struct wlr_keyboard_group *group;
|
||||
|
||||
char *keymap_string;
|
||||
size_t keymap_size;
|
||||
|
|
@ -84,6 +85,7 @@ struct wlr_keyboard {
|
|||
struct wl_signal modifiers;
|
||||
struct wl_signal keymap;
|
||||
struct wl_signal repeat_info;
|
||||
struct wl_signal destroy;
|
||||
} events;
|
||||
|
||||
void *data;
|
||||
|
|
|
|||
37
include/wlr/types/wlr_keyboard_group.h
Normal file
37
include/wlr/types/wlr_keyboard_group.h
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
/*
|
||||
* 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>
|
||||
#include "wlr/types/wlr_keyboard.h"
|
||||
#include "wlr/types/wlr_input_device.h"
|
||||
|
||||
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
|
||||
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
|
||||
Loading…
Add table
Add a link
Reference in a new issue