aboutsummaryrefslogtreecommitdiff
path: root/include/wlr
diff options
context:
space:
mode:
Diffstat (limited to 'include/wlr')
-rw-r--r--include/wlr/interfaces/wlr_keyboard.h2
-rw-r--r--include/wlr/types/wlr_keyboard.h14
-rw-r--r--include/wlr/types/wlr_seat.h27
3 files changed, 41 insertions, 2 deletions
diff --git a/include/wlr/interfaces/wlr_keyboard.h b/include/wlr/interfaces/wlr_keyboard.h
index 779b302f..ffa99b3b 100644
--- a/include/wlr/interfaces/wlr_keyboard.h
+++ b/include/wlr/interfaces/wlr_keyboard.h
@@ -10,5 +10,7 @@ struct wlr_keyboard_impl {
void wlr_keyboard_init(struct wlr_keyboard *keyboard, struct wlr_keyboard_impl *impl);
void wlr_keyboard_destroy(struct wlr_keyboard *keyboard);
+void wlr_keyboard_update_state(struct wlr_keyboard *keyboard,
+ struct wlr_event_keyboard_key *event);
#endif
diff --git a/include/wlr/types/wlr_keyboard.h b/include/wlr/types/wlr_keyboard.h
index ce7d6659..89e44f96 100644
--- a/include/wlr/types/wlr_keyboard.h
+++ b/include/wlr/types/wlr_keyboard.h
@@ -1,7 +1,8 @@
#ifndef _WLR_TYPES_KEYBOARD_H
#define _WLR_TYPES_KEYBOARD_H
-#include <wayland-server.h>
#include <stdint.h>
+#include <wayland-server.h>
+#include <xkbcommon/xkbcommon.h>
enum WLR_KEYBOARD_LED {
WLR_LED_NUM_LOCK = 1,
@@ -14,9 +15,17 @@ struct wlr_keyboard_impl;
struct wlr_keyboard {
struct wlr_keyboard_impl *impl;
+ // TODO: Should this store key repeat info too?
+
+ int keymap_fd;
+ size_t keymap_size;
+ struct xkb_keymap *keymap;
+ struct xkb_state *xkb_state;
+ xkb_led_index_t leds[WLR_LED_LAST];
struct {
struct wl_signal key;
+ struct wl_signal keymap;
} events;
void *data;
@@ -36,4 +45,7 @@ struct wlr_event_keyboard_key {
enum wlr_key_state state;
};
+void wlr_keyboard_set_keymap(struct wlr_keyboard *kb,
+ struct xkb_keymap *keymap);
+
#endif
diff --git a/include/wlr/types/wlr_seat.h b/include/wlr/types/wlr_seat.h
index aa17d650..dfb1d398 100644
--- a/include/wlr/types/wlr_seat.h
+++ b/include/wlr/types/wlr_seat.h
@@ -2,6 +2,7 @@
#define _WLR_TYPES_SEAT_H
#include <wlr/types/wlr_surface.h>
#include <wlr/types/wlr_input_device.h>
+#include <wlr/types/wlr_keyboard.h>
#include <wayland-server.h>
/**
@@ -12,6 +13,7 @@
struct wlr_seat_handle {
struct wl_resource *wl_resource;
struct wlr_seat *wlr_seat;
+ struct wlr_seat_keyboard *seat_keyboard;
struct wl_resource *pointer;
struct wl_resource *keyboard;
@@ -30,10 +32,20 @@ struct wlr_seat_pointer_state {
struct wl_listener focus_resource_destroy_listener;
};
+struct wlr_seat_keyboard {
+ struct wlr_seat *seat;
+ struct wlr_keyboard *keyboard;
+ struct wl_listener key;
+ struct wl_listener keymap;
+ struct wl_listener destroy;
+ struct wl_list link;
+};
+
struct wlr_seat {
struct wl_global *wl_global;
struct wl_display *display;
struct wl_list handles;
+ struct wl_list keyboards;
char *name;
uint32_t capabilities;
struct wlr_data_device *data_device;
@@ -43,7 +55,6 @@ struct wlr_seat {
struct {
struct wl_signal client_bound;
struct wl_signal client_unbound;
- struct wl_signal keyboard_bound;
} events;
void *data;
@@ -112,4 +123,18 @@ uint32_t wlr_seat_pointer_send_button(struct wlr_seat *wlr_seat, uint32_t time,
void wlr_seat_pointer_send_axis(struct wlr_seat *wlr_seat, uint32_t time,
enum wlr_axis_orientation orientation, double value);
+/**
+ * Attaches this keyboard to the seat. Key events from this keyboard will be
+ * propegated to the focused client.
+ */
+void wlr_seat_attach_keyboard(struct wlr_seat *seat,
+ struct wlr_input_device *dev);
+
+/**
+ * Detaches this keyboard from the seat. This is done automatically when the
+ * keyboard is destroyed; you only need to use this if you want to remove it for
+ * some other reason.
+ */
+void wlr_seat_detach_keyboard(struct wlr_seat *seat, struct wlr_keyboard *kb);
+
#endif