The Pedigree Project  0.1
Public Member Functions | Private Member Functions | Private Attributes | Friends | List of all members
Terminal Class Reference

#include <Terminal.h>

+ Collaboration diagram for Terminal:

Public Member Functions

 Terminal (char *pName, size_t nWidth, size_t nHeight, size_t offsetLeft, size_t offsetTop, rgb_t *pBackground, cairo_t *pCairo, class Widget *pWidget, class Tui *pTui, class Font *pNormalFont, class Font *pBoldFont)
 
bool initialise ()
 
bool isAlive ()
 
void renewBuffer (size_t nWidth, size_t nHeight)
 
void processKey (uint64_t key)
 
void clearQueue ()
 
char getFromQueue ()
 
size_t queueLength ()
 
int getSelectFd () const
 
void write (const char *pStr, DirtyRectangle &rect)
 
void setHasPendingRequest (bool b, size_t sz)
 
bool hasPendingRequest ()
 
size_t getPendingRequestSz ()
 
void setActive (bool b, DirtyRectangle &rect)
 
size_t getRows ()
 
size_t getCols ()
 
void redrawAll (DirtyRectangle &rect)
 
void refresh ()
 
rgb_tgetBuffer ()
 
int getPid ()
 
void showCursor (DirtyRectangle &rect)
 
void hideCursor (DirtyRectangle &rect)
 
void setCursorStyle (bool bFilled=true)
 
void cancel ()
 
void setCairo (cairo_t *pCairo, cairo_surface_t *pSurface)
 
void setFonts (Font *pNormalFont, Font *pBoldFont)
 

Private Member Functions

 Terminal (const Terminal &)
 
Terminaloperator= (const Terminal &)
 
void addToQueue (char c, bool bFlush=false)
 

Private Attributes

rgb_tm_pBuffer
 
PedigreeGraphics::Framebufferm_pFramebuffer
 
Xtermm_pXterm
 
char m_pName [256]
 
char m_pQueue [256]
 
size_t m_Len
 
char m_pWriteBuffer [4]
 
size_t m_WriteBufferLen
 
bool m_bHasPendingRequest
 
size_t m_PendingRequestSz
 
int m_Pid
 
int m_MasterPty
 
size_t m_OffsetLeft
 
size_t m_OffsetTop
 
volatile char m_Cancel
 
volatile bool m_WriteInProgress
 

Friends

class Xterm
 

Detailed Description

A Terminal is a wrapper around an Xterm class - it provides UTF-8 <-> UTF-32 conversion and input queueing.

Definition at line 38 of file Terminal.h.

Member Function Documentation

void Terminal::cancel ( )
inline

Cancels the current write operation (used by SIGINT handling)

Definition at line 148 of file Terminal.h.

void Terminal::clearQueue ( )

Wipes out the queue for this terminal.

Definition at line 270 of file Terminal.cc.

char Terminal::getFromQueue ( )

Grabs 1 byte of the utf-8 encoded queue.

Definition at line 256 of file Terminal.cc.

int Terminal::getSelectFd ( ) const
inline

Gets descriptor to select() on for readability to see if we have pending output.

Definition at line 74 of file Terminal.h.

References PedigreeGraphics::Framebuffer::getHeight(), PedigreeGraphics::Framebuffer::getWidth(), PedigreeGraphics::Framebuffer::redraw(), Xterm::renderAll(), and write().

Referenced by Tui::run().

+ Here is the caller graph for this function:

bool Terminal::initialise ( )
Todo:
Clean it up when the child terminates.

Definition at line 85 of file Terminal.cc.

Referenced by Tui::initialise(), and TextIO::writeStr().

+ Here is the caller graph for this function:

bool Terminal::isAlive ( )

Verifies whether the terminal and its child are alive.

Definition at line 225 of file Terminal.cc.

Referenced by Tui::run().

+ Here is the caller graph for this function:

void Terminal::processKey ( uint64_t  key)

Adds a 64-bit keycode from the Keyboard class.

Definition at line 251 of file Terminal.cc.

Referenced by Tui::keyInput().

+ Here is the caller graph for this function:

size_t Terminal::queueLength ( )
inline

Returns the queue length.

Definition at line 67 of file Terminal.h.

void Terminal::renewBuffer ( size_t  nWidth,
size_t  nHeight 
)

Kills and recreates the terminal's buffer, with a change in size.

Todo:
Send SIGWINCH in console layer.

Definition at line 240 of file Terminal.cc.

Referenced by Tui::resize().

+ Here is the caller graph for this function:

void Terminal::write ( const char *  pStr,
DirtyRectangle rect 
)

Writes the given UTF-8 sequence to the Xterm.

Todo:
Add some checking - every successive byte should start with 0b10.

Definition at line 275 of file Terminal.cc.

Referenced by getSelectFd(), and Tui::run().

+ Here is the caller graph for this function:


The documentation for this class was generated from the following files: