Skip to content

Commit e07c65c

Browse files
author
half-arch
committed
HotkeyManager, EventListenedr and IO refactor
1 parent 0ace563 commit e07c65c

1,873 files changed

Lines changed: 810330 additions & 3984 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

src/core/CallbackTypes.hpp

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
#pragma once
2+
#include <linux/input.h>
23
#include <functional>
34
#include <string>
45

@@ -7,4 +8,28 @@ namespace havel {
78
// Callback types for IO and EventListener
89
using AnyKeyPressCallback = std::function<void(const std::string& key)>;
910

10-
} // namespace havel
11+
enum class InputEventKind {
12+
Key,
13+
MouseButton,
14+
MouseMove,
15+
MouseWheel,
16+
Absolute
17+
};
18+
19+
struct InputEvent {
20+
InputEventKind kind;
21+
int code = 0;
22+
int value = 0;
23+
bool down = false;
24+
bool repeat = false;
25+
int modifiers = 0;
26+
int originalCode = 0;
27+
int mappedCode = 0;
28+
int dx = 0;
29+
int dy = 0;
30+
std::string keyName;
31+
};
32+
33+
using InputEventCallback = std::function<void(const InputEvent&)>;
34+
35+
} // namespace havel

0 commit comments

Comments
 (0)