Skip to content

Commit

Permalink
Pass in the key state on keyboard events
Browse files Browse the repository at this point in the history
  • Loading branch information
sdilts committed Nov 2, 2024
1 parent 6f29001 commit eea7639
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 3 deletions.
2 changes: 1 addition & 1 deletion dependencies/cl-wayland
2 changes: 2 additions & 0 deletions heart/include/hrt/hrt_input.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#ifndef HRT_HRT_INPUT_H
#define HRT_HRT_INPUT_H

#include <wayland-server-protocol.h>
#include <wayland-server.h>
#include <wlr/types/wlr_input_device.h>
#include <wlr/types/wlr_keyboard_group.h>
Expand Down Expand Up @@ -38,6 +39,7 @@ struct hrt_keypress_info {
const xkb_keysym_t *keysyms;
uint32_t modifiers;
size_t keysyms_len;
enum wl_keyboard_key_state wl_key_state;
};

struct hrt_seat_callbacks {
Expand Down
3 changes: 2 additions & 1 deletion heart/src/keyboard.c
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,8 @@ static void seat_handle_key(struct wl_listener *listener, void *data) {
struct hrt_keypress_info key_info = {
.keysyms = translated_keysyms,
.keysyms_len = translated_keysyms_len,
.modifiers = translated_modifiers
.modifiers = translated_modifiers,
.wl_key_state = event->state
};
handled = seat->callbacks->keyboard_keypress_event(seat, &key_info);
}
Expand Down
3 changes: 2 additions & 1 deletion lisp/bindings/hrt-bindings.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@
(cffi:defcstruct hrt-keypress-info
(keysyms :pointer #| xkb-keysym-t |# )
(modifiers :uint32)
(keysyms-len :size))
(keysyms-len :size)
(wl-key-state :int #| enum wl-keyboard-key-state |#))

(cffi:defcstruct hrt-seat-callbacks
(button-event :pointer #| function ptr void (struct hrt_seat *) |#)
Expand Down
2 changes: 2 additions & 0 deletions lisp/bindings/package.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,9 @@
#:hrt-server-start
#:hrt-server-stop
#:hrt-server-finish
;; keypress info slots:
#:keysyms
#:modifiers
#:keysyms-len
#:key-state
#:load-foreign-libraries))

0 comments on commit eea7639

Please sign in to comment.