| Absolute File Name: | /home/qt/qt5_coco/qt5/qtbase/src/platformsupport/input/evdevmouse/qevdevmousehandler.cpp |
| Source code | Switch to Preprocessed file |
| Line | Source | Count | ||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 | /**************************************************************************** | - | ||||||||||||||||||
| 2 | ** | - | ||||||||||||||||||
| 3 | ** Copyright (C) 2016 The Qt Company Ltd. | - | ||||||||||||||||||
| 4 | ** Contact: https://www.qt.io/licensing/ | - | ||||||||||||||||||
| 5 | ** | - | ||||||||||||||||||
| 6 | ** This file is part of the QtGui module of the Qt Toolkit. | - | ||||||||||||||||||
| 7 | ** | - | ||||||||||||||||||
| 8 | ** $QT_BEGIN_LICENSE:LGPL$ | - | ||||||||||||||||||
| 9 | ** Commercial License Usage | - | ||||||||||||||||||
| 10 | ** Licensees holding valid commercial Qt licenses may use this file in | - | ||||||||||||||||||
| 11 | ** accordance with the commercial license agreement provided with the | - | ||||||||||||||||||
| 12 | ** Software or, alternatively, in accordance with the terms contained in | - | ||||||||||||||||||
| 13 | ** a written agreement between you and The Qt Company. For licensing terms | - | ||||||||||||||||||
| 14 | ** and conditions see https://www.qt.io/terms-conditions. For further | - | ||||||||||||||||||
| 15 | ** information use the contact form at https://www.qt.io/contact-us. | - | ||||||||||||||||||
| 16 | ** | - | ||||||||||||||||||
| 17 | ** GNU Lesser General Public License Usage | - | ||||||||||||||||||
| 18 | ** Alternatively, this file may be used under the terms of the GNU Lesser | - | ||||||||||||||||||
| 19 | ** General Public License version 3 as published by the Free Software | - | ||||||||||||||||||
| 20 | ** Foundation and appearing in the file LICENSE.LGPL3 included in the | - | ||||||||||||||||||
| 21 | ** packaging of this file. Please review the following information to | - | ||||||||||||||||||
| 22 | ** ensure the GNU Lesser General Public License version 3 requirements | - | ||||||||||||||||||
| 23 | ** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. | - | ||||||||||||||||||
| 24 | ** | - | ||||||||||||||||||
| 25 | ** GNU General Public License Usage | - | ||||||||||||||||||
| 26 | ** Alternatively, this file may be used under the terms of the GNU | - | ||||||||||||||||||
| 27 | ** General Public License version 2.0 or (at your option) the GNU General | - | ||||||||||||||||||
| 28 | ** Public license version 3 or any later version approved by the KDE Free | - | ||||||||||||||||||
| 29 | ** Qt Foundation. The licenses are as published by the Free Software | - | ||||||||||||||||||
| 30 | ** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 | - | ||||||||||||||||||
| 31 | ** included in the packaging of this file. Please review the following | - | ||||||||||||||||||
| 32 | ** information to ensure the GNU General Public License requirements will | - | ||||||||||||||||||
| 33 | ** be met: https://www.gnu.org/licenses/gpl-2.0.html and | - | ||||||||||||||||||
| 34 | ** https://www.gnu.org/licenses/gpl-3.0.html. | - | ||||||||||||||||||
| 35 | ** | - | ||||||||||||||||||
| 36 | ** $QT_END_LICENSE$ | - | ||||||||||||||||||
| 37 | ** | - | ||||||||||||||||||
| 38 | ****************************************************************************/ | - | ||||||||||||||||||
| 39 | - | |||||||||||||||||||
| 40 | #include "qevdevmousehandler_p.h" | - | ||||||||||||||||||
| 41 | - | |||||||||||||||||||
| 42 | #include <QSocketNotifier> | - | ||||||||||||||||||
| 43 | #include <QStringList> | - | ||||||||||||||||||
| 44 | #include <QPoint> | - | ||||||||||||||||||
| 45 | #include <QGuiApplication> | - | ||||||||||||||||||
| 46 | #include <QScreen> | - | ||||||||||||||||||
| 47 | #include <QLoggingCategory> | - | ||||||||||||||||||
| 48 | #include <qpa/qwindowsysteminterface.h> | - | ||||||||||||||||||
| 49 | - | |||||||||||||||||||
| 50 | #include <qplatformdefs.h> | - | ||||||||||||||||||
| 51 | #include <private/qcore_unix_p.h> // overrides QT_OPEN | - | ||||||||||||||||||
| 52 | #include <private/qhighdpiscaling_p.h> | - | ||||||||||||||||||
| 53 | - | |||||||||||||||||||
| 54 | #include <errno.h> | - | ||||||||||||||||||
| 55 | - | |||||||||||||||||||
| 56 | #include <linux/kd.h> | - | ||||||||||||||||||
| 57 | #include <linux/input.h> | - | ||||||||||||||||||
| 58 | - | |||||||||||||||||||
| 59 | #define TEST_BIT(array, bit) (array[bit/8] & (1<<(bit%8))) | - | ||||||||||||||||||
| 60 | - | |||||||||||||||||||
| 61 | QT_BEGIN_NAMESPACE | - | ||||||||||||||||||
| 62 | - | |||||||||||||||||||
| 63 | Q_LOGGING_CATEGORY(qLcEvdevMouse, "qt.qpa.input") | - | ||||||||||||||||||
| 64 | - | |||||||||||||||||||
| 65 | QEvdevMouseHandler *QEvdevMouseHandler::create(const QString &device, const QString &specification) | - | ||||||||||||||||||
| 66 | { | - | ||||||||||||||||||
| 67 | qCDebug(qLcEvdevMouse) << "create mouse handler for" << device << specification; never executed: QMessageLogger(__FILE__, 67, __PRETTY_FUNCTION__, qLcEvdevMouse().categoryName()).debug() << "create mouse handler for" << device << specification;
| 0 | ||||||||||||||||||
| 68 | - | |||||||||||||||||||
| 69 | bool compression = true; | - | ||||||||||||||||||
| 70 | int jitterLimit = 0; | - | ||||||||||||||||||
| 71 | int grab = 0; | - | ||||||||||||||||||
| 72 | bool abs = false; | - | ||||||||||||||||||
| 73 | - | |||||||||||||||||||
| 74 | QStringListconst auto args = specification.splitsplitRef(QLatin1Char(':')); | - | ||||||||||||||||||
| 75 | foreachfor (const QStringQStringRef &arg ,: args) { | - | ||||||||||||||||||
| 76 | if (arg == QLatin1String("nocompress"))
| 0 | ||||||||||||||||||
| 77 | compression = false; never executed: compression = false; | 0 | ||||||||||||||||||
| 78 | else if (arg.startsWith(QLatin1String("dejitter=")))
| 0 | ||||||||||||||||||
| 79 | jitterLimit = arg.mid(9).toInt(); never executed: jitterLimit = arg.mid(9).toInt(); | 0 | ||||||||||||||||||
| 80 | else if (arg.startsWith(QLatin1String("grab=")))
| 0 | ||||||||||||||||||
| 81 | grab = arg.mid(5).toInt(); never executed: grab = arg.mid(5).toInt(); | 0 | ||||||||||||||||||
| 82 | else if (arg == QLatin1String("abs"))
| 0 | ||||||||||||||||||
| 83 | abs = true; never executed: abs = true; | 0 | ||||||||||||||||||
| 84 | } never executed: end of block | 0 | ||||||||||||||||||
| 85 | - | |||||||||||||||||||
| 86 | int fd; | - | ||||||||||||||||||
| 87 | fd = qt_safe_open(device.toLocal8Bit().constData(), O_RDONLY | O_NDELAY, 0); | - | ||||||||||||||||||
| 88 | if (fd >= 0) {
| 0 | ||||||||||||||||||
| 89 | ::ioctl(fd, EVIOCGRAB, grab); | - | ||||||||||||||||||
| 90 | return new QEvdevMouseHandler(device, fd, abs, compression, jitterLimit); never executed: return new QEvdevMouseHandler(device, fd, abs, compression, jitterLimit); | 0 | ||||||||||||||||||
| 91 | } else { | - | ||||||||||||||||||
| 92 | qErrnoWarning(errno, "Cannot open mouse input device %s", qPrintable(device)); | - | ||||||||||||||||||
| 93 | return 0; never executed: return 0; | 0 | ||||||||||||||||||
| 94 | } | - | ||||||||||||||||||
| 95 | } | - | ||||||||||||||||||
| 96 | - | |||||||||||||||||||
| 97 | QEvdevMouseHandler::QEvdevMouseHandler(const QString &device, int fd, bool abs, bool compression, int jitterLimit) | - | ||||||||||||||||||
| 98 | : m_device(device), m_fd(fd), m_notify(0), m_x(0), m_y(0), m_prevx(0), m_prevy(0), | - | ||||||||||||||||||
| 99 | m_abs(abs), m_compression(compression), m_buttons(0), m_prevInvalid(true) | - | ||||||||||||||||||
| 100 | { | - | ||||||||||||||||||
| 101 | setObjectName(QLatin1String("Evdev Mouse Handler")); | - | ||||||||||||||||||
| 102 | - | |||||||||||||||||||
| 103 | m_jitterLimitSquared = jitterLimit * jitterLimit; | - | ||||||||||||||||||
| 104 | - | |||||||||||||||||||
| 105 | // Some touch screens present as mice with absolute coordinates. | - | ||||||||||||||||||
| 106 | // These can not be differentiated from touchpads, so supplying abs to QT_QPA_EVDEV_MOUSE_PARAMETERS | - | ||||||||||||||||||
| 107 | // will force qevdevmousehandler to treat the coordinates as absolute, scaled to the hardware maximums. | - | ||||||||||||||||||
| 108 | // Turning this on will not affect mice as these do not report in absolute coordinates | - | ||||||||||||||||||
| 109 | // but will make touchpads act like touch screens | - | ||||||||||||||||||
| 110 | if (m_abs) | - | ||||||||||||||||||
| 111 | m_abs = getHardwareMaximum(); | - | ||||||||||||||||||
| 112 | - | |||||||||||||||||||
| 113 | // socket notifier for events on the mouse device | - | ||||||||||||||||||
| 114 | m_notify = new QSocketNotifier(m_fd, QSocketNotifier::Read, this); | - | ||||||||||||||||||
| 115 | connect(m_notify, SIGNAL(activated(int)), this, SLOT(readMouseData())); | - | ||||||||||||||||||
| 116 | } | - | ||||||||||||||||||
| 117 | - | |||||||||||||||||||
| 118 | QEvdevMouseHandler::~QEvdevMouseHandler() | - | ||||||||||||||||||
| 119 | { | - | ||||||||||||||||||
| 120 | if (m_fd >= 0) | - | ||||||||||||||||||
| 121 | qt_safe_close(m_fd); | - | ||||||||||||||||||
| 122 | } | - | ||||||||||||||||||
| 123 | - | |||||||||||||||||||
| 124 | // Ask touch screen hardware for information on coordinate maximums | - | ||||||||||||||||||
| 125 | // If any ioctls fail, revert to non abs mode | - | ||||||||||||||||||
| 126 | bool QEvdevMouseHandler::getHardwareMaximum() | - | ||||||||||||||||||
| 127 | { | - | ||||||||||||||||||
| 128 | unsigned char absFeatures[(ABS_MAX / 8) + 1]; | - | ||||||||||||||||||
| 129 | memset(absFeatures, '\0', sizeof (absFeatures)); | - | ||||||||||||||||||
| 130 | - | |||||||||||||||||||
| 131 | // test if ABS_X, ABS_Y are available | - | ||||||||||||||||||
| 132 | if (ioctl(m_fd, EVIOCGBIT(EV_ABS, sizeof (absFeatures)), absFeatures) == -1) | - | ||||||||||||||||||
| 133 | return false; | - | ||||||||||||||||||
| 134 | - | |||||||||||||||||||
| 135 | if ((!TEST_BIT(absFeatures, ABS_X)) || (!TEST_BIT(absFeatures, ABS_Y))) | - | ||||||||||||||||||
| 136 | return false; | - | ||||||||||||||||||
| 137 | - | |||||||||||||||||||
| 138 | // ask hardware for minimum and maximum values | - | ||||||||||||||||||
| 139 | struct input_absinfo absInfo; | - | ||||||||||||||||||
| 140 | if (ioctl(m_fd, EVIOCGABS(ABS_X), &absInfo) == -1) | - | ||||||||||||||||||
| 141 | return false; | - | ||||||||||||||||||
| 142 | - | |||||||||||||||||||
| 143 | m_hardwareWidth = absInfo.maximum - absInfo.minimum; | - | ||||||||||||||||||
| 144 | - | |||||||||||||||||||
| 145 | if (ioctl(m_fd, EVIOCGABS(ABS_Y), &absInfo) == -1) | - | ||||||||||||||||||
| 146 | return false; | - | ||||||||||||||||||
| 147 | - | |||||||||||||||||||
| 148 | m_hardwareHeight = absInfo.maximum - absInfo.minimum; | - | ||||||||||||||||||
| 149 | - | |||||||||||||||||||
| 150 | QScreen *primaryScreen = QGuiApplication::primaryScreen(); | - | ||||||||||||||||||
| 151 | QRect g = QHighDpi::toNativePixels(primaryScreen->virtualGeometry(), primaryScreen); | - | ||||||||||||||||||
| 152 | m_hardwareScalerX = static_cast<qreal>(m_hardwareWidth) / (g.right() - g.left()); | - | ||||||||||||||||||
| 153 | m_hardwareScalerY = static_cast<qreal>(m_hardwareHeight) / (g.bottom() - g.top()); | - | ||||||||||||||||||
| 154 | - | |||||||||||||||||||
| 155 | qCDebug(qLcEvdevMouse) << "Absolute pointing device" | - | ||||||||||||||||||
| 156 | << "hardware max x" << m_hardwareWidth | - | ||||||||||||||||||
| 157 | << "hardware max y" << m_hardwareHeight | - | ||||||||||||||||||
| 158 | << "hardware scalers x" << m_hardwareScalerX << 'y' << m_hardwareScalerY; | - | ||||||||||||||||||
| 159 | - | |||||||||||||||||||
| 160 | return true; | - | ||||||||||||||||||
| 161 | } | - | ||||||||||||||||||
| 162 | - | |||||||||||||||||||
| 163 | void QEvdevMouseHandler::sendMouseEvent() | - | ||||||||||||||||||
| 164 | { | - | ||||||||||||||||||
| 165 | int x; | - | ||||||||||||||||||
| 166 | int y; | - | ||||||||||||||||||
| 167 | - | |||||||||||||||||||
| 168 | if (!m_abs) { | - | ||||||||||||||||||
| 169 | x = m_x - m_prevx; | - | ||||||||||||||||||
| 170 | y = m_y - m_prevy; | - | ||||||||||||||||||
| 171 | } | - | ||||||||||||||||||
| 172 | else { | - | ||||||||||||||||||
| 173 | x = m_x / m_hardwareScalerX; | - | ||||||||||||||||||
| 174 | y = m_y / m_hardwareScalerY; | - | ||||||||||||||||||
| 175 | } | - | ||||||||||||||||||
| 176 | - | |||||||||||||||||||
| 177 | if (m_prevInvalid) { | - | ||||||||||||||||||
| 178 | x = y = 0; | - | ||||||||||||||||||
| 179 | m_prevInvalid = false; | - | ||||||||||||||||||
| 180 | } | - | ||||||||||||||||||
| 181 | - | |||||||||||||||||||
| 182 | emit handleMouseEvent(x, y, m_abs, m_buttons); | - | ||||||||||||||||||
| 183 | - | |||||||||||||||||||
| 184 | m_prevx = m_x; | - | ||||||||||||||||||
| 185 | m_prevy = m_y; | - | ||||||||||||||||||
| 186 | } | - | ||||||||||||||||||
| 187 | - | |||||||||||||||||||
| 188 | void QEvdevMouseHandler::readMouseData() | - | ||||||||||||||||||
| 189 | { | - | ||||||||||||||||||
| 190 | struct ::input_event buffer[32]; | - | ||||||||||||||||||
| 191 | int n = 0; | - | ||||||||||||||||||
| 192 | bool posChanged = false, btnChanged = false; | - | ||||||||||||||||||
| 193 | bool pendingMouseEvent = false; | - | ||||||||||||||||||
| 194 | int eventCompressCount = 0; | - | ||||||||||||||||||
| 195 | forever { | - | ||||||||||||||||||
| 196 | int result = QT_READ(m_fd, reinterpret_cast<char *>(buffer) + n, sizeof(buffer) - n); | - | ||||||||||||||||||
| 197 | - | |||||||||||||||||||
| 198 | if (result == 0) {
| 0 | ||||||||||||||||||
| 199 | qWarning("evdevmouse: Got EOF from the input device"); | - | ||||||||||||||||||
| 200 | return; never executed: return; | 0 | ||||||||||||||||||
| 201 | } else if (result < 0) {
| 0 | ||||||||||||||||||
| 202 | if (errno != EINTR && errno != EAGAIN) {
| 0 | ||||||||||||||||||
| 203 | qErrnoWarning(errno, "evdevmouse: Could not read from input device"); | - | ||||||||||||||||||
| 204 | // If the device got disconnected, stop reading, otherwise we get flooded | - | ||||||||||||||||||
| 205 | // by the above error over and over again. | - | ||||||||||||||||||
| 206 | if (errno == ENODEV) {
| 0 | ||||||||||||||||||
| 207 | delete m_notify; | - | ||||||||||||||||||
| 208 | m_notify = Q_NULLPTR; | - | ||||||||||||||||||
| 209 | qt_safe_close(m_fd); | - | ||||||||||||||||||
| 210 | m_fd = -1; | - | ||||||||||||||||||
| 211 | } never executed: end of block | 0 | ||||||||||||||||||
| 212 | return; never executed: return; | 0 | ||||||||||||||||||
| 213 | } | - | ||||||||||||||||||
| 214 | } else { never executed: end of block | 0 | ||||||||||||||||||
| 215 | n += result; | - | ||||||||||||||||||
| 216 | if (n % sizeof(buffer[0]) == 0)
| 0 | ||||||||||||||||||
| 217 | break; never executed: break; | 0 | ||||||||||||||||||
| 218 | } never executed: end of block | 0 | ||||||||||||||||||
| 219 | } | - | ||||||||||||||||||
| 220 | - | |||||||||||||||||||
| 221 | n /= sizeof(buffer[0]); | - | ||||||||||||||||||
| 222 | - | |||||||||||||||||||
| 223 | for (int i = 0; i < n; ++i) {
| 0 | ||||||||||||||||||
| 224 | struct ::input_event *data = &buffer[i]; | - | ||||||||||||||||||
| 225 | if (data->type == EV_ABS) {
| 0 | ||||||||||||||||||
| 226 | // Touchpads: store the absolute position for now, will calculate a relative one later. | - | ||||||||||||||||||
| 227 | if (data->code == ABS_X && m_x != data->value) {
| 0 | ||||||||||||||||||
| 228 | m_x = data->value; | - | ||||||||||||||||||
| 229 | posChanged = true; | - | ||||||||||||||||||
| 230 | } else if (data->code == ABS_Y && m_y != data->value) { never executed: end of block
| 0 | ||||||||||||||||||
| 231 | m_y = data->value; | - | ||||||||||||||||||
| 232 | posChanged = true; | - | ||||||||||||||||||
| 233 | } never executed: end of block | 0 | ||||||||||||||||||
| 234 | } else if (data->type == EV_REL) { never executed: end of block
| 0 | ||||||||||||||||||
| 235 | if (data->code == REL_X) {
| 0 | ||||||||||||||||||
| 236 | m_x += data->value; | - | ||||||||||||||||||
| 237 | posChanged = true; | - | ||||||||||||||||||
| 238 | } else if (data->code == REL_Y) { never executed: end of block
| 0 | ||||||||||||||||||
| 239 | m_y += data->value; | - | ||||||||||||||||||
| 240 | posChanged = true; | - | ||||||||||||||||||
| 241 | } else if (data->code == ABS_WHEEL) { // vertical scroll never executed: end of block
| 0 | ||||||||||||||||||
| 242 | // data->value: 1 == up, -1 == down | - | ||||||||||||||||||
| 243 | const int delta = 120 * data->value; | - | ||||||||||||||||||
| 244 | emit handleWheelEvent(delta, Qt::Vertical); | - | ||||||||||||||||||
| 245 | } else if (data->code == ABS_THROTTLE) { // horizontal scroll never executed: end of block
| 0 | ||||||||||||||||||
| 246 | // data->value: 1 == right, -1 == left | - | ||||||||||||||||||
| 247 | const int delta = 120 * -data->value; | - | ||||||||||||||||||
| 248 | emit handleWheelEvent(delta, Qt::Horizontal); | - | ||||||||||||||||||
| 249 | } never executed: end of block | 0 | ||||||||||||||||||
| 250 | } else if (data->type == EV_KEY && data->code == BTN_TOUCH) { never executed: end of block
| 0 | ||||||||||||||||||
| 251 | // We care about touchpads only, not touchscreens -> don't map to button press. | - | ||||||||||||||||||
| 252 | // Need to invalidate prevx/y however to get proper relative pos. | - | ||||||||||||||||||
| 253 | m_prevInvalid = true; | - | ||||||||||||||||||
| 254 | } else if (data->type == EV_KEY && data->code >= BTN_LEFT && data->code <= BTN_JOYSTICK) { never executed: end of block
| 0 | ||||||||||||||||||
| 255 | Qt::MouseButton button = Qt::NoButton; | - | ||||||||||||||||||
| 256 | // BTN_LEFT == 0x110 in kernel's input.h | - | ||||||||||||||||||
| 257 | // The range of possible mouse buttons ends just before BTN_JOYSTICK, value 0x120. | - | ||||||||||||||||||
| 258 | switch (data->code) { | - | ||||||||||||||||||
| 259 | case 0x110: button = Qt::LeftButton; break; // BTN_LEFT never executed: break;never executed: case 0x110: | 0 | ||||||||||||||||||
| 260 | case 0x111: button = Qt::RightButton; break; never executed: break;never executed: case 0x111: | 0 | ||||||||||||||||||
| 261 | case 0x112: button = Qt::MiddleButton; break; never executed: break;never executed: case 0x112: | 0 | ||||||||||||||||||
| 262 | case 0x113: button = Qt::ExtraButton1; break; // AKA Qt::BackButton never executed: break;never executed: case 0x113: | 0 | ||||||||||||||||||
| 263 | case 0x114: button = Qt::ExtraButton2; break; // AKA Qt::ForwardButton never executed: break;never executed: case 0x114: | 0 | ||||||||||||||||||
| 264 | case 0x115: button = Qt::ExtraButton3; break; // AKA Qt::TaskButton never executed: break;never executed: case 0x115: | 0 | ||||||||||||||||||
| 265 | case 0x116: button = Qt::ExtraButton4; break; never executed: break;never executed: case 0x116: | 0 | ||||||||||||||||||
| 266 | case 0x117: button = Qt::ExtraButton5; break; never executed: break;never executed: case 0x117: | 0 | ||||||||||||||||||
| 267 | case 0x118: button = Qt::ExtraButton6; break; never executed: break;never executed: case 0x118: | 0 | ||||||||||||||||||
| 268 | case 0x119: button = Qt::ExtraButton7; break; never executed: break;never executed: case 0x119: | 0 | ||||||||||||||||||
| 269 | case 0x11a: button = Qt::ExtraButton8; break; never executed: break;never executed: case 0x11a: | 0 | ||||||||||||||||||
| 270 | case 0x11b: button = Qt::ExtraButton9; break; never executed: break;never executed: case 0x11b: | 0 | ||||||||||||||||||
| 271 | case 0x11c: button = Qt::ExtraButton10; break; never executed: break;never executed: case 0x11c: | 0 | ||||||||||||||||||
| 272 | case 0x11d: button = Qt::ExtraButton11; break; never executed: break;never executed: case 0x11d: | 0 | ||||||||||||||||||
| 273 | case 0x11e: button = Qt::ExtraButton12; break; never executed: break;never executed: case 0x11e: | 0 | ||||||||||||||||||
| 274 | case 0x11f: button = Qt::ExtraButton13; break; never executed: break;never executed: case 0x11f: | 0 | ||||||||||||||||||
| 275 | } | - | ||||||||||||||||||
| 276 | ifm_buttons.setFlag(button, data->value) | - | ||||||||||||||||||
| m_buttons |= button; | ||||||||||||||||||||
| else | ||||||||||||||||||||
| m_buttons &= ~button;); | ||||||||||||||||||||
| 277 | btnChanged = true; | - | ||||||||||||||||||
| 278 | } else if (data->type == EV_SYN && data->code == SYN_REPORT) { never executed: end of block
| 0 | ||||||||||||||||||
| 279 | if (btnChanged) {
| 0 | ||||||||||||||||||
| 280 | btnChanged = posChanged = false; | - | ||||||||||||||||||
| 281 | sendMouseEvent(); | - | ||||||||||||||||||
| 282 | pendingMouseEvent = false; | - | ||||||||||||||||||
| 283 | } else if (posChanged) { never executed: end of block
| 0 | ||||||||||||||||||
| 284 | posChanged = false; | - | ||||||||||||||||||
| 285 | if (m_compression) {
| 0 | ||||||||||||||||||
| 286 | pendingMouseEvent = true; | - | ||||||||||||||||||
| 287 | eventCompressCount++; | - | ||||||||||||||||||
| 288 | } else { never executed: end of block | 0 | ||||||||||||||||||
| 289 | sendMouseEvent(); | - | ||||||||||||||||||
| 290 | } never executed: end of block | 0 | ||||||||||||||||||
| 291 | } | - | ||||||||||||||||||
| 292 | } else if (data->type == EV_MSC && data->code == MSC_SCAN) { never executed: end of block
| 0 | ||||||||||||||||||
| 293 | // kernel encountered an unmapped key - just ignore it | - | ||||||||||||||||||
| 294 | continue; never executed: continue; | 0 | ||||||||||||||||||
| 295 | } | - | ||||||||||||||||||
| 296 | } never executed: end of block | 0 | ||||||||||||||||||
| 297 | if (m_compression && pendingMouseEvent) {
| 0 | ||||||||||||||||||
| 298 | int distanceSquared = (m_x - m_prevx)*(m_x - m_prevx) + (m_y - m_prevy)*(m_y - m_prevy); | - | ||||||||||||||||||
| 299 | if (distanceSquared > m_jitterLimitSquared)
| 0 | ||||||||||||||||||
| 300 | sendMouseEvent(); never executed: sendMouseEvent(); | 0 | ||||||||||||||||||
| 301 | } never executed: end of block | 0 | ||||||||||||||||||
| 302 | } never executed: end of block | 0 | ||||||||||||||||||
| 303 | - | |||||||||||||||||||
| 304 | QT_END_NAMESPACE | - | ||||||||||||||||||
| Source code | Switch to Preprocessed file |