summaryrefslogtreecommitdiff
authorharlekin <harlekin>2002-05-02 10:59:23 (UTC)
committer harlekin <harlekin>2002-05-02 10:59:23 (UTC)
commit3e4ce540942b6342a00c272dac171e729ae2b08b (patch) (side-by-side diff)
tree9251a7389328a4d581b9e1c9848f8d6dc139a555
parent9b22572f07ec954e9dda33e99f7fc681e3c50827 (diff)
downloadopie-3e4ce540942b6342a00c272dac171e729ae2b08b.zip
opie-3e4ce540942b6342a00c272dac171e729ae2b08b.tar.gz
opie-3e4ce540942b6342a00c272dac171e729ae2b08b.tar.bz2
removed the hack that limited the bad influence of the sticky bug on ipaq, since it is not needed any more. Sticky bug is fixed in 2.4.18-rmk3 hh6
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--inputmethods/keyboard/keyboard.cpp72
1 files changed, 36 insertions, 36 deletions
diff --git a/inputmethods/keyboard/keyboard.cpp b/inputmethods/keyboard/keyboard.cpp
index a04c45a..0f0b188 100644
--- a/inputmethods/keyboard/keyboard.cpp
+++ b/inputmethods/keyboard/keyboard.cpp
@@ -51,22 +51,22 @@ Keyboard::Keyboard(QWidget* parent, const char* _name, WFlags f) :
this, SIGNAL(key(ushort,ushort,ushort,bool,bool)) );
repeatTimer = new QTimer( this );
// temporary quick and dirty fix for the "sticky keyboard bug"
// on ipaq.
- struct utsname name;
- if (uname(&name) != -1)
- {
- QString release=name.release;
- qWarning("System release: %s\n", name.release);
- if(release.find("embedix",0,TRUE) !=-1)
- {
- connect( repeatTimer, SIGNAL(timeout()), this, SLOT(repeat()) );
- }
- }
+// struct utsname name;
+// if (uname(&name) != -1)
+ // {
+// QString release=name.release;
+// qWarning("System release: %s\n", name.release);
+// if(release.find("embedix",0,TRUE) !=-1)
+// {
+ connect( repeatTimer, SIGNAL(timeout()), this, SLOT(repeat()) );
+// }
+ // }
}
void Keyboard::resizeEvent(QResizeEvent*)
{
int ph = picks->sizeHint().height();
picks->setGeometry( 0, 0, width(), ph );
@@ -116,24 +116,24 @@ void KeyboardConfig::generateText(const QString &s)
//PC keyboard layout and scancodes
/*
Format: length, code, length, code, ..., 0
-
+
length is measured in half the width of a standard key.
If code < 0x80 we have length/2 consecutive standard keys,
starting with scancode code.
-
+
Special keys are hardcoded, one at a time, with length of key
and code >= 0x80, these are NOT standard PC scancodes, but are looked
up in specialM[]. (The special keys are not keymappable.)
-
+
*/
-static const uchar * const keyboard_opti[5] = {
+static const uchar * const keyboard_opti[5] = {
(const uchar *const) "\001\223\003\240\002\20\002\41\002\26\002\62\002\56\002\45\002\54\003\200\001\223\002\226\002\235\002\234\002\236",
(const uchar *const) "\001\223\003\201\004\207\002\30\002\24\002\43\004\207\003\203\001\223\006\002\002\065",
(const uchar *const) "\001\223\003\202\002\60\002\37\002\23\002\22\002\36\002\21\002\55\003\203\001\223\006\005\002\055",
(const uchar *const) "\001\223\003\205\004\207\002\27\002\61\002\40\004\207\003\204\001\223\006\010\002\014",
(const uchar *const) "\001\223\003\206\002\44\002\31\002\57\002\42\002\46\002\25\002\207\003\204\001\223\002\013\002\064\002\015\002\230"
};
@@ -149,20 +149,20 @@ static const uchar * const keyboard_standard[5] = {
//~ + 123...+ BACKSPACE //+ INSERT + HOME + PGUP
(const uchar *const)"\003\201\002q\002w\002e\002r\002t\002y\002u\002i\002o\002p\002[\002]\002\\\001\224\002\223\002\221\002\220\002\222",
//TAB + qwerty.. + backslash //+ DEL + END + PGDN
(const uchar *const)"\004\202\002a\002s\002d\002f\002g\002h\002j\002k\002l\002;\002'\004\203",
- //CAPS + asdf.. + RETURN
+ //CAPS + asdf.. + RETURN
(const uchar *const)"\005\204\002z\002x\002c\002v\002b\002n\002m\002,\002.\002/\005\204\002\223\002\223\002\211",
//SHIFT + zxcv... //+ UP
- (const uchar *const)"\003\205\003\206\022\207\003\206\003\205\002\223\002\212\002\213\002\214"
+ (const uchar *const)"\003\205\003\206\022\207\003\206\003\205\002\223\002\212\002\213\002\214"
//CTRL + ALT + SPACE //+ LEFT + DOWN + RIGHT
-
+
};
struct ShiftMap {
char normal;
char shifted;
@@ -391,13 +391,13 @@ static const char * const escape_xpm[]={
".a...a.a.",
".aa.aa.aa",
".........",
"........."};
-enum { BSCode = 0x80, TabCode, CapsCode, RetCode,
+enum { BSCode = 0x80, TabCode, CapsCode, RetCode,
ShiftCode, CtrlCode, AltCode, SpaceCode, BackSlash,
UpCode, LeftCode, DownCode, RightCode, Blank, Expand,
Opti, ResetDict,
Divide, Multiply, Add, Subtract, Decimal, Equal,
Percent, Sqrt, Inverse, Escape };
@@ -432,13 +432,13 @@ static const SpecialMap specialM[] = {
{ Qt::Key_Delete, 0, "X", delete_xpm },
{ Qt::Key_PageDown, 0, "D", pagedown_xpm },
{ Blank, 0, " ", NULL },
{ Expand, 0, "->", expand_xpm },
{ Opti, 0, "#", NULL },
{ ResetDict, 0, "R", NULL },
-
+
// number pad stuff
{ Divide, 0, "/", NULL },
{ Multiply, 0, "*", NULL },
{ Add, 0, "+", NULL },
{ Subtract, 0, "-", NULL },
{ Decimal, 0, ".", NULL },
@@ -452,55 +452,55 @@ static const SpecialMap specialM[] = {
static int keycode( int i2, int j, const uchar **keyboard )
{
if ( j <0 || j >= 5 )
return 0;
-
+
const uchar *row = keyboard[j];
while ( *row && *row <= i2 ) {
i2 -= *row;
row += 2;
}
if ( !*row ) return 0;
-
+
int k;
if ( row[1] >= 0x80 ) {
k = row[1];
} else {
k = row[1]+i2/2;
}
-
+
return k;
}
/*
return scancode and width of first key in row \a j if \a j >= 0,
or next key on current row if \a j < 0.
-
+
*/
int Keyboard::getKey( int &w, int j ) {
static const uchar *row = 0;
static int key_i = 0;
static int scancode = 0;
static int half = 0;
-
+
if ( j >= 0 && j < 5 ) {
if (useOptiKeys)
row = keyboard_opti[j];
else
row = keyboard_standard[j];
half=0;
}
if ( !row || !*row ) {
- return 0;
+ return 0;
} else if ( row[1] >= 0x80 ) {
scancode = row[1];
w = (row[0] * w + (half++&1)) / 2;
row += 2;
return scancode;
} else if ( key_i <= 0 ) {
@@ -509,13 +509,13 @@ int Keyboard::getKey( int &w, int j ) {
}
key_i--;
if ( key_i <= 0 )
row += 2;
return scancode++;
}
-
+
void Keyboard::paintEvent(QPaintEvent* e)
{
QPainter painter(this);
painter.setClipRect(e->rect());
drawKeyboard( painter );
@@ -537,13 +537,13 @@ void Keyboard::drawKeyboard( QPainter &p, int key )
QColor keycolor_pressed = cg.mid();
QColor keycolor_lo = cg.dark();
QColor keycolor_hi = cg.light();
QColor textcolor = QColor(0,0,0); // cg.text();
int margin = threeD ? 1 : 0;
-
+
// p.fillRect( 0, , kw-1, keyHeight-2, keycolor_pressed );
for ( int j = 0; j < 5; j++ ) {
int y = j * keyHeight + picks->height() + 1;
int x = xoffs;
int kw = defaultKeyWidth;
@@ -551,31 +551,31 @@ void Keyboard::drawKeyboard( QPainter &p, int key )
while ( k ) {
if ( key < 0 || k == key ) {
QString s;
bool pressed = (k == pressedKey);
bool blank = (k == 0223);
const char * const * xpm = NULL;
-
+
if ( k >= 0x80 ) {
s = specialM[k - 0x80].label;
xpm = specialM[k - 0x80].xpm;
-
+
if ( k == ShiftCode ) {
pressed = shift;
} else if ( k == CapsCode ) {
pressed = lock;
} else if ( k == CtrlCode ) {
pressed = ctrl;
} else if ( k == AltCode ) {
pressed = alt;
- }
+ }
} else {
#if defined(Q_WS_QWS) || defined(_WS_QWS_)
/*
- s = QChar( shift^lock ? QWSServer::keyMap()[k].shift_unicode :
+ s = QChar( shift^lock ? QWSServer::keyMap()[k].shift_unicode :
QWSServer::keyMap()[k].unicode);
*/
// ### Fixme, bad code, needs improving, whole thing needs to
// be re-coded to get rid of the way it did things with scancodes etc
char shifted = k;
if ( !isalpha( k ) ) {
@@ -618,22 +618,22 @@ void Keyboard::drawKeyboard( QPainter &p, int key )
if (xpm) {
p.drawPixmap( x + 1, y + 2, QPixmap((const char**)xpm) );
} else {
p.setPen(textcolor);
p.drawText( x - 1, y, kw, keyHeight-2, AlignCenter, s );
}
-
+
if ( threeD ) {
p.setPen(keycolor_hi);
p.drawLine( x, y, x+kw-1, y );
}
// bottom
p.setPen(keycolor_lo);
p.drawLine( x, y+keyHeight-1, x+kw-1, y+keyHeight-1 );
-
+
} else {
p.fillRect( x, y, kw, keyHeight, cg.background() );
}
}
x += kw;
@@ -686,13 +686,13 @@ void Keyboard::mousePressEvent(QMouseEvent *e)
qk = QWSServer::keyMap()[k].key_code;
if ( qk != Key_unknown ) {
if ( ctrl )
u = QWSServer::keyMap()[k].ctrl_unicode;
else if ( shift^lock )
u = QWSServer::keyMap()[k].shift_unicode;
- else
+ else
u = QWSServer::keyMap()[k].unicode;
}
*/
char shifted = k;
if ( !isalpha( k ) ) {
// ### Fixme, bad code, needs improving, whole thing needs to
@@ -772,13 +772,13 @@ void Keyboard::timerEvent(QTimerEvent* e)
clearHighlight();
}
}
void Keyboard::repeat()
{
-
+
repeatTimer->start( 200 );
emit key( unicode, qkeycode, modifiers, true, true );
}
void Keyboard::clearHighlight()
{
@@ -795,13 +795,13 @@ QSize Keyboard::sizeHint() const
{
QFontMetrics fm=fontMetrics();
int keyHeight = fm.lineSpacing()+2;
if (useOptiKeys)
keyHeight += 1;
-
+
return QSize( 320, keyHeight * 5 + picks->sizeHint().height() + 1 );
}
void Keyboard::resetState()
{