summaryrefslogtreecommitdiffstats
path: root/src/gui/embedded/qmouselinuxinput_qws.cpp
diff options
context:
space:
mode:
authorRitt Konstantin <qnx@ics.com>2011-06-21 11:51:13 (GMT)
committerHarald Fernengel <harald.fernengel@nokia.com>2011-06-21 12:05:46 (GMT)
commit72e78283d69dc4570b51c02afab8a34d1e7385c2 (patch)
treead622ed9bfc1f004b2769f6f91217c3643932a9b /src/gui/embedded/qmouselinuxinput_qws.cpp
parent47b8e218aaa50714871a789ce257c0845d04b219 (diff)
downloadQt-72e78283d69dc4570b51c02afab8a34d1e7385c2.zip
Qt-72e78283d69dc4570b51c02afab8a34d1e7385c2.tar.gz
Qt-72e78283d69dc4570b51c02afab8a34d1e7385c2.tar.bz2
massive improvements for the QNX mouse driver
add support for the input devices with an absolute positioning; decrease lagging on slow machines by queueing more mouse events than just 10 of them; fix an issue with losing the button press state between subsequent loops (ie long drag'n'drop) Merge-request: 1259 Reviewed-by: Harald Fernengel <harald.fernengel@nokia.com>
Diffstat (limited to 'src/gui/embedded/qmouselinuxinput_qws.cpp')
-rw-r--r--src/gui/embedded/qmouselinuxinput_qws.cpp18
1 files changed, 10 insertions, 8 deletions
diff --git a/src/gui/embedded/qmouselinuxinput_qws.cpp b/src/gui/embedded/qmouselinuxinput_qws.cpp
index efcf6d4..19a9a99 100644
--- a/src/gui/embedded/qmouselinuxinput_qws.cpp
+++ b/src/gui/embedded/qmouselinuxinput_qws.cpp
@@ -135,19 +135,21 @@ void QWSLinuxInputMousePrivate::readMouseData()
int n = 0;
forever {
- n = QT_READ(m_fd, reinterpret_cast<char *>(buffer) + n, sizeof(buffer) - n);
-
- if (n == 0) {
+ int bytesRead = QT_READ(m_fd, reinterpret_cast<char *>(buffer) + n, sizeof(buffer) - n);
+ if (bytesRead == 0) {
qWarning("Got EOF from the input device.");
return;
- } else if (n < 0 && (errno != EINTR && errno != EAGAIN)) {
- qWarning("Could not read from input device: %s", strerror(errno));
- return;
- } else if (n % sizeof(buffer[0]) == 0) {
+ }
+ if (bytesRead == -1) {
+ if (errno != EAGAIN)
+ qWarning("Could not read from input device: %s", strerror(errno));
break;
}
- }
+ n += bytesRead;
+ if (n % sizeof(buffer[0]) == 0)
+ break;
+ }
n /= sizeof(buffer[0]);
for (int i = 0; i < n; ++i) {