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