-rw-r--r-- | inputmethods/keyboard/keyboard.cpp | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/inputmethods/keyboard/keyboard.cpp b/inputmethods/keyboard/keyboard.cpp index 9dd24e4..233f08e 100644 --- a/inputmethods/keyboard/keyboard.cpp +++ b/inputmethods/keyboard/keyboard.cpp @@ -7,70 +7,84 @@ ** GNU General Public License version 2 as published by the Free Software ** Foundation and appearing in the file LICENSE.GPL included in the ** packaging of this file. ** ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. ** ** See http://www.trolltech.com/gpl/ for GPL licensing information. ** ** Contact info@trolltech.com if any conditions of this licensing are ** not clear to you. ** **********************************************************************/ #include "keyboard.h" #include <qpe/global.h> #include <qwindowsystem_qws.h> #include <qpainter.h> #include <qfontmetrics.h> #include <qtimer.h> #include <ctype.h> +#include <sys/utsname.h> + #define USE_SMALL_BACKSPACE Keyboard::Keyboard(QWidget* parent, const char* name, WFlags f) : QFrame(parent, name, f), shift(FALSE), lock(FALSE), ctrl(FALSE), alt(FALSE), useLargeKeys(TRUE), useOptiKeys(0), pressedKey(-1), unicode(-1), qkeycode(0), modifiers(0) { // setPalette(QPalette(QColor(240,240,230))); // Beige! // setFont( QFont( "Helvetica", 8 ) ); // setPalette(QPalette(QColor(200,200,200))); // Gray setPalette(QPalette(QColor(220,220,220))); // Gray picks = new KeyboardPicks( this ); picks->setFont( QFont( "smallsmooth", 9 ) ); setFont( QFont( "smallsmooth", 9 ) ); picks->initialise(); QObject::connect( picks, SIGNAL(key(ushort,ushort,ushort,bool,bool) ), this, SIGNAL(key(ushort,ushort,ushort,bool,bool)) ); repeatTimer = new QTimer( this ); - connect( repeatTimer, SIGNAL(timeout()), this, SLOT(repeat()) ); + + // 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()) ); + } + } } void Keyboard::resizeEvent(QResizeEvent*) { int ph = picks->sizeHint().height(); picks->setGeometry( 0, 0, width(), ph ); keyHeight = (height()-ph)/5; int nk; if ( useOptiKeys ) { nk = 15; } else if ( useLargeKeys ) { nk = 15; } else { nk = 19; } defaultKeyWidth = width()/nk; xoffs = (width()-defaultKeyWidth*nk)/2; } void KeyboardPicks::initialise() { setSizePolicy(QSizePolicy(QSizePolicy::Expanding,QSizePolicy::Fixed)); mode = 0; dc = new KeyboardConfig(this); @@ -740,50 +754,51 @@ void Keyboard::mouseReleaseEvent(QMouseEvent*) { if ( pressTid == 0 ) clearHighlight(); #if defined(Q_WS_QWS) || defined(_WS_QWS_) if ( unicode != -1 ) { emit key( unicode, qkeycode, modifiers, false, false ); repeatTimer->stop(); } #endif pressed = FALSE; } void Keyboard::timerEvent(QTimerEvent* e) { if ( e->timerId() == pressTid ) { killTimer(pressTid); pressTid = 0; if ( !pressed ) clearHighlight(); } } void Keyboard::repeat() { - repeatTimer->start( 150 ); - emit key( unicode, qkeycode, modifiers, true, true ); + + repeatTimer->start( 200 ); + emit key( unicode, qkeycode, modifiers, true, true ); } void Keyboard::clearHighlight() { if ( pressedKey >= 0 ) { int tmp = pressedKey; pressedKey = -1; QPainter p(this); drawKeyboard( p, tmp ); } } 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 ); } |