mirror of
https://gitlab.com/sortix/sortix.git
synced 2023-02-13 20:55:38 -05:00
78 lines
2 KiB
C
78 lines
2 KiB
C
|
/******************************************************************************
|
||
|
|
||
|
COPYRIGHT(C) JONAS 'SORTIE' TERMANSEN 2012.
|
||
|
|
||
|
This file is part of Sortix.
|
||
|
|
||
|
Sortix is free software: you can redistribute it and/or modify it under the
|
||
|
terms of the GNU General Public License as published by the Free Software
|
||
|
Foundation, either version 3 of the License, or (at your option) any later
|
||
|
version.
|
||
|
|
||
|
Sortix is distributed in the hope that it will be useful, but WITHOUT ANY
|
||
|
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||
|
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||
|
details.
|
||
|
|
||
|
You should have received a copy of the GNU General Public License along
|
||
|
with Sortix. If not, see <http://www.gnu.org/licenses/>.
|
||
|
|
||
|
logterminal.h
|
||
|
A simple terminal that writes to the kernel log.
|
||
|
|
||
|
******************************************************************************/
|
||
|
|
||
|
#ifndef SORTIX_LOGTERMINAL_H
|
||
|
#define SORTIX_LOGTERMINAL_H
|
||
|
|
||
|
#include "event.h"
|
||
|
#include "stream.h"
|
||
|
#include "terminal.h"
|
||
|
#include "keyboard.h"
|
||
|
#include "linebuffer.h"
|
||
|
|
||
|
namespace Sortix
|
||
|
{
|
||
|
class LogTerminal : public DevTerminal, public KeyboardOwner
|
||
|
{
|
||
|
public:
|
||
|
LogTerminal(Keyboard* keyboard, KeyboardLayout* kblayout);
|
||
|
virtual ~LogTerminal();
|
||
|
|
||
|
public:
|
||
|
virtual ssize_t Read(byte* dest, size_t count);
|
||
|
virtual ssize_t Write(const byte* src, size_t count);
|
||
|
virtual bool IsReadable();
|
||
|
virtual bool IsWritable();
|
||
|
|
||
|
public:
|
||
|
virtual bool SetMode(unsigned mode);
|
||
|
virtual bool SetWidth(unsigned width);
|
||
|
virtual bool SetHeight(unsigned height);
|
||
|
virtual unsigned GetMode() const;
|
||
|
virtual unsigned GetWidth() const;
|
||
|
virtual unsigned GetHeight() const;
|
||
|
|
||
|
public:
|
||
|
virtual void OnKeystroke(Keyboard* keyboard, void* user);
|
||
|
|
||
|
private:
|
||
|
void ProcessKeystroke(int kbkey);
|
||
|
void QueueUnicode(uint32_t unicode);
|
||
|
void CommitLineBuffer();
|
||
|
|
||
|
private:
|
||
|
Keyboard* keyboard;
|
||
|
KeyboardLayout* kblayout;
|
||
|
LineBuffer linebuffer;
|
||
|
Event queuecommitevent;
|
||
|
size_t partiallywritten;
|
||
|
unsigned mode;
|
||
|
bool control;
|
||
|
|
||
|
};
|
||
|
}
|
||
|
|
||
|
#endif
|
||
|
|