mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-25 14:05:15 +00:00
We now make three VirtualConsoles at boot: tty0, tty1, and tty2. We launch an instance of /bin/sh in each one. You switch between them with Alt+1/2/3 How very very cool :^)
39 lines
909 B
C++
39 lines
909 B
C++
#pragma once
|
|
|
|
#include <AK/Types.h>
|
|
#include <AK/DoublyLinkedList.h>
|
|
#include <AK/CircularQueue.h>
|
|
#include <VirtualFileSystem/CharacterDevice.h>
|
|
#include "IRQHandler.h"
|
|
|
|
class KeyboardClient {
|
|
public:
|
|
virtual ~KeyboardClient();
|
|
virtual void onKeyPress(byte) = 0;
|
|
};
|
|
|
|
class Keyboard final : public IRQHandler, public CharacterDevice {
|
|
public:
|
|
static Keyboard& the() PURE;
|
|
|
|
virtual ~Keyboard() override;
|
|
Keyboard();
|
|
|
|
void setClient(KeyboardClient* client) { m_client = client; }
|
|
|
|
private:
|
|
// ^IRQHandler
|
|
virtual void handleIRQ() override;
|
|
|
|
// ^CharacterDevice
|
|
virtual ssize_t read(byte* buffer, size_t) override;
|
|
virtual ssize_t write(const byte* buffer, size_t) override;
|
|
virtual bool hasDataAvailableForRead() const override;
|
|
|
|
void emit(byte);
|
|
|
|
KeyboardClient* m_client { nullptr };
|
|
CircularQueue<byte, 16> m_queue;
|
|
byte m_modifiers { 0 };
|
|
};
|
|
|