summaryrefslogtreecommitdiff
path: root/noncore/apps/opie-console/TEmulation.cpp
Side-by-side diff
Diffstat (limited to 'noncore/apps/opie-console/TEmulation.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/opie-console/TEmulation.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/noncore/apps/opie-console/TEmulation.cpp b/noncore/apps/opie-console/TEmulation.cpp
index d0169d7..6ff73af 100644
--- a/noncore/apps/opie-console/TEmulation.cpp
+++ b/noncore/apps/opie-console/TEmulation.cpp
@@ -49,48 +49,54 @@
We use a refreshing algorithm here that has been adoped from rxvt/kvt.
By this, refreshing is driven by a timer, which is (re)started whenever
a new bunch of data to be interpreted by the emulation arives at `onRcvBlock'.
As soon as no more data arrive for `BULK_TIMEOUT' milliseconds, we trigger
refresh. This rule suits both bulk display operation as done by curses as
well as individual characters typed.
(BULK_TIMEOUT < 1000 / max characters received from keyboard per second).
Additionally, we trigger refreshing by newlines comming in to make visual
snapshots of lists as produced by `cat', `ls' and likely programs, thereby
producing the illusion of a permanent and immediate display operation.
As a sort of catch-all needed for cases where none of the above
conditions catch, the screen refresh is also triggered by a count
of incoming bulks (`bulk_incnt').
*/
/* FIXME
- evtl. the bulk operations could be made more transparent.
*/
#include "TEmulation.h"
+
+/* OPIE */
+#include <opie2/odebug.h>
+using namespace Opie::Core;
+
+/* STD */
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
/* ------------------------------------------------------------------------- */
/* */
/* TEmulation */
/* */
/* ------------------------------------------------------------------------- */
#define CNTL(c) ((c)-'@')
/*!
*/
TEmulation::TEmulation(TEWidget* gui)
: decoder((QTextDecoder*)NULL)
{
this->gui = gui;
screen[0] = new TEScreen(gui->Lines(),gui->Columns());
screen[1] = new TEScreen(gui->Lines(),gui->Columns());
scr = screen[0];
@@ -183,49 +189,49 @@ void TEmulation::onRcvChar(int c)
{
c &= 0xff;
switch (c)
{
case '\b' : scr->BackSpace(); break;
case '\t' : scr->Tabulate(); break;
case '\n' : scr->NewLine(); break;
case '\r' : scr->Return(); break;
case 0x07 : gui->Bell(); break;
default : scr->ShowCharacter(c); break;
};
}
/* ------------------------------------------------------------------------- */
/* */
/* Keyboard Handling */
/* */
/* ------------------------------------------------------------------------- */
/*!
*/
void TEmulation::onKeyPress( QKeyEvent* ev )
{
- qWarning("onKeyPress,....");
+ owarn << "onKeyPress,...." << oendl;
if (!connected) return; // someone else gets the keys
if (scr->getHistCursor() != scr->getHistLines());
scr->setHistCursor(scr->getHistLines());
if (!ev->text().isEmpty())
{ // A block of text
// Note that the text is proper unicode.
// We should do a conversion here, but since this
// routine will never be used, we simply emit plain ascii.
emit sndBlock(ev->text().ascii(),ev->text().length());
}
else if (ev->ascii()>0)
{ unsigned char c[1];
c[0] = ev->ascii();
emit sndBlock((char*)c,1);
}
}
// Unblocking, Byte to Unicode translation --------------------------------- --
/*
We are doing code conversion from locale to unicode first.
*/
void TEmulation::onRcvBlock(const char *s, int len)