-
Notifications
You must be signed in to change notification settings - Fork 3
/
wlr_keyboard.h
56 lines (42 loc) · 1.35 KB
/
wlr_keyboard.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#ifndef GDWLR_WLR_KEYBOARD_H
#define GDWLR_WLR_KEYBOARD_H
#include <stdint.h>
#include "core/os/input_event.h"
#include "scene/main/node.h"
#include "wayland_display.h"
extern "C" {
#include <wayland-server.h>
#include <wlr/types/wlr_input_device.h>
#include <wlr/types/wlr_keyboard.h>
}
// TODO: gdscript users may want to create synthetic key events with this
class WlrEventKeyboardKey : public Resource {
GDCLASS(WlrEventKeyboardKey, Resource);
struct wlr_event_keyboard_key *event;
protected:
WlrEventKeyboardKey(); // Required by Object
public:
WlrEventKeyboardKey(struct wlr_event_keyboard_key *event);
struct wlr_event_keyboard_key *get_wlr_event();
};
class WlrKeyboard : public Node {
GDCLASS(WlrKeyboard, Node);
bool keyboard_init;
struct wlr_input_device wlr_input_device;
struct wlr_keyboard wlr_keyboard;
struct wl_listener key;
struct wl_listener modifiers;
static void handle_key(struct wl_listener *listener, void *data);
static void handle_modifiers(struct wl_listener *listener, void *data);
void ensure_keyboard();
protected:
static void _bind_methods();
virtual void _notification(int p_what);
virtual void _input(const Ref<InputEvent> &p_event);
public:
WlrKeyboard();
~WlrKeyboard();
struct wlr_input_device *get_wlr_input_device();
void send_wlr_event_keyboard_key(int scancode_without_modifiers, bool is_pressed);
};
#endif