Kernel: Move KeyEvent/MouseEvent from kernel to LibInput

This commit is contained in:
Bananymous 2024-05-28 18:00:39 +03:00
parent 87d52e5ebe
commit 8bc6c2eb20
19 changed files with 196 additions and 113 deletions

View File

@ -21,6 +21,7 @@ add_subdirectory(bootloader)
add_subdirectory(BAN)
add_subdirectory(libc)
add_subdirectory(LibELF)
add_subdirectory(LibInput)
add_subdirectory(userspace)
add_custom_target(sysroot
@ -33,6 +34,7 @@ add_custom_target(headers
DEPENDS ban-headers
DEPENDS libc-headers
DEPENDS libelf-headers
DEPENDS libinput-headers
)
add_custom_target(install-sysroot
@ -41,6 +43,7 @@ add_custom_target(install-sysroot
DEPENDS libc-install
DEPENDS userspace-install
DEPENDS libelf-install
DEPENDS libinput-install
)
add_custom_target(package-sysroot

24
LibInput/CMakeLists.txt Normal file
View File

@ -0,0 +1,24 @@
cmake_minimum_required(VERSION 3.26)
project(libinput CXX)
set(LIBINPUT_SOURCES
KeyEvent.cpp
KeyboardLayout.cpp
)
add_custom_target(libinput-headers
COMMAND ${CMAKE_COMMAND} -E copy_directory_if_different ${CMAKE_CURRENT_SOURCE_DIR}/include/ ${BANAN_INCLUDE}/
DEPENDS sysroot
)
add_library(libinput ${LIBINPUT_SOURCES})
target_link_libraries(libinput PUBLIC libc ban)
add_custom_target(libinput-install
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_CURRENT_BINARY_DIR}/libinput.a ${BANAN_LIB}/
DEPENDS libinput
BYPRODUCTS ${BANAN_LIB}/libinput.a
)
set(CMAKE_STATIC_LIBRARY_PREFIX "")

View File

@ -1,15 +1,9 @@
#include <BAN/Array.h>
#include <kernel/Input/KeyboardLayout.h>
#include <kernel/Input/KeyEvent.h>
#include <LibInput/KeyEvent.h>
namespace Kernel::Input
namespace LibInput
{
Key key_event_to_key(KeyEvent event)
{
return KeyboardLayout::get().get_key_from_event(event);
}
const char* key_to_utf8(Key key, uint16_t modifier)
{
static constexpr const char* utf8_lower[] = {
@ -50,7 +44,7 @@ namespace Kernel::Input
};
static_assert((size_t)Key::Count == sizeof(utf8_upper) / sizeof(*utf8_lower));
KeyEvent event { .modifier = modifier, .keycode = 0x00 };
KeyEvent event { .modifier = modifier, .key = key };
return (event.shift() ^ event.caps_lock()) ? utf8_upper[static_cast<uint8_t>(key)] : utf8_lower[static_cast<uint8_t>(key)];
}

View File

@ -1,10 +1,20 @@
#include <BAN/Debug.h>
#include <BAN/HashMap.h>
#include <BAN/String.h>
#include <BAN/StringView.h>
#include <LibInput/KeyboardLayout.h>
#if __is_kernel
#include <kernel/FS/VirtualFileSystem.h>
#include <kernel/Input/KeyboardLayout.h>
#else
#include <fcntl.h>
#include <limits.h>
#include <sys/stat.h>
#endif
#include <ctype.h>
namespace Kernel::Input
namespace LibInput
{
struct StringViewLower
@ -71,14 +81,17 @@ namespace Kernel::Input
key = Key::None;
}
Key KeyboardLayout::get_key_from_event(KeyEvent event)
KeyEvent KeyboardLayout::key_event_from_raw(RawKeyEvent event)
{
SpinLockGuard _(m_lock);
if (event.shift())
return m_keycode_to_key_shift[event.keycode];
if (event.ralt())
return m_keycode_to_key_altgr[event.keycode];
return m_keycode_to_key_normal[event.keycode];
KeyEvent result;
result.modifier = event.modifier;
if (result.shift())
result.key = m_keycode_to_key_shift[event.keycode];
else if (result.ralt())
result.key = m_keycode_to_key_altgr[event.keycode];
else
result.key = m_keycode_to_key_normal[event.keycode];
return result;
}
static BAN::Optional<uint8_t> parse_keycode(BAN::StringView str)
@ -109,11 +122,36 @@ namespace Kernel::Input
static BAN::ErrorOr<BAN::Vector<BAN::String>> load_keymap_lines_and_parse_includes(BAN::StringView path)
{
auto file = TRY(VirtualFileSystem::get().file_from_absolute_path({ 0, 0, 0, 0 }, path, 0));
BAN::String file_data;
BAN::String canonical_path;
#if __is_kernel
{
auto file = TRY(Kernel::VirtualFileSystem::get().file_from_absolute_path({ 0, 0, 0, 0 }, path, 0));
TRY(file_data.resize(file.inode->size()));
TRY(file.inode->read(0, BAN::ByteSpan { reinterpret_cast<uint8_t*>(file_data.data()), file_data.size() }));
canonical_path = file.canonical_path;
}
#else
{
char null_path[PATH_MAX];
strncpy(null_path, path.data(), path.size());
null_path[path.size()] = '\0';
struct stat st;
if (stat(null_path, &st) == -1)
return BAN::Error::from_errno(errno);
TRY(file_data.resize(st.st_size));
int fd = open(null_path, O_RDONLY);
if (fd == -1)
return BAN::Error::from_errno(errno);
ssize_t nread = read(fd, file_data.data(), st.st_size);
close(fd);
if (nread != st.st_size)
return BAN::Error::from_errno(errno);
MUST(canonical_path.append(path));
}
#endif
BAN::Vector<BAN::String> result;
@ -142,7 +180,7 @@ namespace Kernel::Input
parts[1] = parts[1].substring(1, parts[1].size() - 2);
BAN::String include_path;
TRY(include_path.append(file.canonical_path));
TRY(include_path.append(canonical_path));
ASSERT(include_path.sv().contains('/'));
while (include_path.back() != '/')
include_path.pop_back();
@ -256,8 +294,6 @@ namespace Kernel::Input
}
}
SpinLockGuard _(m_lock);
for (size_t i = 0; i < new_layout->m_keycode_to_key_normal.size(); i++)
if (new_layout->m_keycode_to_key_normal[i] != Key::None)
m_keycode_to_key_normal[i] = new_layout->m_keycode_to_key_normal[i];

View File

@ -2,7 +2,7 @@
#include <stdint.h>
namespace Kernel::Input
namespace LibInput
{
/*
@ -53,6 +53,14 @@ namespace Kernel::Input
Count,
};
// KeyEvent with general keycode
struct RawKeyEvent
{
uint16_t modifier;
uint8_t keycode;
};
// KeyEvent with key parsed from keycode
struct KeyEvent
{
enum Modifier : uint16_t
@ -89,10 +97,9 @@ namespace Kernel::Input
bool released() const { return !pressed(); }
uint16_t modifier;
uint8_t keycode;
Key key;
};
Key key_event_to_key(KeyEvent);
const char* key_to_utf8(Key key, uint16_t modifier);
}

View File

@ -1,11 +1,11 @@
#pragma once
#include <BAN/Array.h>
#include <BAN/StringView.h>
#include <BAN/UniqPtr.h>
#include <kernel/Input/KeyEvent.h>
#include <kernel/Lock/SpinLock.h>
#include <LibInput/KeyEvent.h>
namespace Kernel::Input
namespace LibInput
{
class KeyboardLayout
@ -14,7 +14,7 @@ namespace Kernel::Input
static BAN::ErrorOr<void> initialize();
static KeyboardLayout& get();
Key get_key_from_event(KeyEvent);
KeyEvent key_event_from_raw(RawKeyEvent);
BAN::ErrorOr<void> load_from_file(BAN::StringView path);
private:
@ -24,8 +24,6 @@ namespace Kernel::Input
BAN::Array<Key, 0xFF> m_keycode_to_key_normal;
BAN::Array<Key, 0xFF> m_keycode_to_key_shift;
BAN::Array<Key, 0xFF> m_keycode_to_key_altgr;
SpinLock m_lock;
friend class BAN::UniqPtr<KeyboardLayout>;
};

View File

@ -2,7 +2,7 @@
#include <stdint.h>
namespace Kernel::Input
namespace LibInput
{
enum class MouseButton

View File

@ -42,8 +42,6 @@ set(KERNEL_SOURCES
kernel/FS/VirtualFileSystem.cpp
kernel/GDT.cpp
kernel/IDT.cpp
kernel/Input/KeyboardLayout.cpp
kernel/Input/KeyEvent.cpp
kernel/Input/PS2/Controller.cpp
kernel/Input/PS2/Device.cpp
kernel/Input/PS2/Keyboard.cpp
@ -150,12 +148,18 @@ set(LIBELF_SOURCES
../LibELF/LibELF/LoadableELF.cpp
)
set(LIBINPUT_SOURCE
../LibInput/KeyboardLayout.cpp
../LibInput/KeyEvent.cpp
)
set(KERNEL_SOURCES
${KERNEL_SOURCES}
${LAI_SOURCES}
${BAN_SOURCES}
${KLIBC_SOURCES}
${LIBELF_SOURCES}
${LIBINPUT_SOURCE}
)
add_executable(kernel ${KERNEL_SOURCES})

View File

@ -2,10 +2,10 @@
#include <BAN/Array.h>
#include <BAN/CircularQueue.h>
#include <kernel/Input/KeyEvent.h>
#include <kernel/Input/PS2/Device.h>
#include <kernel/Input/PS2/Keymap.h>
#include <kernel/Semaphore.h>
#include <LibInput/KeyEvent.h>
namespace Kernel::Input
{
@ -40,7 +40,7 @@ namespace Kernel::Input
uint16_t m_modifiers { 0 };
BAN::CircularQueue<KeyEvent, 50> m_event_queue;
BAN::CircularQueue<LibInput::RawKeyEvent, 50> m_event_queue;
SpinLock m_event_lock;
PS2Keymap m_keymap;

View File

@ -1,8 +1,8 @@
#pragma once
#include <kernel/Input/MouseEvent.h>
#include <kernel/Input/PS2/Device.h>
#include <kernel/Semaphore.h>
#include <LibInput/MouseEvent.h>
namespace Kernel::Input
{
@ -36,7 +36,7 @@ namespace Kernel::Input
uint8_t m_mouse_id { 0x00 };
uint8_t m_button_mask { 0x00 };
BAN::CircularQueue<MouseEvent, 128> m_event_queue;
BAN::CircularQueue<LibInput::MouseEvent, 128> m_event_queue;
SpinLock m_event_lock;
Semaphore m_semaphore;

View File

@ -2,11 +2,11 @@
#include <BAN/Array.h>
#include <kernel/Device/Device.h>
#include <kernel/Input/KeyEvent.h>
#include <kernel/Lock/SpinLock.h>
#include <kernel/Terminal/TerminalDriver.h>
#include <kernel/Terminal/termios.h>
#include <kernel/Semaphore.h>
#include <LibInput/KeyEvent.h>
namespace Kernel
{
@ -30,7 +30,7 @@ namespace Kernel
void set_as_current();
static void initialize_devices();
void on_key_event(Input::KeyEvent);
void on_key_event(LibInput::KeyEvent);
void handle_input_byte(uint8_t);
virtual bool is_tty() const override { return true; }

View File

@ -2,7 +2,6 @@
#include <BAN/Array.h>
#include <kernel/Device/Device.h>
#include <kernel/Input/KeyEvent.h>
#include <kernel/Terminal/TerminalDriver.h>
#include <kernel/Terminal/termios.h>
#include <kernel/Terminal/TTY.h>

View File

@ -1,9 +1,9 @@
#include <BAN/ScopeGuard.h>
#include <kernel/FS/DevFS/FileSystem.h>
#include <kernel/Input/KeyboardLayout.h>
#include <kernel/Input/PS2/Config.h>
#include <kernel/Input/PS2/Keyboard.h>
#include <kernel/Thread.h>
#include <LibInput/KeyboardLayout.h>
namespace Kernel::Input
{
@ -44,6 +44,10 @@ namespace Kernel::Input
void PS2Keyboard::handle_byte(uint8_t byte)
{
using LibInput::Key;
using LibInput::RawKeyEvent;
using KeyModifier = LibInput::KeyEvent::Modifier;
if (byte == PS2::KBResponse::KEY_ERROR_OR_BUFFER_OVERRUN1 || byte == PS2::KBResponse::KEY_ERROR_OR_BUFFER_OVERRUN2)
{
dwarnln("Key detection error or internal buffer overrun");
@ -123,25 +127,24 @@ namespace Kernel::Input
if (!keycode.has_value())
return;
auto key = KeyboardLayout::get().get_key_from_event(KeyEvent { .modifier = 0, .keycode = keycode.value() });
if (key == Key::F1)
auto dummy_event = LibInput::KeyboardLayout::get().key_event_from_raw(RawKeyEvent { .modifier = 0, .keycode = keycode.value() });
if (dummy_event.key == Key::F1)
panic("OOF");
uint16_t modifier_mask = 0;
uint16_t toggle_mask = 0;
switch (key)
switch (dummy_event.key)
{
case Key::LeftShift: modifier_mask = KeyEvent::Modifier::LShift; break;
case Key::RightShift: modifier_mask = KeyEvent::Modifier::RShift; break;
case Key::LeftCtrl: modifier_mask = KeyEvent::Modifier::LCtrl; break;
case Key::RightCtrl: modifier_mask = KeyEvent::Modifier::RCtrl; break;
case Key::LeftAlt: modifier_mask = KeyEvent::Modifier::LAlt; break;
case Key::RightAlt: modifier_mask = KeyEvent::Modifier::RAlt; break;
case Key::LeftShift: modifier_mask = KeyModifier::LShift; break;
case Key::RightShift: modifier_mask = KeyModifier::RShift; break;
case Key::LeftCtrl: modifier_mask = KeyModifier::LCtrl; break;
case Key::RightCtrl: modifier_mask = KeyModifier::RCtrl; break;
case Key::LeftAlt: modifier_mask = KeyModifier::LAlt; break;
case Key::RightAlt: modifier_mask = KeyModifier::RAlt; break;
case Key::ScrollLock: toggle_mask = KeyEvent::Modifier::ScrollLock; break;
case Key::NumLock: toggle_mask = KeyEvent::Modifier::NumLock; break;
case Key::CapsLock: toggle_mask = KeyEvent::Modifier::CapsLock; break;
case Key::ScrollLock: toggle_mask = KeyModifier::ScrollLock; break;
case Key::NumLock: toggle_mask = KeyModifier::NumLock; break;
case Key::CapsLock: toggle_mask = KeyModifier::CapsLock; break;
default: break;
}
@ -160,8 +163,8 @@ namespace Kernel::Input
update_leds();
}
KeyEvent event;
event.modifier = m_modifiers | (released ? 0 : KeyEvent::Modifier::Pressed);
RawKeyEvent event;
event.modifier = m_modifiers | (released ? 0 : KeyModifier::Pressed);
event.keycode = keycode.value();
SpinLockGuard _(m_event_lock);
@ -178,19 +181,23 @@ namespace Kernel::Input
void PS2Keyboard::update_leds()
{
using KeyModifier = LibInput::KeyEvent::Modifier;
uint8_t new_leds = 0;
if (m_modifiers & +KeyEvent::Modifier::ScrollLock)
if (m_modifiers & +KeyModifier::ScrollLock)
new_leds |= PS2::KBLeds::SCROLL_LOCK;
if (m_modifiers & +KeyEvent::Modifier::NumLock)
if (m_modifiers & +KeyModifier::NumLock)
new_leds |= PS2::KBLeds::NUM_LOCK;
if (m_modifiers & +KeyEvent::Modifier::CapsLock)
if (m_modifiers & +KeyModifier::CapsLock)
new_leds |= PS2::KBLeds::CAPS_LOCK;
append_command_queue(Command::SET_LEDS, new_leds, 0);
}
BAN::ErrorOr<size_t> PS2Keyboard::read_impl(off_t, BAN::ByteSpan buffer)
{
if (buffer.size() < sizeof(KeyEvent))
using LibInput::RawKeyEvent;
if (buffer.size() < sizeof(RawKeyEvent))
return BAN::Error::from_errno(ENOBUFS);
auto state = m_event_lock.lock();
@ -201,12 +208,12 @@ namespace Kernel::Input
state = m_event_lock.lock();
}
buffer.as<KeyEvent>() = m_event_queue.front();
buffer.as<RawKeyEvent>() = m_event_queue.front();
m_event_queue.pop();
m_event_lock.unlock(state);
return sizeof(KeyEvent);
return sizeof(RawKeyEvent);
}
}

View File

@ -1,11 +1,14 @@
#include <kernel/Debug.h>
#include <kernel/Input/KeyEvent.h>
#include <kernel/Input/PS2/Keymap.h>
#include <LibInput/KeyEvent.h>
#include <string.h>
namespace Kernel::Input
{
using LibInput::keycode_function;
using LibInput::keycode_normal;
using LibInput::keycode_numpad;
void PS2Keymap::initialize(uint8_t scancode_set)
{

View File

@ -71,6 +71,10 @@ namespace Kernel::Input
void PS2Mouse::handle_byte(uint8_t byte)
{
using LibInput::MouseButton;
using LibInput::MouseEvent;
using LibInput::MouseEventType;
if (!m_enabled)
return initialize_extensions(byte);
@ -174,6 +178,8 @@ namespace Kernel::Input
BAN::ErrorOr<size_t> PS2Mouse::read_impl(off_t, BAN::ByteSpan buffer)
{
using LibInput::MouseEvent;
if (buffer.size() < sizeof(MouseEvent))
return BAN::Error::from_errno(ENOBUFS);

View File

@ -5,7 +5,6 @@
#include <kernel/FS/ProcFS/FileSystem.h>
#include <kernel/FS/VirtualFileSystem.h>
#include <kernel/IDT.h>
#include <kernel/Input/KeyboardLayout.h>
#include <kernel/InterruptController.h>
#include <kernel/Lock/LockGuard.h>
#include <kernel/Memory/FileBackedRegion.h>
@ -17,6 +16,7 @@
#include <kernel/Timer/Timer.h>
#include <LibELF/LoadableELF.h>
#include <LibInput/KeyboardLayout.h>
#include <fcntl.h>
#include <stdio.h>
@ -1460,7 +1460,7 @@ namespace Kernel
return BAN::Error::from_errno(EPERM);
auto absolute_path = TRY(absolute_path_of(path));
TRY(Input::KeyboardLayout::get().load_from_file(absolute_path));
TRY(LibInput::KeyboardLayout::get().load_from_file(absolute_path));
return 0;
}

View File

@ -7,6 +7,7 @@
#include <kernel/Lock/LockGuard.h>
#include <kernel/Process.h>
#include <kernel/Terminal/TTY.h>
#include <LibInput/KeyboardLayout.h>
#include <fcntl.h>
#include <string.h>
@ -94,10 +95,11 @@ namespace Kernel
while (!TTY::current()->m_tty_ctrl.receive_input)
TTY::current()->m_tty_ctrl.semaphore.block_indefinite();
Input::KeyEvent event;
LibInput::RawKeyEvent event;
size_t read = MUST(inode->read(0, BAN::ByteSpan::from(event)));
ASSERT(read == sizeof(event));
TTY::current()->on_key_event(event);
TTY::current()->on_key_event(LibInput::KeyboardLayout::get().key_event_from_raw(event));
}
}, nullptr
);
@ -120,71 +122,70 @@ namespace Kernel
return {};
}
void TTY::on_key_event(Input::KeyEvent event)
void TTY::on_key_event(LibInput::KeyEvent event)
{
LockGuard _(m_mutex);
if (event.released())
return;
Input::Key key = Input::key_event_to_key(event);
const char* ansi_c_str = Input::key_to_utf8(key, event.modifier);
const char* ansi_c_str = LibInput::key_to_utf8(event.key, event.modifier);
if (event.ctrl())
{
ansi_c_str = nullptr;
switch (key)
switch (event.key)
{
case Input::Key::A: ansi_c_str = "\x01"; break;
case Input::Key::B: ansi_c_str = "\x02"; break;
case Input::Key::C: ansi_c_str = "\x03"; break;
case Input::Key::D: ansi_c_str = "\x04"; break;
case Input::Key::E: ansi_c_str = "\x05"; break;
case Input::Key::F: ansi_c_str = "\x06"; break;
case Input::Key::G: ansi_c_str = "\x07"; break;
case Input::Key::H: ansi_c_str = "\x08"; break;
case Input::Key::I: ansi_c_str = "\x09"; break;
case Input::Key::J: ansi_c_str = "\x0A"; break;
case Input::Key::K: ansi_c_str = "\x0B"; break;
case Input::Key::L: ansi_c_str = "\x0C"; break;
case Input::Key::M: ansi_c_str = "\x0D"; break;
case Input::Key::N: ansi_c_str = "\x0E"; break;
case Input::Key::O: ansi_c_str = "\x0F"; break;
case Input::Key::P: ansi_c_str = "\x10"; break;
case Input::Key::Q: ansi_c_str = "\x11"; break;
case Input::Key::R: ansi_c_str = "\x12"; break;
case Input::Key::S: ansi_c_str = "\x13"; break;
case Input::Key::T: ansi_c_str = "\x14"; break;
case Input::Key::U: ansi_c_str = "\x15"; break;
case Input::Key::V: ansi_c_str = "\x16"; break;
case Input::Key::W: ansi_c_str = "\x17"; break;
case Input::Key::X: ansi_c_str = "\x18"; break;
case Input::Key::Y: ansi_c_str = "\x19"; break;
case Input::Key::Z: ansi_c_str = "\x1A"; break;
case LibInput::Key::A: ansi_c_str = "\x01"; break;
case LibInput::Key::B: ansi_c_str = "\x02"; break;
case LibInput::Key::C: ansi_c_str = "\x03"; break;
case LibInput::Key::D: ansi_c_str = "\x04"; break;
case LibInput::Key::E: ansi_c_str = "\x05"; break;
case LibInput::Key::F: ansi_c_str = "\x06"; break;
case LibInput::Key::G: ansi_c_str = "\x07"; break;
case LibInput::Key::H: ansi_c_str = "\x08"; break;
case LibInput::Key::I: ansi_c_str = "\x09"; break;
case LibInput::Key::J: ansi_c_str = "\x0A"; break;
case LibInput::Key::K: ansi_c_str = "\x0B"; break;
case LibInput::Key::L: ansi_c_str = "\x0C"; break;
case LibInput::Key::M: ansi_c_str = "\x0D"; break;
case LibInput::Key::N: ansi_c_str = "\x0E"; break;
case LibInput::Key::O: ansi_c_str = "\x0F"; break;
case LibInput::Key::P: ansi_c_str = "\x10"; break;
case LibInput::Key::Q: ansi_c_str = "\x11"; break;
case LibInput::Key::R: ansi_c_str = "\x12"; break;
case LibInput::Key::S: ansi_c_str = "\x13"; break;
case LibInput::Key::T: ansi_c_str = "\x14"; break;
case LibInput::Key::U: ansi_c_str = "\x15"; break;
case LibInput::Key::V: ansi_c_str = "\x16"; break;
case LibInput::Key::W: ansi_c_str = "\x17"; break;
case LibInput::Key::X: ansi_c_str = "\x18"; break;
case LibInput::Key::Y: ansi_c_str = "\x19"; break;
case LibInput::Key::Z: ansi_c_str = "\x1A"; break;
default: break;
}
}
else
{
switch (key)
switch (event.key)
{
case Input::Key::Enter:
case Input::Key::NumpadEnter:
case LibInput::Key::Enter:
case LibInput::Key::NumpadEnter:
ansi_c_str = "\n";
break;
case Input::Key::Backspace:
case LibInput::Key::Backspace:
ansi_c_str = "\b";
break;
case Input::Key::ArrowUp:
case LibInput::Key::ArrowUp:
ansi_c_str = "\e[A";
break;
case Input::Key::ArrowDown:
case LibInput::Key::ArrowDown:
ansi_c_str = "\e[B";
break;
case Input::Key::ArrowRight:
case LibInput::Key::ArrowRight:
ansi_c_str = "\e[C";
break;
case Input::Key::ArrowLeft:
case LibInput::Key::ArrowLeft:
ansi_c_str = "\e[D";
break;
default:

View File

@ -8,7 +8,6 @@
#include <kernel/FS/VirtualFileSystem.h>
#include <kernel/GDT.h>
#include <kernel/IDT.h>
#include <kernel/Input/KeyboardLayout.h>
#include <kernel/Input/PS2/Controller.h>
#include <kernel/InterruptController.h>
#include <kernel/kprint.h>
@ -28,6 +27,8 @@
#include <kernel/Terminal/VirtualTTY.h>
#include <kernel/Timer/Timer.h>
#include <LibInput/KeyboardLayout.h>
struct ParsedCommandLine
{
bool force_pic = false;
@ -194,7 +195,7 @@ static void init2(void*)
#endif
// Initialize empty keymap
MUST(Input::KeyboardLayout::initialize());
MUST(LibInput::KeyboardLayout::initialize());
if (auto res = PS2Controller::initialize(); res.is_error())
dprintln("{}", res.error());

View File

@ -7,7 +7,7 @@
#include <sys/mman.h>
#include <termios.h>
#include <kernel/Input/MouseEvent.h>
#include <LibInput/MouseEvent.h>
framebuffer_info_t fb_info;
void* fb_mmap = nullptr;
@ -137,7 +137,7 @@ int main(int argc, char** argv)
while (true)
{
using namespace Kernel::Input;
using namespace LibInput;
MouseEvent event;
if (read(mouse_fd, &event, sizeof(event)) == -1)