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.h13
-rw-r--r--include/wlr/types/wlr_seat.h54
3 files changed, 45 insertions, 24 deletions
diff --git a/include/wlr/interfaces/wlr_keyboard.h b/include/wlr/interfaces/wlr_keyboard.h
index 4958e2b8..78c1f753 100644
--- a/include/wlr/interfaces/wlr_keyboard.h
+++ b/include/wlr/interfaces/wlr_keyboard.h
@@ -11,5 +11,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 3f5d0d0c..af205c63 100644
--- a/include/wlr/types/wlr_keyboard.h
+++ b/include/wlr/types/wlr_keyboard.h
@@ -3,6 +3,8 @@
#include <wayland-server.h>
#include <stdint.h>
+#include <wayland-server.h>
+#include <xkbcommon/xkbcommon.h>
enum WLR_KEYBOARD_LED {
WLR_LED_NUM_LOCK = 1,
@@ -15,9 +17,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;
@@ -37,4 +47,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 0270ad4e..86fd36dd 100644
--- a/include/wlr/types/wlr_seat.h
+++ b/include/wlr/types/wlr_seat.h
@@ -3,6 +3,7 @@
#include <wlr/types/wlr_surface.h>
#include <wlr/types/wlr_input_device.h>
+#include <wlr/types/wlr_keyboard.h>
#include <wayland-server.h>
/**
@@ -13,6 +14,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;
@@ -31,6 +33,15 @@ 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_keyboard_state {
struct wlr_seat *wlr_seat;
struct wlr_seat_handle *focused_handle;
@@ -39,14 +50,15 @@ struct wlr_seat_keyboard_state {
int keymap_fd;
size_t keymap_size;
- struct wl_listener focus_surface_destroy_listener;
- struct wl_listener focus_resource_destroy_listener;
+ struct wl_listener surface_destroy;
+ struct wl_listener resource_destroy;
};
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;
@@ -57,7 +69,6 @@ struct wlr_seat {
struct {
struct wl_signal client_bound;
struct wl_signal client_unbound;
- struct wl_signal keyboard_bound;
} events;
void *data;
@@ -127,37 +138,32 @@ void wlr_seat_pointer_send_axis(struct wlr_seat *wlr_seat, uint32_t time,
enum wlr_axis_orientation orientation, double value);
/**
- * Send a keyboard enter event to the given surface and consider it to be the
- * focused surface for the keyboard. This will send a leave event to the last
- * surface that was entered. Pass an array of currently pressed keys.
+ * Attaches this keyboard to the seat. Key events from this keyboard will be
+ * propegated to the focused client.
*/
-void wlr_seat_keyboard_enter(struct wlr_seat *wlr_seat,
- struct wlr_surface *surface, struct wl_array keys);
+void wlr_seat_attach_keyboard(struct wlr_seat *seat,
+ struct wlr_input_device *dev);
/**
- * Clear the focused surface for the keyboard and leave all entered surfaces.
+ * 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_keyboard_clear_focus(struct wlr_seat *wlr_seat);
+void wlr_seat_detach_keyboard(struct wlr_seat *seat, struct wlr_keyboard *kb);
/**
- * Send a key event to the surface with keyboard focus. Returns the event
- * serial.
+ * Send a keyboard enter event to the given surface and consider it to be the
+ * focused surface for the keyboard. This will send a leave event to the last
+ * surface that was entered. Pass an array of currently pressed keys.
*/
-uint32_t wlr_seat_keyboard_send_key(struct wlr_seat *wlr_seat, uint32_t time,
- uint32_t key, uint32_t state);
+void wlr_seat_keyboard_enter(struct wlr_seat *wlr_seat,
+ struct wlr_surface *surface);
/**
- * Send the modifiers event to the surface with keyboard focus. Also sends the
- * event to the surface with pointer focus.
+ * Clear the focused surface for the keyboard and leave all entered surfaces.
*/
-void wlr_seat_keyboard_send_modifiers(struct wlr_seat *wlr_seat,
- uint32_t mods_depressed, uint32_t mods_latched, uint32_t mods_locked,
- uint32_t group);
+void wlr_seat_keyboard_clear_focus(struct wlr_seat *wlr_seat);
-/**
- * Set the keymap and send it to seat keyboard resources.
- */
-void wlr_seat_keyboard_set_keymap(struct wlr_seat *wlr_seat, int keymap_fd,
- size_t keymap_size);
+// TODO: May be useful to be able to simulate keyboard input events
#endif