summaryrefslogtreecommitdiffstats
path: root/src/plugins
diff options
context:
space:
mode:
authorAnders Bakken <anders.bakken@nokia.com>2009-07-28 20:49:03 (GMT)
committerAnders Bakken <anders.bakken@nokia.com>2009-07-28 21:11:42 (GMT)
commitc0f85469a76a25fff6951b634b67cfbcd0507b93 (patch)
treedfe60f394feb0895c5b17bccd27b66c64cff1015 /src/plugins
parent4caf5c1568163aa8efbfabb69ef0d83c3c6efd0a (diff)
downloadQt-c0f85469a76a25fff6951b634b67cfbcd0507b93.zip
Qt-c0f85469a76a25fff6951b634b67cfbcd0507b93.tar.gz
Qt-c0f85469a76a25fff6951b634b67cfbcd0507b93.tar.bz2
Make autorepeat work for DirectFB
When holding down a key DirectFB gives us only keypresses. Qt wants these kind of events: press not autorepeat release autorepeat press autorepeat release autorepeat press autorepeat release not autorepeat Reviewed-by: Donald <qt-info@nokia.com>
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/gfxdrivers/directfb/qdirectfbkeyboard.cpp29
1 files changed, 24 insertions, 5 deletions
diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbkeyboard.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbkeyboard.cpp
index b5376b1..13c4053 100644
--- a/src/plugins/gfxdrivers/directfb/qdirectfbkeyboard.cpp
+++ b/src/plugins/gfxdrivers/directfb/qdirectfbkeyboard.cpp
@@ -77,13 +77,15 @@ private:
QSocketNotifier *keyboardNotifier;
DFBEvent event;
int bytesRead;
-
+ int lastUnicode, lastKeycode;
+ Qt::KeyboardModifiers lastModifiers;
private Q_SLOTS:
void readKeyboardData();
};
QDirectFBKeyboardHandlerPrivate::QDirectFBKeyboardHandlerPrivate(QDirectFBKeyboardHandler *h)
- : handler(h), eventBuffer(0)
+ : handler(h), eventBuffer(0), keyboardNotifier(0), bytesRead(0),
+ lastUnicode(0), lastKeycode(0), lastModifiers(0)
{
Q_ASSERT(qt_screen);
@@ -114,8 +116,6 @@ QDirectFBKeyboardHandlerPrivate::QDirectFBKeyboardHandlerPrivate(QDirectFBKeyboa
::fcntl(fd, F_SETFL, flags | O_NONBLOCK);
memset(&event, 0, sizeof(event));
- bytesRead = 0;
-
keyboardNotifier = new QSocketNotifier(fd, QSocketNotifier::Read, this);
connect(keyboardNotifier, SIGNAL(activated(int)),
@@ -213,8 +213,27 @@ void QDirectFBKeyboardHandlerPrivate::readKeyboardData()
unicode = symbol;
if (unicode != -1 || keycode != 0) {
+ bool autoRepeat = false;
+ if (press) {
+ if (unicode == lastUnicode && keycode == lastKeycode && modifiers == lastModifiers) {
+ autoRepeat = true;
+ } else {
+ lastUnicode = unicode;
+ lastKeycode = keycode;
+ lastModifiers = modifiers;
+ }
+ } else {
+ lastUnicode = lastKeycode = -1;
+ lastModifiers = 0;
+ }
+ if (autoRepeat) {
+ handler->processKeyEvent(unicode, keycode,
+ modifiers, false, autoRepeat);
+
+ }
+
handler->processKeyEvent(unicode, keycode,
- modifiers, press, false);
+ modifiers, press, autoRepeat);
}
}
}