diff options
Diffstat (limited to 'kernel/include/hilbert')
-rw-r--r-- | kernel/include/hilbert/kernel/input.hpp | 21 | ||||
-rw-r--r-- | kernel/include/hilbert/kernel/utility.hpp | 5 |
2 files changed, 25 insertions, 1 deletions
diff --git a/kernel/include/hilbert/kernel/input.hpp b/kernel/include/hilbert/kernel/input.hpp index 2209ddc..d1b7ca2 100644 --- a/kernel/include/hilbert/kernel/input.hpp +++ b/kernel/include/hilbert/kernel/input.hpp @@ -18,7 +18,26 @@ namespace hilbert::kernel::input { BREAK = 1 << 18, }; - extern utility::queue<uint32_t> *key_queue; + enum buttons_t : uint8_t { + LEFT_BUTTON = 1, + RIGHT_BUTTON = 2, + MIDDLE_BUTTON = 4 + }; + + struct input_packet { + union { + struct { + int16_t x_change; + int16_t y_change; + buttons_t buttons; + } mouse; + uint32_t keyboard; + }; + bool is_mouse; + }; + + extern utility::queue<input_packet> *input_queue; + //notify a process waiting for input void got_input(); diff --git a/kernel/include/hilbert/kernel/utility.hpp b/kernel/include/hilbert/kernel/utility.hpp index 47f78ea..c0b8c19 100644 --- a/kernel/include/hilbert/kernel/utility.hpp +++ b/kernel/include/hilbert/kernel/utility.hpp @@ -342,6 +342,11 @@ namespace hilbert::kernel::utility { return move(ret); } + //assumes not empty + value_t &last_inserted() const { + return buffer[(count - 1 + next_read_index) % buffer_len]; + } + }; } |