| Absolute File Name: | /home/qt/qt5_coco/qt5/qtbase/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp |
| Switch to Source code | Preprocessed file |
| Line | Source | Count | ||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 | - | |||||||||||||||||||||||||
| 2 | - | |||||||||||||||||||||||||
| 3 | - | |||||||||||||||||||||||||
| 4 | - | |||||||||||||||||||||||||
| 5 | struct XInput2TouchDeviceData { | - | ||||||||||||||||||||||||
| 6 | XInput2TouchDeviceData() | - | ||||||||||||||||||||||||
| 7 | : xiDeviceInfo(0) | - | ||||||||||||||||||||||||
| 8 | , qtTouchDevice(0) | - | ||||||||||||||||||||||||
| 9 | , providesTouchOrientation(false) | - | ||||||||||||||||||||||||
| 10 | { | - | ||||||||||||||||||||||||
| 11 | } executed 540 times by 5 tests: end of blockExecuted by:
| 540 | ||||||||||||||||||||||||
| 12 | XIDeviceInfo *xiDeviceInfo; | - | ||||||||||||||||||||||||
| 13 | QTouchDevice *qtTouchDevice; | - | ||||||||||||||||||||||||
| 14 | QHash<int, QWindowSystemInterface::TouchPoint> touchPoints; | - | ||||||||||||||||||||||||
| 15 | - | |||||||||||||||||||||||||
| 16 | - | |||||||||||||||||||||||||
| 17 | QHash<int, QPointF> pointPressedPosition; | - | ||||||||||||||||||||||||
| 18 | QPointF firstPressedPosition; | - | ||||||||||||||||||||||||
| 19 | QPointF firstPressedNormalPosition; | - | ||||||||||||||||||||||||
| 20 | QSizeF size; | - | ||||||||||||||||||||||||
| 21 | bool providesTouchOrientation; | - | ||||||||||||||||||||||||
| 22 | }; | - | ||||||||||||||||||||||||
| 23 | - | |||||||||||||||||||||||||
| 24 | void QXcbConnection::initializeXInput2() | - | ||||||||||||||||||||||||
| 25 | { | - | ||||||||||||||||||||||||
| 26 | - | |||||||||||||||||||||||||
| 27 | if (qEnvironmentVariableIsSet("QT_XCB_DEBUG_XINPUT")
| 0-135 | ||||||||||||||||||||||||
| 28 | const_cast< never executed: QLoggingCategory&>(lcQpaXInput()).setEnabled(QtDebugMsg, true);const_cast<QLoggingCategory&>(lcQpaXInput()).setEnabled(QtDebugMsg, true);never executed: const_cast<QLoggingCategory&>(lcQpaXInput()).setEnabled(QtDebugMsg, true); | 0 | ||||||||||||||||||||||||
| 29 | if (qEnvironmentVariableIsSet("QT_XCB_DEBUG_XINPUT_DEVICES")
| 0-135 | ||||||||||||||||||||||||
| 30 | const_cast< never executed: QLoggingCategory&>(lcQpaXInputDevices()).setEnabled(QtDebugMsg, true);const_cast<QLoggingCategory&>(lcQpaXInputDevices()).setEnabled(QtDebugMsg, true);never executed: const_cast<QLoggingCategory&>(lcQpaXInputDevices()).setEnabled(QtDebugMsg, true); | 0 | ||||||||||||||||||||||||
| 31 | Display *xDisplay = static_cast<Display *>(m_xlib_display); | - | ||||||||||||||||||||||||
| 32 | if (XQueryExtension(xDisplay, "XInputExtension", &m_xiOpCode, &m_xiEventBase, &m_xiErrorBase)
| 0-135 | ||||||||||||||||||||||||
| 33 | int xiMajor = 2; | - | ||||||||||||||||||||||||
| 34 | m_xi2Minor = 2; | - | ||||||||||||||||||||||||
| 35 | if (XIQueryVersion(xDisplay, &xiMajor, &m_xi2Minor) == 1
| 0-135 | ||||||||||||||||||||||||
| 36 | m_xi2Minor = 1; | - | ||||||||||||||||||||||||
| 37 | if (XIQueryVersion(xDisplay, &xiMajor, &m_xi2Minor) == 1
| 0 | ||||||||||||||||||||||||
| 38 | m_xi2Minor = 0; | - | ||||||||||||||||||||||||
| 39 | m_xi2Enabled = XIQueryVersion(xDisplay, &xiMajor, &m_xi2Minor) != 1; | - | ||||||||||||||||||||||||
| 40 | } never executed: elseend of block | 0 | ||||||||||||||||||||||||
| 41 | m_xi2Enabled = true; never executed: m_xi2Enabled = true; | 0 | ||||||||||||||||||||||||
| 42 | } else | - | ||||||||||||||||||||||||
| 43 | m_xi2Enabled = true; executed 135 times by 5 tests: m_xi2Enabled = true;Executed by:
| 135 | ||||||||||||||||||||||||
| 44 | if (m_xi2Enabled
| 0-135 | ||||||||||||||||||||||||
| 45 | - | |||||||||||||||||||||||||
| 46 | for (bool qt_category_enabled = lcQpaXInputDevices().isDebugEnabled(); qt_category_enabled
never executed: QMessageLogger(__FILE__, 95, __PRETTY_FUNCTION__, lcQpaXInputDevices().categoryName()).debug("XInput version %d.%d is available and Qt supports 2.2 or greater", xiMajor, m_xi2Minor); | 0-135 | ||||||||||||||||||||||||
| 47 | - | |||||||||||||||||||||||||
| 48 | - | |||||||||||||||||||||||||
| 49 | - | |||||||||||||||||||||||||
| 50 | } executed 135 times by 5 tests: end of blockExecuted by:
| 135 | ||||||||||||||||||||||||
| 51 | - | |||||||||||||||||||||||||
| 52 | xi2SetupDevices(); | - | ||||||||||||||||||||||||
| 53 | } executed 135 times by 5 tests: end of blockExecuted by:
| 135 | ||||||||||||||||||||||||
| 54 | } executed 135 times by 5 tests: end of blockExecuted by:
| 135 | ||||||||||||||||||||||||
| 55 | - | |||||||||||||||||||||||||
| 56 | void QXcbConnection::xi2SetupDevices() | - | ||||||||||||||||||||||||
| 57 | { | - | ||||||||||||||||||||||||
| 58 | - | |||||||||||||||||||||||||
| 59 | m_tabletData.clear(); | - | ||||||||||||||||||||||||
| 60 | - | |||||||||||||||||||||||||
| 61 | m_scrollingDevices.clear(); | - | ||||||||||||||||||||||||
| 62 | - | |||||||||||||||||||||||||
| 63 | if (!m_xi2Enabled
| 0-135 | ||||||||||||||||||||||||
| 64 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 65 | - | |||||||||||||||||||||||||
| 66 | Display *xDisplay = static_cast<Display *>(m_xlib_display); | - | ||||||||||||||||||||||||
| 67 | int deviceCount = 0; | - | ||||||||||||||||||||||||
| 68 | XIDeviceInfo *devices = XIQueryDevice(xDisplay, 0, &deviceCount); | - | ||||||||||||||||||||||||
| 69 | for (int i = 0; i < deviceCount
| 135-1215 | ||||||||||||||||||||||||
| 70 | - | |||||||||||||||||||||||||
| 71 | if (devices[i].use != 3
| 540-675 | ||||||||||||||||||||||||
| 72 | continue; executed 675 times by 5 tests: continue;Executed by:
| 675 | ||||||||||||||||||||||||
| 73 | for (bool qt_category_enabled = lcQpaXInputDevices().isDebugEnabled(); qt_category_enabled
never executed: QMessageLogger(__FILE__, 122, __PRETTY_FUNCTION__, lcQpaXInputDevices().categoryName()).debug() << "input device " << devices[i].name << "ID" << devices[i].deviceid; | 0-540 | ||||||||||||||||||||||||
| 74 | - | |||||||||||||||||||||||||
| 75 | TabletData tabletData; | - | ||||||||||||||||||||||||
| 76 | - | |||||||||||||||||||||||||
| 77 | ScrollingDevice scrollingDevice; | - | ||||||||||||||||||||||||
| 78 | for (int c = 0; c < devices[i].num_classes
| 540-2700 | ||||||||||||||||||||||||
| 79 | switch (devices[i].classes[c]->type) { | - | ||||||||||||||||||||||||
| 80 | case executed 1620 times by 5 tests: 2:case 2:Executed by:
executed 1620 times by 5 tests: {case 2:Executed by:
| 1620 | ||||||||||||||||||||||||
| 81 | XIValuatorClassInfo *vci = reinterpret_cast<XIValuatorClassInfo *>(devices[i].classes[c]); | - | ||||||||||||||||||||||||
| 82 | const int valuatorAtom = qatom(vci->label); | - | ||||||||||||||||||||||||
| 83 | for (bool qt_category_enabled = lcQpaXInputDevices().isDebugEnabled(); qt_category_enabled
never executed: QMessageLogger(__FILE__, 132, __PRETTY_FUNCTION__, lcQpaXInputDevices().categoryName()).debug() << " has valuator" << atomName(vci->label) << "recognized?" << (valuatorAtom < QXcbAtom::NAtoms); | 0-1620 | ||||||||||||||||||||||||
| 84 | - | |||||||||||||||||||||||||
| 85 | if (valuatorAtom < QXcbAtom::NAtoms
| 0-1620 | ||||||||||||||||||||||||
| 86 | TabletData::ValuatorClassInfo info; | - | ||||||||||||||||||||||||
| 87 | info.minVal = vci->min; | - | ||||||||||||||||||||||||
| 88 | info.maxVal = vci->max; | - | ||||||||||||||||||||||||
| 89 | info.number = vci->number; | - | ||||||||||||||||||||||||
| 90 | tabletData.valuatorInfo[valuatorAtom] = info; | - | ||||||||||||||||||||||||
| 91 | } executed 1620 times by 5 tests: end of blockExecuted by:
| 1620 | ||||||||||||||||||||||||
| 92 | - | |||||||||||||||||||||||||
| 93 | if (valuatorAtom == QXcbAtom::RelHorizScroll
| 0-1620 | ||||||||||||||||||||||||
| 94 | scrollingDevice.lastScrollPosition.setX(vci->value); executed 270 times by 5 tests: scrollingDevice.lastScrollPosition.setX(vci->value);Executed by:
| 270 | ||||||||||||||||||||||||
| 95 | else if (valuatorAtom == QXcbAtom::RelVertScroll
| 0-1350 | ||||||||||||||||||||||||
| 96 | scrollingDevice.lastScrollPosition.setY(vci->value); executed 270 times by 5 tests: scrollingDevice.lastScrollPosition.setY(vci->value);Executed by:
| 270 | ||||||||||||||||||||||||
| 97 | break; executed 1620 times by 5 tests: break;Executed by:
| 1620 | ||||||||||||||||||||||||
| 98 | } | - | ||||||||||||||||||||||||
| 99 | - | |||||||||||||||||||||||||
| 100 | case executed 540 times by 5 tests: 3:case 3:Executed by:
executed 540 times by 5 tests: {case 3:Executed by:
| 540 | ||||||||||||||||||||||||
| 101 | XIScrollClassInfo *sci = reinterpret_cast<XIScrollClassInfo *>(devices[i].classes[c]); | - | ||||||||||||||||||||||||
| 102 | if (sci->scroll_type == 1
| 270 | ||||||||||||||||||||||||
| 103 | scrollingDevice.orientations |= Qt::Vertical; | - | ||||||||||||||||||||||||
| 104 | scrollingDevice.verticalIndex = sci->number; | - | ||||||||||||||||||||||||
| 105 | scrollingDevice.verticalIncrement = sci->increment; | - | ||||||||||||||||||||||||
| 106 | } executed 270 times by 5 tests: end of blockExecuted by:
| 270 | ||||||||||||||||||||||||
| 107 | else if (sci->scroll_type == 2
| 0-270 | ||||||||||||||||||||||||
| 108 | scrollingDevice.orientations |= Qt::Horizontal; | - | ||||||||||||||||||||||||
| 109 | scrollingDevice.horizontalIndex = sci->number; | - | ||||||||||||||||||||||||
| 110 | scrollingDevice.horizontalIncrement = sci->increment; | - | ||||||||||||||||||||||||
| 111 | } executed 270 times by 5 tests: end of blockExecuted by:
| 270 | ||||||||||||||||||||||||
| 112 | break; executed 540 times by 5 tests: break;Executed by:
| 540 | ||||||||||||||||||||||||
| 113 | } | - | ||||||||||||||||||||||||
| 114 | case executed 540 times by 5 tests: 1:case 1:Executed by:
executed 540 times by 5 tests: {case 1:Executed by:
| 540 | ||||||||||||||||||||||||
| 115 | XIButtonClassInfo *bci = reinterpret_cast<XIButtonClassInfo *>(devices[i].classes[c]); | - | ||||||||||||||||||||||||
| 116 | if (bci->num_buttons >= 5
| 0-540 | ||||||||||||||||||||||||
| 117 | Atom label4 = bci->labels[3]; | - | ||||||||||||||||||||||||
| 118 | Atom label5 = bci->labels[4]; | - | ||||||||||||||||||||||||
| 119 | - | |||||||||||||||||||||||||
| 120 | - | |||||||||||||||||||||||||
| 121 | if ((!label4
| 0-405 | ||||||||||||||||||||||||
| 122 | (!label5
| 0-540 | ||||||||||||||||||||||||
| 123 | scrollingDevice.legacyOrientations |= Qt::Vertical; executed 540 times by 5 tests: scrollingDevice.legacyOrientations |= Qt::Vertical;Executed by:
| 540 | ||||||||||||||||||||||||
| 124 | } executed 540 times by 5 tests: end of blockExecuted by:
| 540 | ||||||||||||||||||||||||
| 125 | if (bci->num_buttons >= 7
| 135-405 | ||||||||||||||||||||||||
| 126 | Atom label6 = bci->labels[5]; | - | ||||||||||||||||||||||||
| 127 | Atom label7 = bci->labels[6]; | - | ||||||||||||||||||||||||
| 128 | if ((!label6
| 0-405 | ||||||||||||||||||||||||
| 129 | scrollingDevice.legacyOrientations |= Qt::Horizontal; executed 405 times by 5 tests: scrollingDevice.legacyOrientations |= Qt::Horizontal;Executed by:
| 405 | ||||||||||||||||||||||||
| 130 | } executed 405 times by 5 tests: end of blockExecuted by:
| 405 | ||||||||||||||||||||||||
| 131 | for (bool qt_category_enabled = lcQpaXInputDevices().isDebugEnabled(); qt_category_enabled
never executed: QMessageLogger(__FILE__, 180, __PRETTY_FUNCTION__, lcQpaXInputDevices().categoryName()).debug(" has %d buttons", bci->num_buttons); | 0-540 | ||||||||||||||||||||||||
| 132 | break; executed 540 times by 5 tests: break;Executed by:
| 540 | ||||||||||||||||||||||||
| 133 | } | - | ||||||||||||||||||||||||
| 134 | - | |||||||||||||||||||||||||
| 135 | case never executed: 0:case 0:never executed: case 0: | 0 | ||||||||||||||||||||||||
| 136 | for (bool qt_category_enabled = lcQpaXInputDevices().isDebugEnabled(); qt_category_enabled
never executed: QMessageLogger(__FILE__, 185, __PRETTY_FUNCTION__, lcQpaXInputDevices().categoryName()).debug() << " it's a keyboard"; | 0 | ||||||||||||||||||||||||
| 137 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 138 | - | |||||||||||||||||||||||||
| 139 | case never executed: 8:case 8:never executed: case 8: | 0 | ||||||||||||||||||||||||
| 140 | - | |||||||||||||||||||||||||
| 141 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 142 | - | |||||||||||||||||||||||||
| 143 | default never executed: :default:never executed: default: | 0 | ||||||||||||||||||||||||
| 144 | for (bool qt_category_enabled = lcQpaXInputDevices().isDebugEnabled(); qt_category_enabled
never executed: QMessageLogger(__FILE__, 193, __PRETTY_FUNCTION__, lcQpaXInputDevices().categoryName()).debug() << " has class" << devices[i].classes[c]->type; | 0 | ||||||||||||||||||||||||
| 145 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 146 | } | - | ||||||||||||||||||||||||
| 147 | } | - | ||||||||||||||||||||||||
| 148 | bool isTablet = false; | - | ||||||||||||||||||||||||
| 149 | - | |||||||||||||||||||||||||
| 150 | - | |||||||||||||||||||||||||
| 151 | if (tabletData.valuatorInfo.contains(QXcbAtom::AbsX)
| 270 | ||||||||||||||||||||||||
| 152 | tabletData.valuatorInfo.contains(QXcbAtom::AbsY)
| 0-270 | ||||||||||||||||||||||||
| 153 | tabletData.valuatorInfo.contains(QXcbAtom::AbsPressure)
| 0-270 | ||||||||||||||||||||||||
| 154 | isTablet = true; never executed: isTablet = true; | 0 | ||||||||||||||||||||||||
| 155 | - | |||||||||||||||||||||||||
| 156 | - | |||||||||||||||||||||||||
| 157 | QByteArray name = QByteArray(devices[i].name).toLower(); | - | ||||||||||||||||||||||||
| 158 | QString dbgType = QLatin1String("UNKNOWN"); | - | ||||||||||||||||||||||||
| 159 | if (name.contains("eraser")
| 0-540 | ||||||||||||||||||||||||
| 160 | isTablet = true; | - | ||||||||||||||||||||||||
| 161 | tabletData.pointerType = QTabletEvent::Eraser; | - | ||||||||||||||||||||||||
| 162 | dbgType = QLatin1String("eraser"); | - | ||||||||||||||||||||||||
| 163 | } never executed: else if (name.contains("cursor")end of block
| 0-540 | ||||||||||||||||||||||||
| 164 | isTablet = true; | - | ||||||||||||||||||||||||
| 165 | tabletData.pointerType = QTabletEvent::Cursor; | - | ||||||||||||||||||||||||
| 166 | dbgType = QLatin1String("cursor"); | - | ||||||||||||||||||||||||
| 167 | } never executed: else if ((name.contains("pen")end of block
| 0-540 | ||||||||||||||||||||||||
| 168 | tabletData.pointerType = QTabletEvent::Pen; | - | ||||||||||||||||||||||||
| 169 | dbgType = QLatin1String("pen"); | - | ||||||||||||||||||||||||
| 170 | } never executed: else if (name.contains("wacom")end of block
| 0-540 | ||||||||||||||||||||||||
| 171 | - | |||||||||||||||||||||||||
| 172 | tabletData.pointerType = QTabletEvent::Pen; | - | ||||||||||||||||||||||||
| 173 | dbgType = QLatin1String("pen"); | - | ||||||||||||||||||||||||
| 174 | } never executed: else if (name.contains("aiptek")end of block
| 0-540 | ||||||||||||||||||||||||
| 175 | - | |||||||||||||||||||||||||
| 176 | isTablet = true; | - | ||||||||||||||||||||||||
| 177 | tabletData.pointerType = QTabletEvent::Pen; | - | ||||||||||||||||||||||||
| 178 | dbgType = QLatin1String("pen"); | - | ||||||||||||||||||||||||
| 179 | } never executed: else if (name.contains("waltop")end of block
| 0-540 | ||||||||||||||||||||||||
| 180 | - | |||||||||||||||||||||||||
| 181 | - | |||||||||||||||||||||||||
| 182 | isTablet = true; | - | ||||||||||||||||||||||||
| 183 | tabletData.pointerType = QTabletEvent::Pen; | - | ||||||||||||||||||||||||
| 184 | dbgType = QLatin1String("pen"); | - | ||||||||||||||||||||||||
| 185 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||
| 186 | isTablet = false; | - | ||||||||||||||||||||||||
| 187 | } executed 540 times by 5 tests: end of blockExecuted by:
| 540 | ||||||||||||||||||||||||
| 188 | - | |||||||||||||||||||||||||
| 189 | if (isTablet
| 0-540 | ||||||||||||||||||||||||
| 190 | tabletData.deviceId = devices[i].deviceid; | - | ||||||||||||||||||||||||
| 191 | m_tabletData.append(tabletData); | - | ||||||||||||||||||||||||
| 192 | for (bool qt_category_enabled = lcQpaXInputDevices().isDebugEnabled(); qt_category_enabled
never executed: QMessageLogger(__FILE__, 241, __PRETTY_FUNCTION__, lcQpaXInputDevices().categoryName()).debug() << " it's a tablet with pointer type" << dbgType; | 0 | ||||||||||||||||||||||||
| 193 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 194 | - | |||||||||||||||||||||||||
| 195 | - | |||||||||||||||||||||||||
| 196 | - | |||||||||||||||||||||||||
| 197 | if (scrollingDevice.orientations || scrollingDevice.legacyOrientations) { | - | ||||||||||||||||||||||||
| 198 | scrollingDevice.deviceId = devices[i].deviceid; | - | ||||||||||||||||||||||||
| 199 | - | |||||||||||||||||||||||||
| 200 | scrollingDevice.legacyOrientations &= ~scrollingDevice.orientations; | - | ||||||||||||||||||||||||
| 201 | m_scrollingDevices.insert(scrollingDevice.deviceId, scrollingDevice); | - | ||||||||||||||||||||||||
| 202 | for (bool qt_category_enabled = lcQpaXInputDevices().isDebugEnabled(); qt_category_enabled
never executed: QMessageLogger(__FILE__, 251, __PRETTY_FUNCTION__, lcQpaXInputDevices().categoryName()).debug() << " it's a scrolling device"; | 0-540 | ||||||||||||||||||||||||
| 203 | } executed 540 times by 5 tests: end of blockExecuted by:
| 540 | ||||||||||||||||||||||||
| 204 | - | |||||||||||||||||||||||||
| 205 | - | |||||||||||||||||||||||||
| 206 | if (!isTablet
| 0-540 | ||||||||||||||||||||||||
| 207 | - | |||||||||||||||||||||||||
| 208 | - | |||||||||||||||||||||||||
| 209 | XInput2TouchDeviceData *dev = touchDeviceForId(devices[i].deviceid); | - | ||||||||||||||||||||||||
| 210 | if (dev
| 0-540 | ||||||||||||||||||||||||
| 211 | if (dev->qtTouchDevice->type() == QTouchDevice::TouchScreen
| 0 | ||||||||||||||||||||||||
| 212 | for (bool qt_category_enabled = lcQpaXInputDevices().isDebugEnabled(); qt_category_enabled
never executed: QMessageLogger( __FILE__ , 263 , __PRETTY_FUNCTION__, lcQpaXInputDevices().categoryName()).debug(" it's a touchscreen with type %d capabilities 0x%X max touch points %d", dev->qtTouchDevice->type(), (unsigned int)dev->qtTouchDevice->capabilities(), dev->qtTouchDevice->maximumTouchPoints()) ; | 0 | ||||||||||||||||||||||||
| 213 | 0 | |||||||||||||||||||||||||
| 214 | __FILE__ never executed: QMessageLogger( __FILE__ , 263 , __PRETTY_FUNCTION__, lcQpaXInputDevices().categoryName()).debug(" it's a touchscreen with type %d capabilities 0x%X max touch points %d", dev->qtTouchDevice->type(), (unsigned int)dev->qtTouchDevice->capabilities(), dev->qtTouchDevice->maximumTouchPoints()) ; | 0 | ||||||||||||||||||||||||
| 215 | , never executed: QMessageLogger( __FILE__ , 263 , __PRETTY_FUNCTION__, lcQpaXInputDevices().categoryName()).debug(" it's a touchscreen with type %d capabilities 0x%X max touch points %d", dev->qtTouchDevice->type(), (unsigned int)dev->qtTouchDevice->capabilities(), dev->qtTouchDevice->maximumTouchPoints()) ; | 0 | ||||||||||||||||||||||||
| 216 | 0 | |||||||||||||||||||||||||
| 217 | 263 never executed: QMessageLogger( __FILE__ , 263 , __PRETTY_FUNCTION__, lcQpaXInputDevices().categoryName()).debug(" it's a touchscreen with type %d capabilities 0x%X max touch points %d", dev->qtTouchDevice->type(), (unsigned int)dev->qtTouchDevice->capabilities(), dev->qtTouchDevice->maximumTouchPoints()) ; | 0 | ||||||||||||||||||||||||
| 218 | , __PRETTY_FUNCTION__, lcQpaXInputDevices().categoryName()).debug(" it's a touchscreen with type %d capabilities 0x%X max touch points %d", dev->qtTouchDevice->type(), (unsigned int)dev->qtTouchDevice->capabilities(), dev->qtTouchDevice->maximumTouchPoints()) never executed: QMessageLogger( __FILE__ , 263 , __PRETTY_FUNCTION__, lcQpaXInputDevices().categoryName()).debug(" it's a touchscreen with type %d capabilities 0x%X max touch points %d", dev->qtTouchDevice->type(), (unsigned int)dev->qtTouchDevice->capabilities(), dev->qtTouchDevice->maximumTouchPoints()) ; | 0 | ||||||||||||||||||||||||
| 219 | 0 | |||||||||||||||||||||||||
| 220 | ; never executed: QMessageLogger( __FILE__ , 263 , __PRETTY_FUNCTION__, lcQpaXInputDevices().categoryName()).debug(" it's a touchscreen with type %d capabilities 0x%X max touch points %d", dev->qtTouchDevice->type(), (unsigned int)dev->qtTouchDevice->capabilities(), dev->qtTouchDevice->maximumTouchPoints()) ; | 0 | ||||||||||||||||||||||||
| 221 | else if (dev->qtTouchDevice->type() == QTouchDevice::TouchPad
| 0 | ||||||||||||||||||||||||
| 222 | for (bool qt_category_enabled = lcQpaXInputDevices().isDebugEnabled(); qt_category_enabled
never executed: QMessageLogger( __FILE__ , 268 , __PRETTY_FUNCTION__, lcQpaXInputDevices().categoryName()).debug(" it's a touchpad with type %d capabilities 0x%X max touch points %d size %f x %f", dev->qtTouchDevice->type(), (unsigned int)dev->qtTouchDevice->capabilities(), dev->qtTouchDevice->maximumTouchPoints(), dev->size.width(), dev->size.height()) ; | 0 | ||||||||||||||||||||||||
| 223 | 0 | |||||||||||||||||||||||||
| 224 | 0 | |||||||||||||||||||||||||
| 225 | __FILE__ never executed: QMessageLogger( __FILE__ , 268 , __PRETTY_FUNCTION__, lcQpaXInputDevices().categoryName()).debug(" it's a touchpad with type %d capabilities 0x%X max touch points %d size %f x %f", dev->qtTouchDevice->type(), (unsigned int)dev->qtTouchDevice->capabilities(), dev->qtTouchDevice->maximumTouchPoints(), dev->size.width(), dev->size.height()) ; | 0 | ||||||||||||||||||||||||
| 226 | , never executed: QMessageLogger( __FILE__ , 268 , __PRETTY_FUNCTION__, lcQpaXInputDevices().categoryName()).debug(" it's a touchpad with type %d capabilities 0x%X max touch points %d size %f x %f", dev->qtTouchDevice->type(), (unsigned int)dev->qtTouchDevice->capabilities(), dev->qtTouchDevice->maximumTouchPoints(), dev->size.width(), dev->size.height()) ; | 0 | ||||||||||||||||||||||||
| 227 | 0 | |||||||||||||||||||||||||
| 228 | 0 | |||||||||||||||||||||||||
| 229 | 268 never executed: QMessageLogger( __FILE__ , 268 , __PRETTY_FUNCTION__, lcQpaXInputDevices().categoryName()).debug(" it's a touchpad with type %d capabilities 0x%X max touch points %d size %f x %f", dev->qtTouchDevice->type(), (unsigned int)dev->qtTouchDevice->capabilities(), dev->qtTouchDevice->maximumTouchPoints(), dev->size.width(), dev->size.height()) ; | 0 | ||||||||||||||||||||||||
| 230 | , __PRETTY_FUNCTION__, lcQpaXInputDevices().categoryName()).debug(" it's a touchpad with type %d capabilities 0x%X max touch points %d size %f x %f", dev->qtTouchDevice->type(), (unsigned int)dev->qtTouchDevice->capabilities(), dev->qtTouchDevice->maximumTouchPoints(), dev->size.width(), dev->size.height()) never executed: QMessageLogger( __FILE__ , 268 , __PRETTY_FUNCTION__, lcQpaXInputDevices().categoryName()).debug(" it's a touchpad with type %d capabilities 0x%X max touch points %d size %f x %f", dev->qtTouchDevice->type(), (unsigned int)dev->qtTouchDevice->capabilities(), dev->qtTouchDevice->maximumTouchPoints(), dev->size.width(), dev->size.height()) ; | 0 | ||||||||||||||||||||||||
| 231 | 0 | |||||||||||||||||||||||||
| 232 | 0 | |||||||||||||||||||||||||
| 233 | ; never executed: QMessageLogger( __FILE__ , 268 , __PRETTY_FUNCTION__, lcQpaXInputDevices().categoryName()).debug(" it's a touchpad with type %d capabilities 0x%X max touch points %d size %f x %f", dev->qtTouchDevice->type(), (unsigned int)dev->qtTouchDevice->capabilities(), dev->qtTouchDevice->maximumTouchPoints(), dev->size.width(), dev->size.height()) ; | 0 | ||||||||||||||||||||||||
| 234 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 235 | } executed 540 times by 5 tests: end of blockExecuted by:
| 540 | ||||||||||||||||||||||||
| 236 | } executed 540 times by 5 tests: end of blockExecuted by:
| 540 | ||||||||||||||||||||||||
| 237 | XIFreeDeviceInfo(devices); | - | ||||||||||||||||||||||||
| 238 | } executed 135 times by 5 tests: end of blockExecuted by:
| 135 | ||||||||||||||||||||||||
| 239 | - | |||||||||||||||||||||||||
| 240 | void QXcbConnection::finalizeXInput2() | - | ||||||||||||||||||||||||
| 241 | { | - | ||||||||||||||||||||||||
| 242 | for (XInput2TouchDeviceData *dev : qAsConst(m_touchDevices)) { | - | ||||||||||||||||||||||||
| 243 | if (dev->xiDeviceInfo
| 0 | ||||||||||||||||||||||||
| 244 | XIFreeDeviceInfo(dev->xiDeviceInfo); never executed: XIFreeDeviceInfo(dev->xiDeviceInfo); | 0 | ||||||||||||||||||||||||
| 245 | delete dev; | - | ||||||||||||||||||||||||
| 246 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 247 | } executed 347 times by 219 tests: end of blockExecuted by:
| 347 | ||||||||||||||||||||||||
| 248 | - | |||||||||||||||||||||||||
| 249 | void QXcbConnection::xi2Select(xcb_window_t window) | - | ||||||||||||||||||||||||
| 250 | { | - | ||||||||||||||||||||||||
| 251 | if (!m_xi2Enabled
| 0-4107 | ||||||||||||||||||||||||
| 252 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 253 | - | |||||||||||||||||||||||||
| 254 | Display *xDisplay = static_cast<Display *>(m_xlib_display); | - | ||||||||||||||||||||||||
| 255 | unsigned int bitMask = 0; | - | ||||||||||||||||||||||||
| 256 | unsigned char *xiBitMask = reinterpret_cast<unsigned char *>(&bitMask); | - | ||||||||||||||||||||||||
| 257 | - | |||||||||||||||||||||||||
| 258 | - | |||||||||||||||||||||||||
| 259 | if (isAtLeastXI22()
| 0-4107 | ||||||||||||||||||||||||
| 260 | bitMask |= (1 << 18); | - | ||||||||||||||||||||||||
| 261 | bitMask |= (1 << 19); | - | ||||||||||||||||||||||||
| 262 | bitMask |= (1 << 20); | - | ||||||||||||||||||||||||
| 263 | bitMask |= (1 << 12); | - | ||||||||||||||||||||||||
| 264 | if (xi2MouseEvents()
| 0-4107 | ||||||||||||||||||||||||
| 265 | - | |||||||||||||||||||||||||
| 266 | - | |||||||||||||||||||||||||
| 267 | bitMask |= (1 << 4); | - | ||||||||||||||||||||||||
| 268 | bitMask |= (1 << 5); | - | ||||||||||||||||||||||||
| 269 | bitMask |= (1 << 6); | - | ||||||||||||||||||||||||
| 270 | - | |||||||||||||||||||||||||
| 271 | - | |||||||||||||||||||||||||
| 272 | bitMask |= (1 << 7); | - | ||||||||||||||||||||||||
| 273 | bitMask |= (1 << 8); | - | ||||||||||||||||||||||||
| 274 | - | |||||||||||||||||||||||||
| 275 | for (bool qt_category_enabled = lcQpaXInput().isDebugEnabled(); qt_category_enabled
never executed: QMessageLogger(__FILE__, 310, __PRETTY_FUNCTION__, lcQpaXInput().categoryName()).debug("XInput 2.2: Selecting press/release/motion events in addition to touch"); | 0-4107 | ||||||||||||||||||||||||
| 276 | } executed 4107 times by 125 tests: end of blockExecuted by:
| 4107 | ||||||||||||||||||||||||
| 277 | XIEventMask mask; | - | ||||||||||||||||||||||||
| 278 | mask.mask_len = sizeof(bitMask); | - | ||||||||||||||||||||||||
| 279 | mask.mask = xiBitMask; | - | ||||||||||||||||||||||||
| 280 | - | |||||||||||||||||||||||||
| 281 | - | |||||||||||||||||||||||||
| 282 | - | |||||||||||||||||||||||||
| 283 | mask.deviceid = 1; | - | ||||||||||||||||||||||||
| 284 | int result = XISelectEvents(xDisplay, window, &mask, 1); | - | ||||||||||||||||||||||||
| 285 | if (result == 0
| 0-4107 | ||||||||||||||||||||||||
| 286 | QWindowSystemInterfacePrivate::TabletEvent::setPlatformSynthesizesMouse(false); executed 4107 times by 125 tests: QWindowSystemInterfacePrivate::TabletEvent::setPlatformSynthesizesMouse(false);Executed by:
| 4107 | ||||||||||||||||||||||||
| 287 | else | - | ||||||||||||||||||||||||
| 288 | for (bool qt_category_enabled = lcQpaXInput().isDebugEnabled(); qt_category_enabled
never executed: QMessageLogger(__FILE__, 323, __PRETTY_FUNCTION__, lcQpaXInput().categoryName()).debug("XInput 2.2: failed to select pointer/touch events, window %x, result %d", window, result); | 0 | ||||||||||||||||||||||||
| 289 | } executed 4107 times by 125 tests: end of blockExecuted by:
| 4107 | ||||||||||||||||||||||||
| 290 | - | |||||||||||||||||||||||||
| 291 | const bool pointerSelected = isAtLeastXI22()
| 0-4107 | ||||||||||||||||||||||||
| 292 | - | |||||||||||||||||||||||||
| 293 | - | |||||||||||||||||||||||||
| 294 | - | |||||||||||||||||||||||||
| 295 | - | |||||||||||||||||||||||||
| 296 | QSet<int> tabletDevices; | - | ||||||||||||||||||||||||
| 297 | - | |||||||||||||||||||||||||
| 298 | if (!m_tabletData.isEmpty()
| 0-4107 | ||||||||||||||||||||||||
| 299 | unsigned int tabletBitMask; | - | ||||||||||||||||||||||||
| 300 | unsigned char *xiTabletBitMask = reinterpret_cast<unsigned char *>(&tabletBitMask); | - | ||||||||||||||||||||||||
| 301 | QVector<XIEventMask> xiEventMask(m_tabletData.count()); | - | ||||||||||||||||||||||||
| 302 | tabletBitMask = (1 << 12); | - | ||||||||||||||||||||||||
| 303 | if (!pointerSelected
| 0 | ||||||||||||||||||||||||
| 304 | tabletBitMask |= (1 << 4) | (1 << 5) | (1 << 6); never executed: tabletBitMask |= (1 << 4) | (1 << 5) | (1 << 6); | 0 | ||||||||||||||||||||||||
| 305 | for (int i = 0; i < m_tabletData.count()
| 0 | ||||||||||||||||||||||||
| 306 | int deviceId = m_tabletData.at(i).deviceId; | - | ||||||||||||||||||||||||
| 307 | tabletDevices.insert(deviceId); | - | ||||||||||||||||||||||||
| 308 | xiEventMask[i].deviceid = deviceId; | - | ||||||||||||||||||||||||
| 309 | xiEventMask[i].mask_len = sizeof(tabletBitMask); | - | ||||||||||||||||||||||||
| 310 | xiEventMask[i].mask = xiTabletBitMask; | - | ||||||||||||||||||||||||
| 311 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 312 | XISelectEvents(xDisplay, window, xiEventMask.data(), m_tabletData.count()); | - | ||||||||||||||||||||||||
| 313 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 314 | - | |||||||||||||||||||||||||
| 315 | - | |||||||||||||||||||||||||
| 316 | - | |||||||||||||||||||||||||
| 317 | - | |||||||||||||||||||||||||
| 318 | if (!m_scrollingDevices.isEmpty()
| 0-4107 | ||||||||||||||||||||||||
| 319 | - | |||||||||||||||||||||||||
| 320 | QVector<XIEventMask> xiEventMask(m_scrollingDevices.size()); | - | ||||||||||||||||||||||||
| 321 | unsigned int scrollBitMask; | - | ||||||||||||||||||||||||
| 322 | unsigned char *xiScrollBitMask = reinterpret_cast<unsigned char *>(&scrollBitMask); | - | ||||||||||||||||||||||||
| 323 | - | |||||||||||||||||||||||||
| 324 | scrollBitMask = (1 << 6); | - | ||||||||||||||||||||||||
| 325 | scrollBitMask |= (1 << 5); | - | ||||||||||||||||||||||||
| 326 | int i=0; | - | ||||||||||||||||||||||||
| 327 | for (const ScrollingDevice& scrollingDevice : qAsConst(m_scrollingDevices)) { | - | ||||||||||||||||||||||||
| 328 | if (tabletDevices.contains(scrollingDevice.deviceId)
| 0 | ||||||||||||||||||||||||
| 329 | continue; never executed: continue; | 0 | ||||||||||||||||||||||||
| 330 | xiEventMask[i].deviceid = scrollingDevice.deviceId; | - | ||||||||||||||||||||||||
| 331 | xiEventMask[i].mask_len = sizeof(scrollBitMask); | - | ||||||||||||||||||||||||
| 332 | xiEventMask[i].mask = xiScrollBitMask; | - | ||||||||||||||||||||||||
| 333 | i++; | - | ||||||||||||||||||||||||
| 334 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 335 | XISelectEvents(xDisplay, window, xiEventMask.data(), i); | - | ||||||||||||||||||||||||
| 336 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 337 | - | |||||||||||||||||||||||||
| 338 | - | |||||||||||||||||||||||||
| 339 | - | |||||||||||||||||||||||||
| 340 | - | |||||||||||||||||||||||||
| 341 | { | - | ||||||||||||||||||||||||
| 342 | - | |||||||||||||||||||||||||
| 343 | XIEventMask xiEventMask; | - | ||||||||||||||||||||||||
| 344 | bitMask = (1 << 11); | - | ||||||||||||||||||||||||
| 345 | bitMask |= (1 << 1); | - | ||||||||||||||||||||||||
| 346 | xiEventMask.deviceid = 0; | - | ||||||||||||||||||||||||
| 347 | xiEventMask.mask_len = sizeof(bitMask); | - | ||||||||||||||||||||||||
| 348 | xiEventMask.mask = xiBitMask; | - | ||||||||||||||||||||||||
| 349 | XISelectEvents(xDisplay, window, &xiEventMask, 1); | - | ||||||||||||||||||||||||
| 350 | } | - | ||||||||||||||||||||||||
| 351 | } executed 4107 times by 125 tests: end of blockExecuted by:
| 4107 | ||||||||||||||||||||||||
| 352 | - | |||||||||||||||||||||||||
| 353 | XInput2TouchDeviceData *QXcbConnection::touchDeviceForId(int id) | - | ||||||||||||||||||||||||
| 354 | { | - | ||||||||||||||||||||||||
| 355 | XInput2TouchDeviceData *dev = nullptr; | - | ||||||||||||||||||||||||
| 356 | QHash<int, XInput2TouchDeviceData*>::const_iterator devIt = m_touchDevices.constFind(id); | - | ||||||||||||||||||||||||
| 357 | if (devIt != m_touchDevices.cend()
| 0-540 | ||||||||||||||||||||||||
| 358 | dev = devIt.value(); | - | ||||||||||||||||||||||||
| 359 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||
| 360 | int nrDevices = 0; | - | ||||||||||||||||||||||||
| 361 | QTouchDevice::Capabilities caps = 0; | - | ||||||||||||||||||||||||
| 362 | dev = new XInput2TouchDeviceData; | - | ||||||||||||||||||||||||
| 363 | dev->xiDeviceInfo = XIQueryDevice(static_cast<Display *>(m_xlib_display), id, &nrDevices); | - | ||||||||||||||||||||||||
| 364 | if (nrDevices <= 0
| 0-540 | ||||||||||||||||||||||||
| 365 | delete dev; | - | ||||||||||||||||||||||||
| 366 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||||||||
| 367 | } | - | ||||||||||||||||||||||||
| 368 | int type = -1; | - | ||||||||||||||||||||||||
| 369 | int maxTouchPoints = 1; | - | ||||||||||||||||||||||||
| 370 | bool hasRelativeCoords = false; | - | ||||||||||||||||||||||||
| 371 | for (int i = 0; i < dev->xiDeviceInfo->num_classes
| 540-2700 | ||||||||||||||||||||||||
| 372 | XIAnyClassInfo *classinfo = dev->xiDeviceInfo->classes[i]; | - | ||||||||||||||||||||||||
| 373 | switch (classinfo->type) { | - | ||||||||||||||||||||||||
| 374 | - | |||||||||||||||||||||||||
| 375 | case never executed: 8:case 8:never executed: {case 8: | 0 | ||||||||||||||||||||||||
| 376 | XITouchClassInfo *tci = reinterpret_cast<XITouchClassInfo *>(classinfo); | - | ||||||||||||||||||||||||
| 377 | maxTouchPoints = tci->num_touches; | - | ||||||||||||||||||||||||
| 378 | for (bool qt_category_enabled = lcQpaXInputDevices().isDebugEnabled(); qt_category_enabled
never executed: QMessageLogger(__FILE__, 413, __PRETTY_FUNCTION__, lcQpaXInputDevices().categoryName()).debug(" has touch class with mode %d", tci->mode); | 0 | ||||||||||||||||||||||||
| 379 | switch (tci->mode) { | - | ||||||||||||||||||||||||
| 380 | case never executed: 2:case 2:never executed: case 2: | 0 | ||||||||||||||||||||||||
| 381 | type = QTouchDevice::TouchPad; | - | ||||||||||||||||||||||||
| 382 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 383 | case never executed: 1:case 1:never executed: case 1: | 0 | ||||||||||||||||||||||||
| 384 | type = QTouchDevice::TouchScreen; | - | ||||||||||||||||||||||||
| 385 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 386 | } | - | ||||||||||||||||||||||||
| 387 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 388 | } | - | ||||||||||||||||||||||||
| 389 | - | |||||||||||||||||||||||||
| 390 | case executed 1620 times by 5 tests: 2:case 2:Executed by:
executed 1620 times by 5 tests: {case 2:Executed by:
| 1620 | ||||||||||||||||||||||||
| 391 | XIValuatorClassInfo *vci = reinterpret_cast<XIValuatorClassInfo *>(classinfo); | - | ||||||||||||||||||||||||
| 392 | - | |||||||||||||||||||||||||
| 393 | - | |||||||||||||||||||||||||
| 394 | const int vciResolution = vci->resolution
| 810 | ||||||||||||||||||||||||
| 395 | if (vci->label == atom(QXcbAtom::AbsMTPositionX)
| 0-1620 | ||||||||||||||||||||||||
| 396 | caps |= QTouchDevice::Position | QTouchDevice::NormalizedPosition; never executed: caps |= QTouchDevice::Position | QTouchDevice::NormalizedPosition; | 0 | ||||||||||||||||||||||||
| 397 | else if (vci->label == atom(QXcbAtom::AbsMTTouchMajor)
| 0-1620 | ||||||||||||||||||||||||
| 398 | caps |= QTouchDevice::Area; never executed: caps |= QTouchDevice::Area; | 0 | ||||||||||||||||||||||||
| 399 | else if (vci->label == atom(QXcbAtom::AbsMTOrientation)
| 0-1620 | ||||||||||||||||||||||||
| 400 | dev->providesTouchOrientation = true; never executed: dev->providesTouchOrientation = true; | 0 | ||||||||||||||||||||||||
| 401 | else if (vci->label == atom(QXcbAtom::AbsMTPressure)
| 0-1620 | ||||||||||||||||||||||||
| 402 | caps |= QTouchDevice::Pressure; never executed: caps |= QTouchDevice::Pressure; | 0 | ||||||||||||||||||||||||
| 403 | else if (vci->label == atom(QXcbAtom::RelX)
| 270-1350 | ||||||||||||||||||||||||
| 404 | hasRelativeCoords = true; | - | ||||||||||||||||||||||||
| 405 | dev->size.setWidth((vci->max - vci->min) * 1000.0 / vciResolution); | - | ||||||||||||||||||||||||
| 406 | } executed 270 times by 5 tests: else if (vci->label == atom(QXcbAtom::RelY)end of blockExecuted by:
| 270-1080 | ||||||||||||||||||||||||
| 407 | hasRelativeCoords = true; | - | ||||||||||||||||||||||||
| 408 | dev->size.setHeight((vci->max - vci->min) * 1000.0 / vciResolution); | - | ||||||||||||||||||||||||
| 409 | } executed 270 times by 5 tests: else if (vci->label == atom(QXcbAtom::AbsX)end of blockExecuted by:
| 270-810 | ||||||||||||||||||||||||
| 410 | caps |= QTouchDevice::Position; | - | ||||||||||||||||||||||||
| 411 | dev->size.setHeight((vci->max - vci->min) * 1000.0 / vciResolution); | - | ||||||||||||||||||||||||
| 412 | } executed 270 times by 5 tests: else if (vci->label == atom(QXcbAtom::AbsY)end of blockExecuted by:
| 270-540 | ||||||||||||||||||||||||
| 413 | caps |= QTouchDevice::Position; | - | ||||||||||||||||||||||||
| 414 | dev->size.setWidth((vci->max - vci->min) * 1000.0 / vciResolution); | - | ||||||||||||||||||||||||
| 415 | } executed 270 times by 5 tests: end of blockExecuted by:
| 270 | ||||||||||||||||||||||||
| 416 | break; executed 1620 times by 5 tests: break;Executed by:
| 1620 | ||||||||||||||||||||||||
| 417 | } | - | ||||||||||||||||||||||||
| 418 | default executed 1080 times by 5 tests: :default:Executed by:
executed 1080 times by 5 tests: default:Executed by:
| 1080 | ||||||||||||||||||||||||
| 419 | break; executed 1080 times by 5 tests: break;Executed by:
| 1080 | ||||||||||||||||||||||||
| 420 | } | - | ||||||||||||||||||||||||
| 421 | } | - | ||||||||||||||||||||||||
| 422 | if (type < 0
| 0-540 | ||||||||||||||||||||||||
| 423 | type = QTouchDevice::TouchPad; | - | ||||||||||||||||||||||||
| 424 | if (dev->size.width() < 10
| 0 | ||||||||||||||||||||||||
| 425 | dev->size.width() > 10000
| 0 | ||||||||||||||||||||||||
| 426 | dev->size = QSizeF(130, 110); never executed: dev->size = QSizeF(130, 110); | 0 | ||||||||||||||||||||||||
| 427 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 428 | if (!isAtLeastXI22()
| 0-540 | ||||||||||||||||||||||||
| 429 | caps |= QTouchDevice::MouseEmulation; never executed: caps |= QTouchDevice::MouseEmulation; | 0 | ||||||||||||||||||||||||
| 430 | - | |||||||||||||||||||||||||
| 431 | if (type >= QTouchDevice::TouchScreen
| 0-540 | ||||||||||||||||||||||||
| 432 | dev->qtTouchDevice = new QTouchDevice; | - | ||||||||||||||||||||||||
| 433 | dev->qtTouchDevice->setName(QString::fromUtf8(dev->xiDeviceInfo->name)); | - | ||||||||||||||||||||||||
| 434 | dev->qtTouchDevice->setType((QTouchDevice::DeviceType)type); | - | ||||||||||||||||||||||||
| 435 | dev->qtTouchDevice->setCapabilities(caps); | - | ||||||||||||||||||||||||
| 436 | dev->qtTouchDevice->setMaximumTouchPoints(maxTouchPoints); | - | ||||||||||||||||||||||||
| 437 | if (caps != 0
| 0 | ||||||||||||||||||||||||
| 438 | QWindowSystemInterface::registerTouchDevice(dev->qtTouchDevice); never executed: QWindowSystemInterface::registerTouchDevice(dev->qtTouchDevice); | 0 | ||||||||||||||||||||||||
| 439 | m_touchDevices[id] = dev; | - | ||||||||||||||||||||||||
| 440 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||
| 441 | XIFreeDeviceInfo(dev->xiDeviceInfo); | - | ||||||||||||||||||||||||
| 442 | delete dev; | - | ||||||||||||||||||||||||
| 443 | dev = 0; | - | ||||||||||||||||||||||||
| 444 | } executed 540 times by 5 tests: end of blockExecuted by:
| 540 | ||||||||||||||||||||||||
| 445 | } | - | ||||||||||||||||||||||||
| 446 | return executed 540 times by 5 tests: dev;return dev;Executed by:
executed 540 times by 5 tests: return dev;Executed by:
| 540 | ||||||||||||||||||||||||
| 447 | } | - | ||||||||||||||||||||||||
| 448 | - | |||||||||||||||||||||||||
| 449 | - | |||||||||||||||||||||||||
| 450 | static inline qreal fixed1616ToReal(FP1616 val) | - | ||||||||||||||||||||||||
| 451 | { | - | ||||||||||||||||||||||||
| 452 | return never executed: qreal(val) / 0x10000;return qreal(val) / 0x10000;never executed: return qreal(val) / 0x10000; | 0 | ||||||||||||||||||||||||
| 453 | } | - | ||||||||||||||||||||||||
| 454 | - | |||||||||||||||||||||||||
| 455 | - | |||||||||||||||||||||||||
| 456 | void QXcbConnection::xi2HandleEvent(xcb_ge_event_t *event) | - | ||||||||||||||||||||||||
| 457 | { | - | ||||||||||||||||||||||||
| 458 | xi2PrepareXIGenericDeviceEvent(event); | - | ||||||||||||||||||||||||
| 459 | xXIGenericDeviceEvent *xiEvent = reinterpret_cast<xXIGenericDeviceEvent *>(event); | - | ||||||||||||||||||||||||
| 460 | int sourceDeviceId = xiEvent->deviceid; | - | ||||||||||||||||||||||||
| 461 | xXIDeviceEvent *xiDeviceEvent = 0; | - | ||||||||||||||||||||||||
| 462 | xXIEnterEvent *xiEnterEvent = 0; | - | ||||||||||||||||||||||||
| 463 | QXcbWindowEventListener *eventListener = 0; | - | ||||||||||||||||||||||||
| 464 | - | |||||||||||||||||||||||||
| 465 | switch (xiEvent->evtype) { | - | ||||||||||||||||||||||||
| 466 | case never executed: 4:case 4:never executed: case 4: | 0 | ||||||||||||||||||||||||
| 467 | case never executed: 5:case 5:never executed: case 5: | 0 | ||||||||||||||||||||||||
| 468 | case executed 464 times by 18 tests: 6:case 6:Executed by:
executed 464 times by 18 tests: case 6:Executed by:
| 464 | ||||||||||||||||||||||||
| 469 | - | |||||||||||||||||||||||||
| 470 | case never executed: 18:case 18:never executed: case 18: | 0 | ||||||||||||||||||||||||
| 471 | case never executed: 19:case 19:never executed: case 19: | 0 | ||||||||||||||||||||||||
| 472 | case never executed: 20:case 20:never executed: case 20: | 0 | ||||||||||||||||||||||||
| 473 | - | |||||||||||||||||||||||||
| 474 | { | - | ||||||||||||||||||||||||
| 475 | xiDeviceEvent = reinterpret_cast<xXIDeviceEvent *>(event); | - | ||||||||||||||||||||||||
| 476 | eventListener = windowEventListenerFromId(xiDeviceEvent->event); | - | ||||||||||||||||||||||||
| 477 | sourceDeviceId = xiDeviceEvent->sourceid; | - | ||||||||||||||||||||||||
| 478 | break; executed 464 times by 18 tests: break;Executed by:
| 464 | ||||||||||||||||||||||||
| 479 | } | - | ||||||||||||||||||||||||
| 480 | case executed 889 times by 70 tests: 7:case 7:Executed by:
executed 889 times by 70 tests: case 7:Executed by:
| 889 | ||||||||||||||||||||||||
| 481 | case executed 832 times by 58 tests: 8:case 8:Executed by:
executed 832 times by 58 tests: {case 8:Executed by:
| 832 | ||||||||||||||||||||||||
| 482 | xiEnterEvent = reinterpret_cast<xXIEnterEvent *>(event); | - | ||||||||||||||||||||||||
| 483 | eventListener = windowEventListenerFromId(xiEnterEvent->event); | - | ||||||||||||||||||||||||
| 484 | sourceDeviceId = xiEnterEvent->sourceid; | - | ||||||||||||||||||||||||
| 485 | break; executed 1721 times by 70 tests: break;Executed by:
| 1721 | ||||||||||||||||||||||||
| 486 | } | - | ||||||||||||||||||||||||
| 487 | case never executed: 11:case 11:never executed: case 11: | 0 | ||||||||||||||||||||||||
| 488 | xi2HandleHierachyEvent(xiEvent); | - | ||||||||||||||||||||||||
| 489 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 490 | case never executed: 1:case 1:never executed: case 1: | 0 | ||||||||||||||||||||||||
| 491 | xi2HandleDeviceChangedEvent(xiEvent); | - | ||||||||||||||||||||||||
| 492 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 493 | default never executed: :default:never executed: default: | 0 | ||||||||||||||||||||||||
| 494 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 495 | } | - | ||||||||||||||||||||||||
| 496 | - | |||||||||||||||||||||||||
| 497 | if (eventListener
| 866-1319 | ||||||||||||||||||||||||
| 498 | long result = 0; | - | ||||||||||||||||||||||||
| 499 | if (eventListener->handleGenericEvent(reinterpret_cast<xcb_generic_event_t *>(event), &result)
| 0-1319 | ||||||||||||||||||||||||
| 500 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 501 | } executed 1319 times by 70 tests: end of blockExecuted by:
| 1319 | ||||||||||||||||||||||||
| 502 | - | |||||||||||||||||||||||||
| 503 | - | |||||||||||||||||||||||||
| 504 | if (!xiEnterEvent
| 464-1721 | ||||||||||||||||||||||||
| 505 | QXcbConnection::TabletData *tablet = tabletDataForDevice(sourceDeviceId); | - | ||||||||||||||||||||||||
| 506 | if (tablet
| 0-464 | ||||||||||||||||||||||||
| 507 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 508 | } executed 464 times by 18 tests: end of blockExecuted by:
| 464 | ||||||||||||||||||||||||
| 509 | - | |||||||||||||||||||||||||
| 510 | - | |||||||||||||||||||||||||
| 511 | - | |||||||||||||||||||||||||
| 512 | QHash<int, ScrollingDevice>::iterator device = m_scrollingDevices.find(sourceDeviceId); | - | ||||||||||||||||||||||||
| 513 | if (device != m_scrollingDevices.end()
| 0-2185 | ||||||||||||||||||||||||
| 514 | xi2HandleScrollEvent(xiEvent, device.value()); never executed: xi2HandleScrollEvent(xiEvent, device.value()); | 0 | ||||||||||||||||||||||||
| 515 | - | |||||||||||||||||||||||||
| 516 | - | |||||||||||||||||||||||||
| 517 | - | |||||||||||||||||||||||||
| 518 | if (xiDeviceEvent
| 464-1721 | ||||||||||||||||||||||||
| 519 | switch (xiDeviceEvent->evtype) { | - | ||||||||||||||||||||||||
| 520 | case never executed: 4:case 4:never executed: case 4: | 0 | ||||||||||||||||||||||||
| 521 | case never executed: 5:case 5:never executed: case 5: | 0 | ||||||||||||||||||||||||
| 522 | case executed 464 times by 18 tests: 6:case 6:Executed by:
executed 464 times by 18 tests: case 6:Executed by:
| 464 | ||||||||||||||||||||||||
| 523 | if (xi2MouseEvents()
| 0-464 | ||||||||||||||||||||||||
| 524 | eventListener->handleXIMouseEvent(event); executed 453 times by 17 tests: eventListener->handleXIMouseEvent(event);Executed by:
| 453 | ||||||||||||||||||||||||
| 525 | break; executed 464 times by 18 tests: break;Executed by:
| 464 | ||||||||||||||||||||||||
| 526 | - | |||||||||||||||||||||||||
| 527 | case never executed: 18:case 18:never executed: case 18: | 0 | ||||||||||||||||||||||||
| 528 | case never executed: 19:case 19:never executed: case 19: | 0 | ||||||||||||||||||||||||
| 529 | case never executed: 20:case 20:never executed: case 20: | 0 | ||||||||||||||||||||||||
| 530 | if (__builtin_expect(!!(lcQpaXInputEvents().isDebugEnabled()), false)
| 0 | ||||||||||||||||||||||||
| 531 | for (bool qt_category_enabled = lcQpaXInputEvents().isDebugEnabled(); qt_category_enabled
never executed: QMessageLogger( __FILE__ , 569 , __PRETTY_FUNCTION__, lcQpaXInputEvents().categoryName()).debug("XI2 touch event type %d seq %d detail %d pos %6.1f, %6.1f root pos %6.1f, %6.1f on window %x", event->event_type, xiDeviceEvent->sequenceNumber, xiDeviceEvent->detail, fixed1616ToReal(xiDeviceEvent->event_x), fixed1616ToReal(xiDeviceEvent->event_y), fixed1616ToReal(xiDeviceEvent->root_x), fixed1616ToReal(xiDeviceEvent->root_y),xiDeviceEvent->event) ; | 0 | ||||||||||||||||||||||||
| 532 | 0 | |||||||||||||||||||||||||
| 533 | 0 | |||||||||||||||||||||||||
| 534 | __FILE__ never executed: QMessageLogger( __FILE__ , 569 , __PRETTY_FUNCTION__, lcQpaXInputEvents().categoryName()).debug("XI2 touch event type %d seq %d detail %d pos %6.1f, %6.1f root pos %6.1f, %6.1f on window %x", event->event_type, xiDeviceEvent->sequenceNumber, xiDeviceEvent->detail, fixed1616ToReal(xiDeviceEvent->event_x), fixed1616ToReal(xiDeviceEvent->event_y), fixed1616ToReal(xiDeviceEvent->root_x), fixed1616ToReal(xiDeviceEvent->root_y),xiDeviceEvent->event) ; | 0 | ||||||||||||||||||||||||
| 535 | , never executed: QMessageLogger( __FILE__ , 569 , __PRETTY_FUNCTION__, lcQpaXInputEvents().categoryName()).debug("XI2 touch event type %d seq %d detail %d pos %6.1f, %6.1f root pos %6.1f, %6.1f on window %x", event->event_type, xiDeviceEvent->sequenceNumber, xiDeviceEvent->detail, fixed1616ToReal(xiDeviceEvent->event_x), fixed1616ToReal(xiDeviceEvent->event_y), fixed1616ToReal(xiDeviceEvent->root_x), fixed1616ToReal(xiDeviceEvent->root_y),xiDeviceEvent->event) ; | 0 | ||||||||||||||||||||||||
| 536 | 0 | |||||||||||||||||||||||||
| 537 | 0 | |||||||||||||||||||||||||
| 538 | 569 never executed: QMessageLogger( __FILE__ , 569 , __PRETTY_FUNCTION__, lcQpaXInputEvents().categoryName()).debug("XI2 touch event type %d seq %d detail %d pos %6.1f, %6.1f root pos %6.1f, %6.1f on window %x", event->event_type, xiDeviceEvent->sequenceNumber, xiDeviceEvent->detail, fixed1616ToReal(xiDeviceEvent->event_x), fixed1616ToReal(xiDeviceEvent->event_y), fixed1616ToReal(xiDeviceEvent->root_x), fixed1616ToReal(xiDeviceEvent->root_y),xiDeviceEvent->event) ; | 0 | ||||||||||||||||||||||||
| 539 | , __PRETTY_FUNCTION__, lcQpaXInputEvents().categoryName()).debug("XI2 touch event type %d seq %d detail %d pos %6.1f, %6.1f root pos %6.1f, %6.1f on window %x", event->event_type, xiDeviceEvent->sequenceNumber, xiDeviceEvent->detail, fixed1616ToReal(xiDeviceEvent->event_x), fixed1616ToReal(xiDeviceEvent->event_y), fixed1616ToReal(xiDeviceEvent->root_x), fixed1616ToReal(xiDeviceEvent->root_y),xiDeviceEvent->event) never executed: QMessageLogger( __FILE__ , 569 , __PRETTY_FUNCTION__, lcQpaXInputEvents().categoryName()).debug("XI2 touch event type %d seq %d detail %d pos %6.1f, %6.1f root pos %6.1f, %6.1f on window %x", event->event_type, xiDeviceEvent->sequenceNumber, xiDeviceEvent->detail, fixed1616ToReal(xiDeviceEvent->event_x), fixed1616ToReal(xiDeviceEvent->event_y), fixed1616ToReal(xiDeviceEvent->root_x), fixed1616ToReal(xiDeviceEvent->root_y),xiDeviceEvent->event) ; | 0 | ||||||||||||||||||||||||
| 540 | 0 | |||||||||||||||||||||||||
| 541 | 0 | |||||||||||||||||||||||||
| 542 | ; never executed: QMessageLogger( __FILE__ , 569 , __PRETTY_FUNCTION__, lcQpaXInputEvents().categoryName()).debug("XI2 touch event type %d seq %d detail %d pos %6.1f, %6.1f root pos %6.1f, %6.1f on window %x", event->event_type, xiDeviceEvent->sequenceNumber, xiDeviceEvent->detail, fixed1616ToReal(xiDeviceEvent->event_x), fixed1616ToReal(xiDeviceEvent->event_y), fixed1616ToReal(xiDeviceEvent->root_x), fixed1616ToReal(xiDeviceEvent->root_y),xiDeviceEvent->event) ; | 0 | ||||||||||||||||||||||||
| 543 | if (QXcbWindow *platformWindow = platformWindowFromId(xiDeviceEvent->event)
| 0 | ||||||||||||||||||||||||
| 544 | xi2ProcessTouch(xiDeviceEvent, platformWindow); never executed: xi2ProcessTouch(xiDeviceEvent, platformWindow); | 0 | ||||||||||||||||||||||||
| 545 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 546 | } | - | ||||||||||||||||||||||||
| 547 | } executed 464 times by 18 tests: else if (xiEnterEventend of blockExecuted by:
| 0-1721 | ||||||||||||||||||||||||
| 548 | switch (xiEnterEvent->evtype) { | - | ||||||||||||||||||||||||
| 549 | case executed 719 times by 70 tests: 7:case 7:Executed by:
executed 719 times by 70 tests: case 7:Executed by:
| 719 | ||||||||||||||||||||||||
| 550 | case executed 147 times by 27 tests: 8:case 8:Executed by:
executed 147 times by 27 tests: case 8:Executed by:
| 147 | ||||||||||||||||||||||||
| 551 | eventListener->handleXIEnterLeave(event); | - | ||||||||||||||||||||||||
| 552 | break; executed 866 times by 70 tests: break;Executed by:
| 866 | ||||||||||||||||||||||||
| 553 | } | - | ||||||||||||||||||||||||
| 554 | } executed 866 times by 70 tests: end of blockExecuted by:
| 866 | ||||||||||||||||||||||||
| 555 | - | |||||||||||||||||||||||||
| 556 | } executed 2185 times by 70 tests: end of blockExecuted by:
| 2185 | ||||||||||||||||||||||||
| 557 | - | |||||||||||||||||||||||||
| 558 | - | |||||||||||||||||||||||||
| 559 | static qreal valuatorNormalized(double value, XIValuatorClassInfo *vci) | - | ||||||||||||||||||||||||
| 560 | { | - | ||||||||||||||||||||||||
| 561 | if (value > vci->max
| 0 | ||||||||||||||||||||||||
| 562 | value = vci->max; never executed: value = vci->max; | 0 | ||||||||||||||||||||||||
| 563 | if (value < vci->min
| 0 | ||||||||||||||||||||||||
| 564 | value = vci->min; never executed: value = vci->min; | 0 | ||||||||||||||||||||||||
| 565 | return never executed: (value - vci->min) / (vci->max - vci->min);return (value - vci->min) / (vci->max - vci->min);never executed: return (value - vci->min) / (vci->max - vci->min); | 0 | ||||||||||||||||||||||||
| 566 | } | - | ||||||||||||||||||||||||
| 567 | - | |||||||||||||||||||||||||
| 568 | void QXcbConnection::xi2ProcessTouch(void *xiDevEvent, QXcbWindow *platformWindow) | - | ||||||||||||||||||||||||
| 569 | { | - | ||||||||||||||||||||||||
| 570 | xXIDeviceEvent *xiDeviceEvent = static_cast<xXIDeviceEvent *>(xiDevEvent); | - | ||||||||||||||||||||||||
| 571 | XInput2TouchDeviceData *dev = touchDeviceForId(xiDeviceEvent->sourceid); | - | ||||||||||||||||||||||||
| 572 | ((!(dev)) ? qt_assert("dev",__FILE__,599) : qt_noop()); | - | ||||||||||||||||||||||||
| 573 | const bool firstTouch = dev->touchPoints.isEmpty(); | - | ||||||||||||||||||||||||
| 574 | if (xiDeviceEvent->evtype == 18
| 0 | ||||||||||||||||||||||||
| 575 | QWindowSystemInterface::TouchPoint tp; | - | ||||||||||||||||||||||||
| 576 | tp.id = xiDeviceEvent->detail % 2147483647; | - | ||||||||||||||||||||||||
| 577 | tp.state = Qt::TouchPointPressed; | - | ||||||||||||||||||||||||
| 578 | tp.pressure = -1.0; | - | ||||||||||||||||||||||||
| 579 | dev->touchPoints[tp.id] = tp; | - | ||||||||||||||||||||||||
| 580 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 581 | QWindowSystemInterface::TouchPoint &touchPoint = dev->touchPoints[xiDeviceEvent->detail]; | - | ||||||||||||||||||||||||
| 582 | QXcbScreen* screen = platformWindow->xcbScreen(); | - | ||||||||||||||||||||||||
| 583 | qreal x = fixed1616ToReal(xiDeviceEvent->root_x); | - | ||||||||||||||||||||||||
| 584 | qreal y = fixed1616ToReal(xiDeviceEvent->root_y); | - | ||||||||||||||||||||||||
| 585 | qreal nx = -1.0, ny = -1.0; | - | ||||||||||||||||||||||||
| 586 | qreal w = 0.0, h = 0.0; | - | ||||||||||||||||||||||||
| 587 | bool majorAxisIsY = touchPoint.area.height() > touchPoint.area.width(); | - | ||||||||||||||||||||||||
| 588 | for (int i = 0; i < dev->xiDeviceInfo->num_classes
| 0 | ||||||||||||||||||||||||
| 589 | XIAnyClassInfo *classinfo = dev->xiDeviceInfo->classes[i]; | - | ||||||||||||||||||||||||
| 590 | if (classinfo->type == 2
| 0 | ||||||||||||||||||||||||
| 591 | XIValuatorClassInfo *vci = reinterpret_cast<XIValuatorClassInfo *>(classinfo); | - | ||||||||||||||||||||||||
| 592 | int n = vci->number; | - | ||||||||||||||||||||||||
| 593 | double value; | - | ||||||||||||||||||||||||
| 594 | if (!xi2GetValuatorValueIfSet(xiDeviceEvent, n, &value)
| 0 | ||||||||||||||||||||||||
| 595 | continue; never executed: continue; | 0 | ||||||||||||||||||||||||
| 596 | if (__builtin_expect(!!(lcQpaXInputEvents().isDebugEnabled()), false)
| 0 | ||||||||||||||||||||||||
| 597 | for (bool qt_category_enabled = lcQpaXInputEvents().isDebugEnabled(); qt_category_enabled
never executed: QMessageLogger( __FILE__ , 625 , __PRETTY_FUNCTION__, lcQpaXInputEvents().categoryName()).debug(" valuator %20s value %lf from range %lf -> %lf", atomName(vci->label).constData(), value, vci->min, vci->max) ; | 0 | ||||||||||||||||||||||||
| 598 | __FILE__ never executed: QMessageLogger( __FILE__ , 625 , __PRETTY_FUNCTION__, lcQpaXInputEvents().categoryName()).debug(" valuator %20s value %lf from range %lf -> %lf", atomName(vci->label).constData(), value, vci->min, vci->max) ; | 0 | ||||||||||||||||||||||||
| 599 | , never executed: QMessageLogger( __FILE__ , 625 , __PRETTY_FUNCTION__, lcQpaXInputEvents().categoryName()).debug(" valuator %20s value %lf from range %lf -> %lf", atomName(vci->label).constData(), value, vci->min, vci->max) ; | 0 | ||||||||||||||||||||||||
| 600 | 625 never executed: QMessageLogger( __FILE__ , 625 , __PRETTY_FUNCTION__, lcQpaXInputEvents().categoryName()).debug(" valuator %20s value %lf from range %lf -> %lf", atomName(vci->label).constData(), value, vci->min, vci->max) ; | 0 | ||||||||||||||||||||||||
| 601 | , __PRETTY_FUNCTION__, lcQpaXInputEvents().categoryName()).debug(" valuator %20s value %lf from range %lf -> %lf", atomName(vci->label).constData(), value, vci->min, vci->max) never executed: QMessageLogger( __FILE__ , 625 , __PRETTY_FUNCTION__, lcQpaXInputEvents().categoryName()).debug(" valuator %20s value %lf from range %lf -> %lf", atomName(vci->label).constData(), value, vci->min, vci->max) ; | 0 | ||||||||||||||||||||||||
| 602 | ; never executed: QMessageLogger( __FILE__ , 625 , __PRETTY_FUNCTION__, lcQpaXInputEvents().categoryName()).debug(" valuator %20s value %lf from range %lf -> %lf", atomName(vci->label).constData(), value, vci->min, vci->max) ; | 0 | ||||||||||||||||||||||||
| 603 | if (vci->label == atom(QXcbAtom::RelX)
| 0 | ||||||||||||||||||||||||
| 604 | nx = valuatorNormalized(value, vci); | - | ||||||||||||||||||||||||
| 605 | } never executed: else if (vci->label == atom(QXcbAtom::RelY)end of block
| 0 | ||||||||||||||||||||||||
| 606 | ny = valuatorNormalized(value, vci); | - | ||||||||||||||||||||||||
| 607 | } never executed: else if (vci->label == atom(QXcbAtom::AbsX)end of block
| 0 | ||||||||||||||||||||||||
| 608 | nx = valuatorNormalized(value, vci); | - | ||||||||||||||||||||||||
| 609 | } never executed: else if (vci->label == atom(QXcbAtom::AbsY)end of block
| 0 | ||||||||||||||||||||||||
| 610 | ny = valuatorNormalized(value, vci); | - | ||||||||||||||||||||||||
| 611 | } never executed: else if (vci->label == atom(QXcbAtom::AbsMTPositionX)end of block
| 0 | ||||||||||||||||||||||||
| 612 | nx = valuatorNormalized(value, vci); | - | ||||||||||||||||||||||||
| 613 | } never executed: else if (vci->label == atom(QXcbAtom::AbsMTPositionY)end of block
| 0 | ||||||||||||||||||||||||
| 614 | ny = valuatorNormalized(value, vci); | - | ||||||||||||||||||||||||
| 615 | } never executed: else if (vci->label == atom(QXcbAtom::AbsMTTouchMajor)end of block
| 0 | ||||||||||||||||||||||||
| 616 | const qreal sw = screen->geometry().width(); | - | ||||||||||||||||||||||||
| 617 | const qreal sh = screen->geometry().height(); | - | ||||||||||||||||||||||||
| 618 | w = valuatorNormalized(value, vci) * std::sqrt(sw * sw + sh * sh); | - | ||||||||||||||||||||||||
| 619 | } never executed: else if (vci->label == atom(QXcbAtom::AbsMTTouchMinor)end of block
| 0 | ||||||||||||||||||||||||
| 620 | const qreal sw = screen->geometry().width(); | - | ||||||||||||||||||||||||
| 621 | const qreal sh = screen->geometry().height(); | - | ||||||||||||||||||||||||
| 622 | h = valuatorNormalized(value, vci) * std::sqrt(sw * sw + sh * sh); | - | ||||||||||||||||||||||||
| 623 | } never executed: else if (vci->label == atom(QXcbAtom::AbsMTOrientation)end of block
| 0 | ||||||||||||||||||||||||
| 624 | - | |||||||||||||||||||||||||
| 625 | - | |||||||||||||||||||||||||
| 626 | - | |||||||||||||||||||||||||
| 627 | - | |||||||||||||||||||||||||
| 628 | - | |||||||||||||||||||||||||
| 629 | value = qAbs(value); | - | ||||||||||||||||||||||||
| 630 | while (value > vci->max
| 0 | ||||||||||||||||||||||||
| 631 | value -= 2 * vci->max; never executed: value -= 2 * vci->max; | 0 | ||||||||||||||||||||||||
| 632 | value = qAbs(value); | - | ||||||||||||||||||||||||
| 633 | majorAxisIsY = value < vci->max - value; | - | ||||||||||||||||||||||||
| 634 | } never executed: else if (vci->label == atom(QXcbAtom::AbsMTPressure)end of block
| 0 | ||||||||||||||||||||||||
| 635 | vci->label == atom(QXcbAtom::AbsPressure)
| 0 | ||||||||||||||||||||||||
| 636 | touchPoint.pressure = valuatorNormalized(value, vci); | - | ||||||||||||||||||||||||
| 637 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 638 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 639 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 640 | - | |||||||||||||||||||||||||
| 641 | if (nx == -1.0
| 0 | ||||||||||||||||||||||||
| 642 | x = touchPoint.area.center().x(); | - | ||||||||||||||||||||||||
| 643 | nx = x / screen->geometry().width(); | - | ||||||||||||||||||||||||
| 644 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 645 | if (ny == -1.0
| 0 | ||||||||||||||||||||||||
| 646 | y = touchPoint.area.center().y(); | - | ||||||||||||||||||||||||
| 647 | ny = y / screen->geometry().height(); | - | ||||||||||||||||||||||||
| 648 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 649 | if (xiDeviceEvent->evtype != 20
| 0 | ||||||||||||||||||||||||
| 650 | if (!dev->providesTouchOrientation
| 0 | ||||||||||||||||||||||||
| 651 | if (w == 0.0
| 0 | ||||||||||||||||||||||||
| 652 | w = touchPoint.area.width(); never executed: w = touchPoint.area.width(); | 0 | ||||||||||||||||||||||||
| 653 | h = w; | - | ||||||||||||||||||||||||
| 654 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||
| 655 | if (w == 0.0
| 0 | ||||||||||||||||||||||||
| 656 | w = qMax(touchPoint.area.width(), touchPoint.area.height()); never executed: w = qMax(touchPoint.area.width(), touchPoint.area.height()); | 0 | ||||||||||||||||||||||||
| 657 | if (h == 0.0
| 0 | ||||||||||||||||||||||||
| 658 | h = qMin(touchPoint.area.width(), touchPoint.area.height()); never executed: h = qMin(touchPoint.area.width(), touchPoint.area.height()); | 0 | ||||||||||||||||||||||||
| 659 | if (majorAxisIsY
| 0 | ||||||||||||||||||||||||
| 660 | qSwap(w, h); never executed: qSwap(w, h); | 0 | ||||||||||||||||||||||||
| 661 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 662 | } | - | ||||||||||||||||||||||||
| 663 | - | |||||||||||||||||||||||||
| 664 | switch (xiDeviceEvent->evtype) { | - | ||||||||||||||||||||||||
| 665 | case never executed: 18:case 18:never executed: case 18: | 0 | ||||||||||||||||||||||||
| 666 | if (firstTouch
| 0 | ||||||||||||||||||||||||
| 667 | dev->firstPressedPosition = QPointF(x, y); | - | ||||||||||||||||||||||||
| 668 | dev->firstPressedNormalPosition = QPointF(nx, ny); | - | ||||||||||||||||||||||||
| 669 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 670 | dev->pointPressedPosition.insert(touchPoint.id, QPointF(x, y)); | - | ||||||||||||||||||||||||
| 671 | - | |||||||||||||||||||||||||
| 672 | - | |||||||||||||||||||||||||
| 673 | - | |||||||||||||||||||||||||
| 674 | if (m_xiGrab
| 0 | ||||||||||||||||||||||||
| 675 | XIAllowTouchEvents(static_cast<Display *>(m_xlib_display), xiDeviceEvent->deviceid, | - | ||||||||||||||||||||||||
| 676 | xiDeviceEvent->detail, xiDeviceEvent->event, 6); | - | ||||||||||||||||||||||||
| 677 | - | |||||||||||||||||||||||||
| 678 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 679 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 680 | case never executed: 19:case 19:never executed: case 19: | 0 | ||||||||||||||||||||||||
| 681 | if (dev->qtTouchDevice->type() == QTouchDevice::TouchPad
| 0 | ||||||||||||||||||||||||
| 682 | qreal dx = (nx - dev->firstPressedNormalPosition.x()) * | - | ||||||||||||||||||||||||
| 683 | dev->size.width() * screen->geometry().width() / screen->physicalSize().width(); | - | ||||||||||||||||||||||||
| 684 | qreal dy = (ny - dev->firstPressedNormalPosition.y()) * | - | ||||||||||||||||||||||||
| 685 | dev->size.height() * screen->geometry().height() / screen->physicalSize().height(); | - | ||||||||||||||||||||||||
| 686 | x = dev->firstPressedPosition.x() + dx; | - | ||||||||||||||||||||||||
| 687 | y = dev->firstPressedPosition.y() + dy; | - | ||||||||||||||||||||||||
| 688 | touchPoint.state = Qt::TouchPointMoved; | - | ||||||||||||||||||||||||
| 689 | } never executed: else if (touchPoint.area.center() != QPoint(x, y)end of block
| 0 | ||||||||||||||||||||||||
| 690 | touchPoint.state = Qt::TouchPointMoved; | - | ||||||||||||||||||||||||
| 691 | dev->pointPressedPosition[touchPoint.id] = QPointF(x, y); | - | ||||||||||||||||||||||||
| 692 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 693 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 694 | case never executed: 20:case 20:never executed: case 20: | 0 | ||||||||||||||||||||||||
| 695 | touchPoint.state = Qt::TouchPointReleased; | - | ||||||||||||||||||||||||
| 696 | if (dev->qtTouchDevice->type() == QTouchDevice::TouchPad
| 0 | ||||||||||||||||||||||||
| 697 | qreal dx = (nx - dev->firstPressedNormalPosition.x()) * | - | ||||||||||||||||||||||||
| 698 | dev->size.width() * screen->geometry().width() / screen->physicalSize().width(); | - | ||||||||||||||||||||||||
| 699 | qreal dy = (ny - dev->firstPressedNormalPosition.y()) * | - | ||||||||||||||||||||||||
| 700 | dev->size.width() * screen->geometry().width() / screen->physicalSize().width(); | - | ||||||||||||||||||||||||
| 701 | x = dev->firstPressedPosition.x() + dx; | - | ||||||||||||||||||||||||
| 702 | y = dev->firstPressedPosition.y() + dy; | - | ||||||||||||||||||||||||
| 703 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 704 | dev->pointPressedPosition.remove(touchPoint.id); | - | ||||||||||||||||||||||||
| 705 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 706 | touchPoint.area = QRectF(x - w/2, y - h/2, w, h); | - | ||||||||||||||||||||||||
| 707 | touchPoint.normalPosition = QPointF(nx, ny); | - | ||||||||||||||||||||||||
| 708 | - | |||||||||||||||||||||||||
| 709 | if (__builtin_expect(!!(lcQpaXInputEvents().isDebugEnabled()), false)
| 0 | ||||||||||||||||||||||||
| 710 | for (bool qt_category_enabled = lcQpaXInputEvents().isDebugEnabled(); qt_category_enabled
never executed: QMessageLogger(__FILE__, 752, __PRETTY_FUNCTION__, lcQpaXInputEvents().categoryName()).debug() << " touchpoint " << touchPoint.id << " state " << touchPoint.state << " pos norm " << touchPoint.normalPosition << " area " << touchPoint.area << " pressure " << touchPoint.pressure; | 0 | ||||||||||||||||||||||||
| 711 | " area " << touchPoint.area << " pressure " << touchPoint.pressure; never executed: QMessageLogger(__FILE__, 752, __PRETTY_FUNCTION__, lcQpaXInputEvents().categoryName()).debug() << " touchpoint " << touchPoint.id << " state " << touchPoint.state << " pos norm " << touchPoint.normalPosition << " area " << touchPoint.area << " pressure " << touchPoint.pressure; | 0 | ||||||||||||||||||||||||
| 712 | QWindowSystemInterface::handleTouchEvent(platformWindow->window(), xiDeviceEvent->time, dev->qtTouchDevice, dev->touchPoints.values()); | - | ||||||||||||||||||||||||
| 713 | if (touchPoint.state == Qt::TouchPointReleased
| 0 | ||||||||||||||||||||||||
| 714 | - | |||||||||||||||||||||||||
| 715 | dev->touchPoints.remove(touchPoint.id); never executed: dev->touchPoints.remove(touchPoint.id); | 0 | ||||||||||||||||||||||||
| 716 | else | - | ||||||||||||||||||||||||
| 717 | - | |||||||||||||||||||||||||
| 718 | - | |||||||||||||||||||||||||
| 719 | touchPoint.state = Qt::TouchPointStationary; never executed: touchPoint.state = Qt::TouchPointStationary; | 0 | ||||||||||||||||||||||||
| 720 | } | - | ||||||||||||||||||||||||
| 721 | - | |||||||||||||||||||||||||
| 722 | bool QXcbConnection::xi2SetMouseGrabEnabled(xcb_window_t w, bool grab) | - | ||||||||||||||||||||||||
| 723 | { | - | ||||||||||||||||||||||||
| 724 | if (grab
| 0-198 | ||||||||||||||||||||||||
| 725 | return never executed: false;return false;never executed: return false; | 0 | ||||||||||||||||||||||||
| 726 | - | |||||||||||||||||||||||||
| 727 | int num_devices = 0; | - | ||||||||||||||||||||||||
| 728 | Display *xDisplay = static_cast<Display *>(xlib_display()); | - | ||||||||||||||||||||||||
| 729 | XIDeviceInfo *info = XIQueryDevice(xDisplay, 1, &num_devices); | - | ||||||||||||||||||||||||
| 730 | if (!info
| 0-367 | ||||||||||||||||||||||||
| 731 | return never executed: false;return false;never executed: return false; | 0 | ||||||||||||||||||||||||
| 732 | - | |||||||||||||||||||||||||
| 733 | XIEventMask evmask; | - | ||||||||||||||||||||||||
| 734 | unsigned char mask[(((26) >> 3) + 1)]; | - | ||||||||||||||||||||||||
| 735 | evmask.mask = mask; | - | ||||||||||||||||||||||||
| 736 | evmask.mask_len = sizeof(mask); | - | ||||||||||||||||||||||||
| 737 | memset(mask, 0, sizeof(mask)); | - | ||||||||||||||||||||||||
| 738 | evmask.deviceid = 1; | - | ||||||||||||||||||||||||
| 739 | - | |||||||||||||||||||||||||
| 740 | (((unsigned char*)(mask))[(4)>>3] |= (1 << ((4) & 7))); | - | ||||||||||||||||||||||||
| 741 | (((unsigned char*)(mask))[(5)>>3] |= (1 << ((5) & 7))); | - | ||||||||||||||||||||||||
| 742 | (((unsigned char*)(mask))[(6)>>3] |= (1 << ((6) & 7))); | - | ||||||||||||||||||||||||
| 743 | (((unsigned char*)(mask))[(7)>>3] |= (1 << ((7) & 7))); | - | ||||||||||||||||||||||||
| 744 | (((unsigned char*)(mask))[(8)>>3] |= (1 << ((8) & 7))); | - | ||||||||||||||||||||||||
| 745 | (((unsigned char*)(mask))[(18)>>3] |= (1 << ((18) & 7))); | - | ||||||||||||||||||||||||
| 746 | (((unsigned char*)(mask))[(19)>>3] |= (1 << ((19) & 7))); | - | ||||||||||||||||||||||||
| 747 | (((unsigned char*)(mask))[(20)>>3] |= (1 << ((20) & 7))); | - | ||||||||||||||||||||||||
| 748 | - | |||||||||||||||||||||||||
| 749 | bool grabbed = true; | - | ||||||||||||||||||||||||
| 750 | for (int i = 0; i < num_devices
| 367-734 | ||||||||||||||||||||||||
| 751 | int id = info[i].deviceid, n = 0; | - | ||||||||||||||||||||||||
| 752 | XIDeviceInfo *deviceInfo = XIQueryDevice(xDisplay, id, &n); | - | ||||||||||||||||||||||||
| 753 | if (deviceInfo
| 0-734 | ||||||||||||||||||||||||
| 754 | const bool grabbable = deviceInfo->use != 2; | - | ||||||||||||||||||||||||
| 755 | XIFreeDeviceInfo(deviceInfo); | - | ||||||||||||||||||||||||
| 756 | if (!grabbable
| 367 | ||||||||||||||||||||||||
| 757 | continue; executed 367 times by 21 tests: continue;Executed by:
| 367 | ||||||||||||||||||||||||
| 758 | } executed 367 times by 21 tests: end of blockExecuted by:
| 367 | ||||||||||||||||||||||||
| 759 | if (!grab
| 169-198 | ||||||||||||||||||||||||
| 760 | int result = XIUngrabDevice(xDisplay, id, 0L); | - | ||||||||||||||||||||||||
| 761 | if (result != 0
| 0-169 | ||||||||||||||||||||||||
| 762 | grabbed = false; | - | ||||||||||||||||||||||||
| 763 | for (bool qt_category_enabled = lcQpaXInput().isDebugEnabled(); qt_category_enabled
never executed: QMessageLogger(__FILE__, 805, __PRETTY_FUNCTION__, lcQpaXInput().categoryName()).debug("XInput 2.2: failed to ungrab events for device %d (result %d)", id, result); | 0 | ||||||||||||||||||||||||
| 764 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 765 | } executed 169 times by 21 tests: else {end of blockExecuted by:
| 169 | ||||||||||||||||||||||||
| 766 | int result = XIGrabDevice(xDisplay, id, w, 0L, 0L, 1, | - | ||||||||||||||||||||||||
| 767 | 1, 0, &evmask); | - | ||||||||||||||||||||||||
| 768 | if (result != 0
| 0-198 | ||||||||||||||||||||||||
| 769 | grabbed = false; | - | ||||||||||||||||||||||||
| 770 | for (bool qt_category_enabled = lcQpaXInput().isDebugEnabled(); qt_category_enabled
never executed: QMessageLogger(__FILE__, 812, __PRETTY_FUNCTION__, lcQpaXInput().categoryName()).debug("XInput 2.2: failed to grab events for device %d on window %x (result %d)", id, w, result); | 0 | ||||||||||||||||||||||||
| 771 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 772 | } executed 198 times by 21 tests: end of blockExecuted by:
| 198 | ||||||||||||||||||||||||
| 773 | } | - | ||||||||||||||||||||||||
| 774 | - | |||||||||||||||||||||||||
| 775 | XIFreeDeviceInfo(info); | - | ||||||||||||||||||||||||
| 776 | - | |||||||||||||||||||||||||
| 777 | m_xiGrab = grabbed; | - | ||||||||||||||||||||||||
| 778 | - | |||||||||||||||||||||||||
| 779 | return executed 367 times by 21 tests: grabbed;return grabbed;Executed by:
executed 367 times by 21 tests: return grabbed;Executed by:
| 367 | ||||||||||||||||||||||||
| 780 | } | - | ||||||||||||||||||||||||
| 781 | - | |||||||||||||||||||||||||
| 782 | - | |||||||||||||||||||||||||
| 783 | void QXcbConnection::xi2HandleHierachyEvent(void *event) | - | ||||||||||||||||||||||||
| 784 | { | - | ||||||||||||||||||||||||
| 785 | xXIHierarchyEvent *xiEvent = reinterpret_cast<xXIHierarchyEvent *>(event); | - | ||||||||||||||||||||||||
| 786 | - | |||||||||||||||||||||||||
| 787 | if (!(xiEvent->flags & ((1 << 3) | (1 << 2)))
| 0 | ||||||||||||||||||||||||
| 788 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 789 | xi2SetupDevices(); | - | ||||||||||||||||||||||||
| 790 | - | |||||||||||||||||||||||||
| 791 | for (auto it = m_mapper.cbegin(), end = m_mapper.cend(); it != end
| 0 | ||||||||||||||||||||||||
| 792 | xi2Select(it.key()); never executed: xi2Select(it.key()); | 0 | ||||||||||||||||||||||||
| 793 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 794 | - | |||||||||||||||||||||||||
| 795 | void QXcbConnection::xi2HandleDeviceChangedEvent(void *event) | - | ||||||||||||||||||||||||
| 796 | { | - | ||||||||||||||||||||||||
| 797 | xXIDeviceChangedEvent *xiEvent = reinterpret_cast<xXIDeviceChangedEvent *>(event); | - | ||||||||||||||||||||||||
| 798 | - | |||||||||||||||||||||||||
| 799 | - | |||||||||||||||||||||||||
| 800 | if (xiEvent->reason != 1
| 0 | ||||||||||||||||||||||||
| 801 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 802 | - | |||||||||||||||||||||||||
| 803 | - | |||||||||||||||||||||||||
| 804 | - | |||||||||||||||||||||||||
| 805 | - | |||||||||||||||||||||||||
| 806 | - | |||||||||||||||||||||||||
| 807 | - | |||||||||||||||||||||||||
| 808 | - | |||||||||||||||||||||||||
| 809 | QHash<int, ScrollingDevice>::iterator device = m_scrollingDevices.find(xiEvent->sourceid); | - | ||||||||||||||||||||||||
| 810 | if (device == m_scrollingDevices.end()
| 0 | ||||||||||||||||||||||||
| 811 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 812 | - | |||||||||||||||||||||||||
| 813 | int nrDevices = 0; | - | ||||||||||||||||||||||||
| 814 | XIDeviceInfo* xiDeviceInfo = XIQueryDevice(static_cast<Display *>(m_xlib_display), xiEvent->sourceid, &nrDevices); | - | ||||||||||||||||||||||||
| 815 | if (nrDevices <= 0
| 0 | ||||||||||||||||||||||||
| 816 | for (bool qt_category_enabled = lcQpaXInputDevices().isDebugEnabled(); qt_category_enabled
never executed: QMessageLogger(__FILE__, 858, __PRETTY_FUNCTION__, lcQpaXInputDevices().categoryName()).debug("scrolling device %d no longer present", xiEvent->sourceid); | 0 | ||||||||||||||||||||||||
| 817 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 818 | } | - | ||||||||||||||||||||||||
| 819 | updateScrollingDevice(*device, xiDeviceInfo->num_classes, xiDeviceInfo->classes); | - | ||||||||||||||||||||||||
| 820 | XIFreeDeviceInfo(xiDeviceInfo); | - | ||||||||||||||||||||||||
| 821 | - | |||||||||||||||||||||||||
| 822 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 823 | - | |||||||||||||||||||||||||
| 824 | void QXcbConnection::updateScrollingDevice(ScrollingDevice &scrollingDevice, int num_classes, void *classInfo) | - | ||||||||||||||||||||||||
| 825 | { | - | ||||||||||||||||||||||||
| 826 | - | |||||||||||||||||||||||||
| 827 | XIAnyClassInfo **classes = reinterpret_cast<XIAnyClassInfo**>(classInfo); | - | ||||||||||||||||||||||||
| 828 | QPointF lastScrollPosition; | - | ||||||||||||||||||||||||
| 829 | if (lcQpaXInput().isDebugEnabled()
| 0-2852 | ||||||||||||||||||||||||
| 830 | lastScrollPosition = scrollingDevice.lastScrollPosition; never executed: lastScrollPosition = scrollingDevice.lastScrollPosition; | 0 | ||||||||||||||||||||||||
| 831 | for (int c = 0; c < num_classes
| 2852-14260 | ||||||||||||||||||||||||
| 832 | if (classes[c]->type == 2
| 5704-8556 | ||||||||||||||||||||||||
| 833 | XIValuatorClassInfo *vci = reinterpret_cast<XIValuatorClassInfo *>(classes[c]); | - | ||||||||||||||||||||||||
| 834 | const int valuatorAtom = qatom(vci->label); | - | ||||||||||||||||||||||||
| 835 | if (valuatorAtom == QXcbAtom::RelHorizScroll
| 0-8556 | ||||||||||||||||||||||||
| 836 | scrollingDevice.lastScrollPosition.setX(vci->value); executed 1426 times by 70 tests: scrollingDevice.lastScrollPosition.setX(vci->value);Executed by:
| 1426 | ||||||||||||||||||||||||
| 837 | else if (valuatorAtom == QXcbAtom::RelVertScroll
| 0-7130 | ||||||||||||||||||||||||
| 838 | scrollingDevice.lastScrollPosition.setY(vci->value); executed 1426 times by 70 tests: scrollingDevice.lastScrollPosition.setY(vci->value);Executed by:
| 1426 | ||||||||||||||||||||||||
| 839 | } executed 8556 times by 70 tests: end of blockExecuted by:
| 8556 | ||||||||||||||||||||||||
| 840 | } executed 14260 times by 70 tests: end of blockExecuted by:
| 14260 | ||||||||||||||||||||||||
| 841 | if (__builtin_expect(!!(lcQpaXInputEvents().isDebugEnabled() && lastScrollPosition != scrollingDevice.lastScrollPosition), false)
| 0-2852 | ||||||||||||||||||||||||
| 842 | for (bool qt_category_enabled = lcQpaXInputEvents().isDebugEnabled(); qt_category_enabled
never executed: QMessageLogger( __FILE__ , 887 , __PRETTY_FUNCTION__, lcQpaXInputEvents().categoryName()).debug("scrolling device %d moved from (%f, %f) to (%f, %f)", scrollingDevice.deviceId, lastScrollPosition.x(), lastScrollPosition.y(), scrollingDevice.lastScrollPosition.x(), scrollingDevice.lastScrollPosition.y()) ; | 0 | ||||||||||||||||||||||||
| 843 | 0 | |||||||||||||||||||||||||
| 844 | 0 | |||||||||||||||||||||||||
| 845 | __FILE__ never executed: QMessageLogger( __FILE__ , 887 , __PRETTY_FUNCTION__, lcQpaXInputEvents().categoryName()).debug("scrolling device %d moved from (%f, %f) to (%f, %f)", scrollingDevice.deviceId, lastScrollPosition.x(), lastScrollPosition.y(), scrollingDevice.lastScrollPosition.x(), scrollingDevice.lastScrollPosition.y()) ; | 0 | ||||||||||||||||||||||||
| 846 | , never executed: QMessageLogger( __FILE__ , 887 , __PRETTY_FUNCTION__, lcQpaXInputEvents().categoryName()).debug("scrolling device %d moved from (%f, %f) to (%f, %f)", scrollingDevice.deviceId, lastScrollPosition.x(), lastScrollPosition.y(), scrollingDevice.lastScrollPosition.x(), scrollingDevice.lastScrollPosition.y()) ; | 0 | ||||||||||||||||||||||||
| 847 | 0 | |||||||||||||||||||||||||
| 848 | 0 | |||||||||||||||||||||||||
| 849 | 887 never executed: QMessageLogger( __FILE__ , 887 , __PRETTY_FUNCTION__, lcQpaXInputEvents().categoryName()).debug("scrolling device %d moved from (%f, %f) to (%f, %f)", scrollingDevice.deviceId, lastScrollPosition.x(), lastScrollPosition.y(), scrollingDevice.lastScrollPosition.x(), scrollingDevice.lastScrollPosition.y()) ; | 0 | ||||||||||||||||||||||||
| 850 | , __PRETTY_FUNCTION__, lcQpaXInputEvents().categoryName()).debug("scrolling device %d moved from (%f, %f) to (%f, %f)", scrollingDevice.deviceId, lastScrollPosition.x(), lastScrollPosition.y(), scrollingDevice.lastScrollPosition.x(), scrollingDevice.lastScrollPosition.y()) never executed: QMessageLogger( __FILE__ , 887 , __PRETTY_FUNCTION__, lcQpaXInputEvents().categoryName()).debug("scrolling device %d moved from (%f, %f) to (%f, %f)", scrollingDevice.deviceId, lastScrollPosition.x(), lastScrollPosition.y(), scrollingDevice.lastScrollPosition.x(), scrollingDevice.lastScrollPosition.y()) ; | 0 | ||||||||||||||||||||||||
| 851 | 0 | |||||||||||||||||||||||||
| 852 | 0 | |||||||||||||||||||||||||
| 853 | ; never executed: QMessageLogger( __FILE__ , 887 , __PRETTY_FUNCTION__, lcQpaXInputEvents().categoryName()).debug("scrolling device %d moved from (%f, %f) to (%f, %f)", scrollingDevice.deviceId, lastScrollPosition.x(), lastScrollPosition.y(), scrollingDevice.lastScrollPosition.x(), scrollingDevice.lastScrollPosition.y()) ; | 0 | ||||||||||||||||||||||||
| 854 | - | |||||||||||||||||||||||||
| 855 | - | |||||||||||||||||||||||||
| 856 | - | |||||||||||||||||||||||||
| 857 | - | |||||||||||||||||||||||||
| 858 | - | |||||||||||||||||||||||||
| 859 | } executed 2852 times by 70 tests: end of blockExecuted by:
| 2852 | ||||||||||||||||||||||||
| 860 | - | |||||||||||||||||||||||||
| 861 | - | |||||||||||||||||||||||||
| 862 | void QXcbConnection::handleEnterEvent() | - | ||||||||||||||||||||||||
| 863 | { | - | ||||||||||||||||||||||||
| 864 | QHash<int, ScrollingDevice>::iterator it = m_scrollingDevices.begin(); | - | ||||||||||||||||||||||||
| 865 | const QHash<int, ScrollingDevice>::iterator end = m_scrollingDevices.end(); | - | ||||||||||||||||||||||||
| 866 | while (it != end
| 713-2852 | ||||||||||||||||||||||||
| 867 | ScrollingDevice& scrollingDevice = it.value(); | - | ||||||||||||||||||||||||
| 868 | int nrDevices = 0; | - | ||||||||||||||||||||||||
| 869 | XIDeviceInfo* xiDeviceInfo = XIQueryDevice(static_cast<Display *>(m_xlib_display), scrollingDevice.deviceId, &nrDevices); | - | ||||||||||||||||||||||||
| 870 | if (nrDevices <= 0
| 0-2852 | ||||||||||||||||||||||||
| 871 | for (bool qt_category_enabled = lcQpaXInputDevices().isDebugEnabled(); qt_category_enabled
never executed: QMessageLogger(__FILE__, 905, __PRETTY_FUNCTION__, lcQpaXInputDevices().categoryName()).debug("scrolling device %d no longer present", scrollingDevice.deviceId); | 0 | ||||||||||||||||||||||||
| 872 | it = m_scrollingDevices.erase(it); | - | ||||||||||||||||||||||||
| 873 | continue; never executed: continue; | 0 | ||||||||||||||||||||||||
| 874 | } | - | ||||||||||||||||||||||||
| 875 | updateScrollingDevice(scrollingDevice, xiDeviceInfo->num_classes, xiDeviceInfo->classes); | - | ||||||||||||||||||||||||
| 876 | XIFreeDeviceInfo(xiDeviceInfo); | - | ||||||||||||||||||||||||
| 877 | ++it; | - | ||||||||||||||||||||||||
| 878 | } executed 2852 times by 70 tests: end of blockExecuted by:
| 2852 | ||||||||||||||||||||||||
| 879 | } executed 713 times by 70 tests: end of blockExecuted by:
| 713 | ||||||||||||||||||||||||
| 880 | - | |||||||||||||||||||||||||
| 881 | - | |||||||||||||||||||||||||
| 882 | void QXcbConnection::xi2HandleScrollEvent(void *event, ScrollingDevice &scrollingDevice) | - | ||||||||||||||||||||||||
| 883 | { | - | ||||||||||||||||||||||||
| 884 | - | |||||||||||||||||||||||||
| 885 | xXIGenericDeviceEvent *xiEvent = reinterpret_cast<xXIGenericDeviceEvent *>(event); | - | ||||||||||||||||||||||||
| 886 | - | |||||||||||||||||||||||||
| 887 | if (xiEvent->evtype == 6
| 0 | ||||||||||||||||||||||||
| 888 | xXIDeviceEvent* xiDeviceEvent = reinterpret_cast<xXIDeviceEvent *>(event); | - | ||||||||||||||||||||||||
| 889 | if (QXcbWindow *platformWindow = platformWindowFromId(xiDeviceEvent->event)
| 0 | ||||||||||||||||||||||||
| 890 | QPoint rawDelta; | - | ||||||||||||||||||||||||
| 891 | QPoint angleDelta; | - | ||||||||||||||||||||||||
| 892 | double value; | - | ||||||||||||||||||||||||
| 893 | if (scrollingDevice.orientations & Qt::Vertical
| 0 | ||||||||||||||||||||||||
| 894 | if (xi2GetValuatorValueIfSet(xiDeviceEvent, scrollingDevice.verticalIndex, &value)
| 0 | ||||||||||||||||||||||||
| 895 | double delta = scrollingDevice.lastScrollPosition.y() - value; | - | ||||||||||||||||||||||||
| 896 | scrollingDevice.lastScrollPosition.setY(value); | - | ||||||||||||||||||||||||
| 897 | angleDelta.setY((delta / scrollingDevice.verticalIncrement) * 120); | - | ||||||||||||||||||||||||
| 898 | - | |||||||||||||||||||||||||
| 899 | if (scrollingDevice.verticalIncrement > 1
| 0 | ||||||||||||||||||||||||
| 900 | rawDelta.setY(delta); never executed: rawDelta.setY(delta); | 0 | ||||||||||||||||||||||||
| 901 | else if (scrollingDevice.verticalIncrement < -1
| 0 | ||||||||||||||||||||||||
| 902 | rawDelta.setY(-delta); never executed: rawDelta.setY(-delta); | 0 | ||||||||||||||||||||||||
| 903 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 904 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 905 | if (scrollingDevice.orientations & Qt::Horizontal
| 0 | ||||||||||||||||||||||||
| 906 | if (xi2GetValuatorValueIfSet(xiDeviceEvent, scrollingDevice.horizontalIndex, &value)
| 0 | ||||||||||||||||||||||||
| 907 | double delta = scrollingDevice.lastScrollPosition.x() - value; | - | ||||||||||||||||||||||||
| 908 | scrollingDevice.lastScrollPosition.setX(value); | - | ||||||||||||||||||||||||
| 909 | angleDelta.setX((delta / scrollingDevice.horizontalIncrement) * 120); | - | ||||||||||||||||||||||||
| 910 | - | |||||||||||||||||||||||||
| 911 | if (scrollingDevice.horizontalIncrement > 1
| 0 | ||||||||||||||||||||||||
| 912 | rawDelta.setX(delta); never executed: rawDelta.setX(delta); | 0 | ||||||||||||||||||||||||
| 913 | else if (scrollingDevice.horizontalIncrement < -1
| 0 | ||||||||||||||||||||||||
| 914 | rawDelta.setX(-delta); never executed: rawDelta.setX(-delta); | 0 | ||||||||||||||||||||||||
| 915 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 916 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 917 | if (!angleDelta.isNull()
| 0 | ||||||||||||||||||||||||
| 918 | QPoint local(fixed1616ToReal(xiDeviceEvent->event_x), fixed1616ToReal(xiDeviceEvent->event_y)); | - | ||||||||||||||||||||||||
| 919 | QPoint global(fixed1616ToReal(xiDeviceEvent->root_x), fixed1616ToReal(xiDeviceEvent->root_y)); | - | ||||||||||||||||||||||||
| 920 | Qt::KeyboardModifiers modifiers = keyboard()->translateModifiers(xiDeviceEvent->mods.effective_mods); | - | ||||||||||||||||||||||||
| 921 | if (modifiers & Qt::AltModifier
| 0 | ||||||||||||||||||||||||
| 922 | std::swap(angleDelta.rx(), angleDelta.ry()); | - | ||||||||||||||||||||||||
| 923 | std::swap(rawDelta.rx(), rawDelta.ry()); | - | ||||||||||||||||||||||||
| 924 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 925 | QWindowSystemInterface::handleWheelEvent(platformWindow->window(), xiEvent->time, local, global, rawDelta, angleDelta, modifiers); | - | ||||||||||||||||||||||||
| 926 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 927 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 928 | } never executed: else if (xiEvent->evtype == 5end of block
| 0 | ||||||||||||||||||||||||
| 929 | xXIDeviceEvent* xiDeviceEvent = reinterpret_cast<xXIDeviceEvent *>(event); | - | ||||||||||||||||||||||||
| 930 | if (QXcbWindow *platformWindow = platformWindowFromId(xiDeviceEvent->event)
| 0 | ||||||||||||||||||||||||
| 931 | QPoint angleDelta; | - | ||||||||||||||||||||||||
| 932 | if (scrollingDevice.legacyOrientations & Qt::Vertical
| 0 | ||||||||||||||||||||||||
| 933 | if (xiDeviceEvent->detail == 4
| 0 | ||||||||||||||||||||||||
| 934 | angleDelta.setY(120); never executed: angleDelta.setY(120); | 0 | ||||||||||||||||||||||||
| 935 | else if (xiDeviceEvent->detail == 5
| 0 | ||||||||||||||||||||||||
| 936 | angleDelta.setY(-120); never executed: angleDelta.setY(-120); | 0 | ||||||||||||||||||||||||
| 937 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 938 | if (scrollingDevice.legacyOrientations & Qt::Horizontal
| 0 | ||||||||||||||||||||||||
| 939 | if (xiDeviceEvent->detail == 6
| 0 | ||||||||||||||||||||||||
| 940 | angleDelta.setX(120); never executed: angleDelta.setX(120); | 0 | ||||||||||||||||||||||||
| 941 | else if (xiDeviceEvent->detail == 7
| 0 | ||||||||||||||||||||||||
| 942 | angleDelta.setX(-120); never executed: angleDelta.setX(-120); | 0 | ||||||||||||||||||||||||
| 943 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 944 | if (!angleDelta.isNull()
| 0 | ||||||||||||||||||||||||
| 945 | QPoint local(fixed1616ToReal(xiDeviceEvent->event_x), fixed1616ToReal(xiDeviceEvent->event_y)); | - | ||||||||||||||||||||||||
| 946 | QPoint global(fixed1616ToReal(xiDeviceEvent->root_x), fixed1616ToReal(xiDeviceEvent->root_y)); | - | ||||||||||||||||||||||||
| 947 | Qt::KeyboardModifiers modifiers = keyboard()->translateModifiers(xiDeviceEvent->mods.effective_mods); | - | ||||||||||||||||||||||||
| 948 | if (modifiers & Qt::AltModifier
| 0 | ||||||||||||||||||||||||
| 949 | std::swap(angleDelta.rx(), angleDelta.ry()); never executed: std::swap(angleDelta.rx(), angleDelta.ry()); | 0 | ||||||||||||||||||||||||
| 950 | QWindowSystemInterface::handleWheelEvent(platformWindow->window(), xiEvent->time, local, global, QPoint(), angleDelta, modifiers); | - | ||||||||||||||||||||||||
| 951 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 952 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 953 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 954 | - | |||||||||||||||||||||||||
| 955 | - | |||||||||||||||||||||||||
| 956 | - | |||||||||||||||||||||||||
| 957 | - | |||||||||||||||||||||||||
| 958 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 959 | - | |||||||||||||||||||||||||
| 960 | Qt::MouseButton QXcbConnection::xiToQtMouseButton(uint32_t b) | - | ||||||||||||||||||||||||
| 961 | { | - | ||||||||||||||||||||||||
| 962 | switch (b) { | - | ||||||||||||||||||||||||
| 963 | case never executed: 1:case 1:never executed: returncase 1:never executed: Qt::LeftButton;return Qt::LeftButton;never executed: return Qt::LeftButton; | 0 | ||||||||||||||||||||||||
| 964 | case never executed: 2:case 2:never executed: returncase 2:never executed: Qt::MiddleButton;return Qt::MiddleButton;never executed: return Qt::MiddleButton; | 0 | ||||||||||||||||||||||||
| 965 | case never executed: 3:case 3:never executed: returncase 3:never executed: Qt::RightButton;return Qt::RightButton;never executed: return Qt::RightButton; | 0 | ||||||||||||||||||||||||
| 966 | - | |||||||||||||||||||||||||
| 967 | default executed 453 times by 17 tests: :default:Executed by:
executed 453 times by 17 tests: break;default:Executed by:
executed 453 times by 17 tests: break;Executed by:
| 453 | ||||||||||||||||||||||||
| 968 | } | - | ||||||||||||||||||||||||
| 969 | if (b >= 8
| 0-453 | ||||||||||||||||||||||||
| 970 | return never executed: static_cast<Qt::MouseButton>(Qt::BackButton << (b - 8));return static_cast<Qt::MouseButton>(Qt::BackButton << (b - 8));never executed: return static_cast<Qt::MouseButton>(Qt::BackButton << (b - 8)); | 0 | ||||||||||||||||||||||||
| 971 | return executed 453 times by 17 tests: Qt::NoButton;return Qt::NoButton;Executed by:
executed 453 times by 17 tests: return Qt::NoButton;Executed by:
| 453 | ||||||||||||||||||||||||
| 972 | } | - | ||||||||||||||||||||||||
| 973 | - | |||||||||||||||||||||||||
| 974 | static QTabletEvent::TabletDevice toolIdToTabletDevice(quint32 toolId) { | - | ||||||||||||||||||||||||
| 975 | - | |||||||||||||||||||||||||
| 976 | switch (toolId) { | - | ||||||||||||||||||||||||
| 977 | case never executed: 0xd12:case 0xd12:never executed: case 0xd12: | 0 | ||||||||||||||||||||||||
| 978 | case never executed: 0x912:case 0x912:never executed: case 0x912: | 0 | ||||||||||||||||||||||||
| 979 | case never executed: 0x112:case 0x112:never executed: case 0x112: | 0 | ||||||||||||||||||||||||
| 980 | case never executed: 0x913:case 0x913:never executed: case 0x913: | 0 | ||||||||||||||||||||||||
| 981 | case never executed: 0x91b:case 0x91b:never executed: case 0x91b: | 0 | ||||||||||||||||||||||||
| 982 | case never executed: 0x902:case 0x902:never executed: case 0x902: | 0 | ||||||||||||||||||||||||
| 983 | case never executed: 0x90a:case 0x90a:never executed: case 0x90a: | 0 | ||||||||||||||||||||||||
| 984 | case never executed: 0x100902:case 0x100902:never executed: case 0x100902: | 0 | ||||||||||||||||||||||||
| 985 | case never executed: 0x10090a:case 0x10090a:never executed: case 0x10090a: | 0 | ||||||||||||||||||||||||
| 986 | return never executed: QTabletEvent::Airbrush;return QTabletEvent::Airbrush;never executed: return QTabletEvent::Airbrush; | 0 | ||||||||||||||||||||||||
| 987 | case never executed: 0x007:case 0x007:never executed: case 0x007: | 0 | ||||||||||||||||||||||||
| 988 | case never executed: 0x09c:case 0x09c:never executed: case 0x09c: | 0 | ||||||||||||||||||||||||
| 989 | case never executed: 0x094:case 0x094:never executed: case 0x094: | 0 | ||||||||||||||||||||||||
| 990 | return never executed: QTabletEvent::FourDMouse;return QTabletEvent::FourDMouse;never executed: return QTabletEvent::FourDMouse; | 0 | ||||||||||||||||||||||||
| 991 | case never executed: 0x017:case 0x017:never executed: case 0x017: | 0 | ||||||||||||||||||||||||
| 992 | case never executed: 0x806:case 0x806:never executed: case 0x806: | 0 | ||||||||||||||||||||||||
| 993 | case never executed: 0x096:case 0x096:never executed: case 0x096: | 0 | ||||||||||||||||||||||||
| 994 | case never executed: 0x097:case 0x097:never executed: case 0x097: | 0 | ||||||||||||||||||||||||
| 995 | case never executed: 0x006:case 0x006:never executed: case 0x006: | 0 | ||||||||||||||||||||||||
| 996 | return never executed: QTabletEvent::Puck;return QTabletEvent::Puck;never executed: return QTabletEvent::Puck; | 0 | ||||||||||||||||||||||||
| 997 | case never executed: 0x885:case 0x885:never executed: case 0x885: | 0 | ||||||||||||||||||||||||
| 998 | case never executed: 0x100804:case 0x100804:never executed: case 0x100804: | 0 | ||||||||||||||||||||||||
| 999 | case never executed: 0x10080c:case 0x10080c:never executed: case 0x10080c: | 0 | ||||||||||||||||||||||||
| 1000 | return never executed: QTabletEvent::RotationStylus;return QTabletEvent::RotationStylus;never executed: return QTabletEvent::RotationStylus; | 0 | ||||||||||||||||||||||||
| 1001 | case never executed: 0:case 0:never executed: case 0: | 0 | ||||||||||||||||||||||||
| 1002 | return never executed: QTabletEvent::NoDevice;return QTabletEvent::NoDevice;never executed: return QTabletEvent::NoDevice; | 0 | ||||||||||||||||||||||||
| 1003 | } | - | ||||||||||||||||||||||||
| 1004 | return never executed: QTabletEvent::Stylus;return QTabletEvent::Stylus;never executed: return QTabletEvent::Stylus; | 0 | ||||||||||||||||||||||||
| 1005 | } | - | ||||||||||||||||||||||||
| 1006 | - | |||||||||||||||||||||||||
| 1007 | - | |||||||||||||||||||||||||
| 1008 | bool QXcbConnection::xi2HandleTabletEvent(const void *event, TabletData *tabletData) | - | ||||||||||||||||||||||||
| 1009 | { | - | ||||||||||||||||||||||||
| 1010 | bool handled = true; | - | ||||||||||||||||||||||||
| 1011 | Display *xDisplay = static_cast<Display *>(m_xlib_display); | - | ||||||||||||||||||||||||
| 1012 | const xXIGenericDeviceEvent *xiEvent = static_cast<const xXIGenericDeviceEvent *>(event); | - | ||||||||||||||||||||||||
| 1013 | const xXIDeviceEvent *xiDeviceEvent = reinterpret_cast<const xXIDeviceEvent *>(xiEvent); | - | ||||||||||||||||||||||||
| 1014 | - | |||||||||||||||||||||||||
| 1015 | switch (xiEvent->evtype) { | - | ||||||||||||||||||||||||
| 1016 | case never executed: 4:case 4:never executed: {case 4: | 0 | ||||||||||||||||||||||||
| 1017 | Qt::MouseButton b = xiToQtMouseButton(xiDeviceEvent->detail); | - | ||||||||||||||||||||||||
| 1018 | tabletData->buttons |= b; | - | ||||||||||||||||||||||||
| 1019 | xi2ReportTabletEvent(xiEvent, tabletData); | - | ||||||||||||||||||||||||
| 1020 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 1021 | } | - | ||||||||||||||||||||||||
| 1022 | case never executed: 5:case 5:never executed: {case 5: | 0 | ||||||||||||||||||||||||
| 1023 | Qt::MouseButton b = xiToQtMouseButton(xiDeviceEvent->detail); | - | ||||||||||||||||||||||||
| 1024 | tabletData->buttons ^= b; | - | ||||||||||||||||||||||||
| 1025 | xi2ReportTabletEvent(xiEvent, tabletData); | - | ||||||||||||||||||||||||
| 1026 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 1027 | } | - | ||||||||||||||||||||||||
| 1028 | case never executed: 6:case 6:never executed: case 6: | 0 | ||||||||||||||||||||||||
| 1029 | - | |||||||||||||||||||||||||
| 1030 | - | |||||||||||||||||||||||||
| 1031 | if (tabletData->buttons != Qt::NoButton
| 0 | ||||||||||||||||||||||||
| 1032 | xi2ReportTabletEvent(xiEvent, tabletData); never executed: xi2ReportTabletEvent(xiEvent, tabletData); | 0 | ||||||||||||||||||||||||
| 1033 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 1034 | case never executed: 12:case 12:never executed: {case 12: | 0 | ||||||||||||||||||||||||
| 1035 | - | |||||||||||||||||||||||||
| 1036 | - | |||||||||||||||||||||||||
| 1037 | const xXIPropertyEvent *ev = reinterpret_cast<const xXIPropertyEvent *>(event); | - | ||||||||||||||||||||||||
| 1038 | if (ev->what == 2
| 0 | ||||||||||||||||||||||||
| 1039 | if (ev->property == atom(QXcbAtom::WacomSerialIDs)
| 0 | ||||||||||||||||||||||||
| 1040 | enum WacomSerialIndex { | - | ||||||||||||||||||||||||
| 1041 | _WACSER_USB_ID = 0, | - | ||||||||||||||||||||||||
| 1042 | _WACSER_LAST_TOOL_SERIAL, | - | ||||||||||||||||||||||||
| 1043 | _WACSER_LAST_TOOL_ID, | - | ||||||||||||||||||||||||
| 1044 | _WACSER_TOOL_SERIAL, | - | ||||||||||||||||||||||||
| 1045 | _WACSER_TOOL_ID, | - | ||||||||||||||||||||||||
| 1046 | _WACSER_COUNT | - | ||||||||||||||||||||||||
| 1047 | }; | - | ||||||||||||||||||||||||
| 1048 | Atom propType; | - | ||||||||||||||||||||||||
| 1049 | int propFormat; | - | ||||||||||||||||||||||||
| 1050 | unsigned long numItems, bytesAfter; | - | ||||||||||||||||||||||||
| 1051 | unsigned char *data; | - | ||||||||||||||||||||||||
| 1052 | if (XIGetProperty(xDisplay, tabletData->deviceId, ev->property, 0, 100,
| 0 | ||||||||||||||||||||||||
| 1053 | 0, 0L, &propType, &propFormat,
| 0 | ||||||||||||||||||||||||
| 1054 | &numItems, &bytesAfter, &data) == 0
| 0 | ||||||||||||||||||||||||
| 1055 | if (propType == atom(QXcbAtom::INTEGER)
| 0 | ||||||||||||||||||||||||
| 1056 | quint32 *ptr = reinterpret_cast<quint32 *>(data); | - | ||||||||||||||||||||||||
| 1057 | quint32 tool = ptr[_WACSER_TOOL_ID]; | - | ||||||||||||||||||||||||
| 1058 | - | |||||||||||||||||||||||||
| 1059 | - | |||||||||||||||||||||||||
| 1060 | if (!tool
| 0 | ||||||||||||||||||||||||
| 1061 | tool = ptr[_WACSER_TOOL_SERIAL]; never executed: tool = ptr[_WACSER_TOOL_SERIAL]; | 0 | ||||||||||||||||||||||||
| 1062 | - | |||||||||||||||||||||||||
| 1063 | - | |||||||||||||||||||||||||
| 1064 | if (tool
| 0 | ||||||||||||||||||||||||
| 1065 | tabletData->inProximity = true; | - | ||||||||||||||||||||||||
| 1066 | tabletData->tool = toolIdToTabletDevice(tool); | - | ||||||||||||||||||||||||
| 1067 | tabletData->serialId = qint64(ptr[_WACSER_USB_ID]) << 32 | qint64(ptr[_WACSER_TOOL_SERIAL]); | - | ||||||||||||||||||||||||
| 1068 | QWindowSystemInterface::handleTabletEnterProximityEvent(ev->time, | - | ||||||||||||||||||||||||
| 1069 | tabletData->tool, tabletData->pointerType, tabletData->serialId); | - | ||||||||||||||||||||||||
| 1070 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||
| 1071 | tabletData->inProximity = false; | - | ||||||||||||||||||||||||
| 1072 | tabletData->tool = toolIdToTabletDevice(ptr[_WACSER_LAST_TOOL_ID]); | - | ||||||||||||||||||||||||
| 1073 | - | |||||||||||||||||||||||||
| 1074 | - | |||||||||||||||||||||||||
| 1075 | if (!tabletData->tool
| 0 | ||||||||||||||||||||||||
| 1076 | tabletData->tool = toolIdToTabletDevice(ptr[_WACSER_LAST_TOOL_SERIAL]); never executed: tabletData->tool = toolIdToTabletDevice(ptr[_WACSER_LAST_TOOL_SERIAL]); | 0 | ||||||||||||||||||||||||
| 1077 | tabletData->serialId = qint64(ptr[_WACSER_USB_ID]) << 32 | qint64(ptr[_WACSER_LAST_TOOL_SERIAL]); | - | ||||||||||||||||||||||||
| 1078 | QWindowSystemInterface::handleTabletLeaveProximityEvent(ev->time, | - | ||||||||||||||||||||||||
| 1079 | tabletData->tool, tabletData->pointerType, tabletData->serialId); | - | ||||||||||||||||||||||||
| 1080 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1081 | - | |||||||||||||||||||||||||
| 1082 | - | |||||||||||||||||||||||||
| 1083 | if (__builtin_expect(!!(lcQpaXInputEvents().isDebugEnabled()), false)
| 0 | ||||||||||||||||||||||||
| 1084 | for (bool qt_category_enabled = lcQpaXInputEvents().isDebugEnabled(); qt_category_enabled
never executed: QMessageLogger( __FILE__ , 1120 , __PRETTY_FUNCTION__, lcQpaXInputEvents().categoryName()).debug("XI2 proximity change on tablet %d (USB %x): last tool: %x id %x current tool: %x id %x TabletDevice %d", tabletData->deviceId, ptr[_WACSER_USB_ID], ptr[_WACSER_LAST_TOOL_SERIAL], ptr[_WACSER_LAST_TOOL_ID], ptr[_WACSER_TOOL_SERIAL], ptr[_WACSER_TOOL_ID], tabletData->tool) ; | 0 | ||||||||||||||||||||||||
| 1085 | 0 | |||||||||||||||||||||||||
| 1086 | __FILE__ never executed: QMessageLogger( __FILE__ , 1120 , __PRETTY_FUNCTION__, lcQpaXInputEvents().categoryName()).debug("XI2 proximity change on tablet %d (USB %x): last tool: %x id %x current tool: %x id %x TabletDevice %d", tabletData->deviceId, ptr[_WACSER_USB_ID], ptr[_WACSER_LAST_TOOL_SERIAL], ptr[_WACSER_LAST_TOOL_ID], ptr[_WACSER_TOOL_SERIAL], ptr[_WACSER_TOOL_ID], tabletData->tool) ; | 0 | ||||||||||||||||||||||||
| 1087 | , never executed: QMessageLogger( __FILE__ , 1120 , __PRETTY_FUNCTION__, lcQpaXInputEvents().categoryName()).debug("XI2 proximity change on tablet %d (USB %x): last tool: %x id %x current tool: %x id %x TabletDevice %d", tabletData->deviceId, ptr[_WACSER_USB_ID], ptr[_WACSER_LAST_TOOL_SERIAL], ptr[_WACSER_LAST_TOOL_ID], ptr[_WACSER_TOOL_SERIAL], ptr[_WACSER_TOOL_ID], tabletData->tool) ; | 0 | ||||||||||||||||||||||||
| 1088 | 0 | |||||||||||||||||||||||||
| 1089 | 1120 never executed: QMessageLogger( __FILE__ , 1120 , __PRETTY_FUNCTION__, lcQpaXInputEvents().categoryName()).debug("XI2 proximity change on tablet %d (USB %x): last tool: %x id %x current tool: %x id %x TabletDevice %d", tabletData->deviceId, ptr[_WACSER_USB_ID], ptr[_WACSER_LAST_TOOL_SERIAL], ptr[_WACSER_LAST_TOOL_ID], ptr[_WACSER_TOOL_SERIAL], ptr[_WACSER_TOOL_ID], tabletData->tool) ; | 0 | ||||||||||||||||||||||||
| 1090 | , __PRETTY_FUNCTION__, lcQpaXInputEvents().categoryName()).debug("XI2 proximity change on tablet %d (USB %x): last tool: %x id %x current tool: %x id %x TabletDevice %d", tabletData->deviceId, ptr[_WACSER_USB_ID], ptr[_WACSER_LAST_TOOL_SERIAL], ptr[_WACSER_LAST_TOOL_ID], ptr[_WACSER_TOOL_SERIAL], ptr[_WACSER_TOOL_ID], tabletData->tool) never executed: QMessageLogger( __FILE__ , 1120 , __PRETTY_FUNCTION__, lcQpaXInputEvents().categoryName()).debug("XI2 proximity change on tablet %d (USB %x): last tool: %x id %x current tool: %x id %x TabletDevice %d", tabletData->deviceId, ptr[_WACSER_USB_ID], ptr[_WACSER_LAST_TOOL_SERIAL], ptr[_WACSER_LAST_TOOL_ID], ptr[_WACSER_TOOL_SERIAL], ptr[_WACSER_TOOL_ID], tabletData->tool) ; | 0 | ||||||||||||||||||||||||
| 1091 | 0 | |||||||||||||||||||||||||
| 1092 | ; never executed: QMessageLogger( __FILE__ , 1120 , __PRETTY_FUNCTION__, lcQpaXInputEvents().categoryName()).debug("XI2 proximity change on tablet %d (USB %x): last tool: %x id %x current tool: %x id %x TabletDevice %d", tabletData->deviceId, ptr[_WACSER_USB_ID], ptr[_WACSER_LAST_TOOL_SERIAL], ptr[_WACSER_LAST_TOOL_ID], ptr[_WACSER_TOOL_SERIAL], ptr[_WACSER_TOOL_ID], tabletData->tool) ; | 0 | ||||||||||||||||||||||||
| 1093 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1094 | XFree(data); | - | ||||||||||||||||||||||||
| 1095 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1096 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1097 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1098 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 1099 | } | - | ||||||||||||||||||||||||
| 1100 | default never executed: :default:never executed: default: | 0 | ||||||||||||||||||||||||
| 1101 | handled = false; | - | ||||||||||||||||||||||||
| 1102 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 1103 | } | - | ||||||||||||||||||||||||
| 1104 | - | |||||||||||||||||||||||||
| 1105 | return never executed: handled;return handled;never executed: return handled; | 0 | ||||||||||||||||||||||||
| 1106 | } | - | ||||||||||||||||||||||||
| 1107 | - | |||||||||||||||||||||||||
| 1108 | void QXcbConnection::xi2ReportTabletEvent(const void *event, TabletData *tabletData) | - | ||||||||||||||||||||||||
| 1109 | { | - | ||||||||||||||||||||||||
| 1110 | const xXIDeviceEvent *ev = reinterpret_cast<const xXIDeviceEvent *>(event); | - | ||||||||||||||||||||||||
| 1111 | QXcbWindow *xcbWindow = platformWindowFromId(ev->event); | - | ||||||||||||||||||||||||
| 1112 | if (!xcbWindow
| 0 | ||||||||||||||||||||||||
| 1113 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 1114 | QWindow *window = xcbWindow->window(); | - | ||||||||||||||||||||||||
| 1115 | const double scale = 65536.0; | - | ||||||||||||||||||||||||
| 1116 | QPointF local(ev->event_x / scale, ev->event_y / scale); | - | ||||||||||||||||||||||||
| 1117 | QPointF global(ev->root_x / scale, ev->root_y / scale); | - | ||||||||||||||||||||||||
| 1118 | double pressure = 0, rotation = 0, tangentialPressure = 0; | - | ||||||||||||||||||||||||
| 1119 | int xTilt = 0, yTilt = 0; | - | ||||||||||||||||||||||||
| 1120 | - | |||||||||||||||||||||||||
| 1121 | for (QHash<int, TabletData::ValuatorClassInfo>::iterator it = tabletData->valuatorInfo.begin(), | - | ||||||||||||||||||||||||
| 1122 | ite = tabletData->valuatorInfo.end(); it != ite
| 0 | ||||||||||||||||||||||||
| 1123 | int valuator = it.key(); | - | ||||||||||||||||||||||||
| 1124 | TabletData::ValuatorClassInfo &classInfo(it.value()); | - | ||||||||||||||||||||||||
| 1125 | xi2GetValuatorValueIfSet(event, classInfo.number, &classInfo.curVal); | - | ||||||||||||||||||||||||
| 1126 | double normalizedValue = (classInfo.curVal - classInfo.minVal) / (classInfo.maxVal - classInfo.minVal); | - | ||||||||||||||||||||||||
| 1127 | switch (valuator) { | - | ||||||||||||||||||||||||
| 1128 | case never executed: QXcbAtom::AbsPressure:case QXcbAtom::AbsPressure:never executed: case QXcbAtom::AbsPressure: | 0 | ||||||||||||||||||||||||
| 1129 | pressure = normalizedValue; | - | ||||||||||||||||||||||||
| 1130 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 1131 | case never executed: QXcbAtom::AbsTiltX:case QXcbAtom::AbsTiltX:never executed: case QXcbAtom::AbsTiltX: | 0 | ||||||||||||||||||||||||
| 1132 | xTilt = classInfo.curVal; | - | ||||||||||||||||||||||||
| 1133 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 1134 | case never executed: QXcbAtom::AbsTiltY:case QXcbAtom::AbsTiltY:never executed: case QXcbAtom::AbsTiltY: | 0 | ||||||||||||||||||||||||
| 1135 | yTilt = classInfo.curVal; | - | ||||||||||||||||||||||||
| 1136 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 1137 | case never executed: QXcbAtom::AbsWheel:case QXcbAtom::AbsWheel:never executed: case QXcbAtom::AbsWheel: | 0 | ||||||||||||||||||||||||
| 1138 | switch (tabletData->tool) { | - | ||||||||||||||||||||||||
| 1139 | case never executed: QTabletEvent::Airbrush:case QTabletEvent::Airbrush:never executed: case QTabletEvent::Airbrush: | 0 | ||||||||||||||||||||||||
| 1140 | tangentialPressure = normalizedValue * 2.0 - 1.0; | - | ||||||||||||||||||||||||
| 1141 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 1142 | case never executed: QTabletEvent::RotationStylus:case QTabletEvent::RotationStylus:never executed: case QTabletEvent::RotationStylus: | 0 | ||||||||||||||||||||||||
| 1143 | rotation = normalizedValue * 360.0 - 180.0; | - | ||||||||||||||||||||||||
| 1144 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 1145 | default never executed: :default:never executed: default: | 0 | ||||||||||||||||||||||||
| 1146 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 1147 | } | - | ||||||||||||||||||||||||
| 1148 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 1149 | default never executed: :default:never executed: default: | 0 | ||||||||||||||||||||||||
| 1150 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 1151 | } | - | ||||||||||||||||||||||||
| 1152 | } | - | ||||||||||||||||||||||||
| 1153 | - | |||||||||||||||||||||||||
| 1154 | if (__builtin_expect(!!(lcQpaXInputEvents().isDebugEnabled()), false)
| 0 | ||||||||||||||||||||||||
| 1155 | for (bool qt_category_enabled = lcQpaXInputEvents().isDebugEnabled(); qt_category_enabled
never executed: QMessageLogger( __FILE__ , 1188 , __PRETTY_FUNCTION__, lcQpaXInputEvents().categoryName()).debug("XI2 event on tablet %d with tool %d type %d seq %d detail %d time %d " "pos %6.1f, %6.1f root pos %6.1f, %6.1f buttons 0x%x pressure %4.2lf tilt %d, %d rotat...Id, tabletData->tool, ev->evtype, ev->sequenceNumber, ev->detail, ev->time, fixed1616ToReal(ev->event_x), fixed1616ToReal(ev->event_y), fixed1616ToReal(ev->root_x), fixed1616ToReal(ev->root_y), (int)tabletData->buttons, pressure, xTilt, yTilt, rotation) ; | 0 | ||||||||||||||||||||||||
| 1156 | 0 | |||||||||||||||||||||||||
| 1157 | 0 | |||||||||||||||||||||||||
| 1158 | 0 | |||||||||||||||||||||||||
| 1159 | 0 | |||||||||||||||||||||||||
| 1160 | __FILE__ never executed: QMessageLogger( __FILE__ , 1188 , __PRETTY_FUNCTION__, lcQpaXInputEvents().categoryName()).debug("XI2 event on tablet %d with tool %d type %d seq %d detail %d time %d " "pos %6.1f, %6.1f root pos %6.1f, %6.1f buttons 0x%x pressure %4.2lf tilt %d, %d rotat...Id, tabletData->tool, ev->evtype, ev->sequenceNumber, ev->detail, ev->time, fixed1616ToReal(ev->event_x), fixed1616ToReal(ev->event_y), fixed1616ToReal(ev->root_x), fixed1616ToReal(ev->root_y), (int)tabletData->buttons, pressure, xTilt, yTilt, rotation) ; | 0 | ||||||||||||||||||||||||
| 1161 | , never executed: QMessageLogger( __FILE__ , 1188 , __PRETTY_FUNCTION__, lcQpaXInputEvents().categoryName()).debug("XI2 event on tablet %d with tool %d type %d seq %d detail %d time %d " "pos %6.1f, %6.1f root pos %6.1f, %6.1f buttons 0x%x pressure %4.2lf tilt %d, %d rotat...Id, tabletData->tool, ev->evtype, ev->sequenceNumber, ev->detail, ev->time, fixed1616ToReal(ev->event_x), fixed1616ToReal(ev->event_y), fixed1616ToReal(ev->root_x), fixed1616ToReal(ev->root_y), (int)tabletData->buttons, pressure, xTilt, yTilt, rotation) ; | 0 | ||||||||||||||||||||||||
| 1162 | 0 | |||||||||||||||||||||||||
| 1163 | 0 | |||||||||||||||||||||||||
| 1164 | 0 | |||||||||||||||||||||||||
| 1165 | 0 | |||||||||||||||||||||||||
| 1166 | 1188 never executed: QMessageLogger( __FILE__ , 1188 , __PRETTY_FUNCTION__, lcQpaXInputEvents().categoryName()).debug("XI2 event on tablet %d with tool %d type %d seq %d detail %d time %d " "pos %6.1f, %6.1f root pos %6.1f, %6.1f buttons 0x%x pressure %4.2lf tilt %d, %d rotat...Id, tabletData->tool, ev->evtype, ev->sequenceNumber, ev->detail, ev->time, fixed1616ToReal(ev->event_x), fixed1616ToReal(ev->event_y), fixed1616ToReal(ev->root_x), fixed1616ToReal(ev->root_y), (int)tabletData->buttons, pressure, xTilt, yTilt, rotation) ; | 0 | ||||||||||||||||||||||||
| 1167 | , __PRETTY_FUNCTION__, lcQpaXInputEvents().categoryName()).debug("XI2 event on tablet %d with tool %d type %d seq %d detail %d time %d " "pos %6.1f, %6.1f root pos %6.1f, %6.1f buttons 0x%x pressure %4.2lf tilt %d, %d rotation %6.2lf", tabletData->deviceId, tabletData->tool, ev->evtype, ev->sequenceNumber, ev->detail, ev->time, fixed1616ToReal(ev->event_x), fixed1616ToReal(ev->event_y), fixed1616ToReal(ev->root_x), fixed1616ToReal(ev->root_y), (int)tabletData->buttons, pressure, xTilt, yTilt, rotation) never executed: QMessageLogger( __FILE__ , 1188 , __PRETTY_FUNCTION__, lcQpaXInputEvents().categoryName()).debug("XI2 event on tablet %d with tool %d type %d seq %d detail %d time %d " "pos %6.1f, %6.1f root pos %6.1f, %6.1f buttons 0x%x pressure %4.2lf tilt %d, %d rotat...Id, tabletData->tool, ev->evtype, ev->sequenceNumber, ev->detail, ev->time, fixed1616ToReal(ev->event_x), fixed1616ToReal(ev->event_y), fixed1616ToReal(ev->root_x), fixed1616ToReal(ev->root_y), (int)tabletData->buttons, pressure, xTilt, yTilt, rotation) ; | 0 | ||||||||||||||||||||||||
| 1168 | 0 | |||||||||||||||||||||||||
| 1169 | 0 | |||||||||||||||||||||||||
| 1170 | 0 | |||||||||||||||||||||||||
| 1171 | 0 | |||||||||||||||||||||||||
| 1172 | ; never executed: QMessageLogger( __FILE__ , 1188 , __PRETTY_FUNCTION__, lcQpaXInputEvents().categoryName()).debug("XI2 event on tablet %d with tool %d type %d seq %d detail %d time %d " "pos %6.1f, %6.1f root pos %6.1f, %6.1f buttons 0x%x pressure %4.2lf tilt %d, %d rotat...Id, tabletData->tool, ev->evtype, ev->sequenceNumber, ev->detail, ev->time, fixed1616ToReal(ev->event_x), fixed1616ToReal(ev->event_y), fixed1616ToReal(ev->root_x), fixed1616ToReal(ev->root_y), (int)tabletData->buttons, pressure, xTilt, yTilt, rotation) ; | 0 | ||||||||||||||||||||||||
| 1173 | - | |||||||||||||||||||||||||
| 1174 | QWindowSystemInterface::handleTabletEvent(window, ev->time, local, global, | - | ||||||||||||||||||||||||
| 1175 | tabletData->tool, tabletData->pointerType, | - | ||||||||||||||||||||||||
| 1176 | tabletData->buttons, pressure, | - | ||||||||||||||||||||||||
| 1177 | xTilt, yTilt, tangentialPressure, | - | ||||||||||||||||||||||||
| 1178 | rotation, 0, tabletData->serialId); | - | ||||||||||||||||||||||||
| 1179 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1180 | - | |||||||||||||||||||||||||
| 1181 | QXcbConnection::TabletData *QXcbConnection::tabletDataForDevice(int id) | - | ||||||||||||||||||||||||
| 1182 | { | - | ||||||||||||||||||||||||
| 1183 | for (int i = 0; i < m_tabletData.count()
| 0-944 | ||||||||||||||||||||||||
| 1184 | if (m_tabletData.at(i).deviceId == id
| 0 | ||||||||||||||||||||||||
| 1185 | return never executed: &m_tabletData[i];return &m_tabletData[i];never executed: return &m_tabletData[i]; | 0 | ||||||||||||||||||||||||
| 1186 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1187 | return executed 944 times by 18 tests: nullptr;return nullptr;Executed by:
executed 944 times by 18 tests: return nullptr;Executed by:
| 944 | ||||||||||||||||||||||||
| 1188 | } | - | ||||||||||||||||||||||||
| Switch to Source code | Preprocessed file |