Changeset View
Changeset View
Standalone View
Standalone View
libinput/connection.cpp
Show First 20 Lines • Show All 219 Lines • ▼ Show 20 Line(s) | |||||
220 | { | 220 | { | ||
221 | if (m_input->isSuspended()) { | 221 | if (m_input->isSuspended()) { | ||
222 | return; | 222 | return; | ||
223 | } | 223 | } | ||
224 | m_keyboardBeforeSuspend = hasKeyboard(); | 224 | m_keyboardBeforeSuspend = hasKeyboard(); | ||
225 | m_alphaNumericKeyboardBeforeSuspend = hasAlphaNumericKeyboard(); | 225 | m_alphaNumericKeyboardBeforeSuspend = hasAlphaNumericKeyboard(); | ||
226 | m_pointerBeforeSuspend = hasPointer(); | 226 | m_pointerBeforeSuspend = hasPointer(); | ||
227 | m_touchBeforeSuspend = hasTouch(); | 227 | m_touchBeforeSuspend = hasTouch(); | ||
228 | m_tabletModeSwitchBeforeSuspend = hasTabletModeSwitch(); | ||||
228 | m_input->suspend(); | 229 | m_input->suspend(); | ||
229 | handleEvent(); | 230 | handleEvent(); | ||
230 | } | 231 | } | ||
231 | 232 | | |||
232 | void Connection::handleEvent() | 233 | void Connection::handleEvent() | ||
233 | { | 234 | { | ||
234 | QMutexLocker locker(&m_mutex); | 235 | QMutexLocker locker(&m_mutex); | ||
235 | const bool wasEmpty = m_eventQueue.isEmpty(); | 236 | const bool wasEmpty = m_eventQueue.isEmpty(); | ||
Show All 39 Lines | 272 | if (device->isPointer()) { | |||
275 | } | 276 | } | ||
276 | } | 277 | } | ||
277 | if (device->isTouch()) { | 278 | if (device->isTouch()) { | ||
278 | m_touch++; | 279 | m_touch++; | ||
279 | if (m_touch == 1) { | 280 | if (m_touch == 1) { | ||
280 | emit hasTouchChanged(true); | 281 | emit hasTouchChanged(true); | ||
281 | } | 282 | } | ||
282 | } | 283 | } | ||
284 | if (device->isTabletModeSwitch()) { | ||||
285 | m_tabletModeSwitch++; | ||||
286 | if (m_tabletModeSwitch == 1) { | ||||
287 | emit hasTabletModeSwitchChanged(true); | ||||
288 | } | ||||
289 | } | ||||
283 | applyDeviceConfig(device); | 290 | applyDeviceConfig(device); | ||
284 | applyScreenToDevice(device); | 291 | applyScreenToDevice(device); | ||
285 | 292 | | |||
286 | // enable possible leds | 293 | // enable possible leds | ||
287 | libinput_device_led_update(device->device(), static_cast<libinput_led>(toLibinputLEDS(m_leds))); | 294 | libinput_device_led_update(device->device(), static_cast<libinput_led>(toLibinputLEDS(m_leds))); | ||
288 | 295 | | |||
289 | emit deviceAdded(device); | 296 | emit deviceAdded(device); | ||
290 | break; | 297 | break; | ||
Show All 27 Lines | 321 | if (device->isPointer()) { | |||
318 | } | 325 | } | ||
319 | } | 326 | } | ||
320 | if (device->isTouch()) { | 327 | if (device->isTouch()) { | ||
321 | m_touch--; | 328 | m_touch--; | ||
322 | if (m_touch == 0) { | 329 | if (m_touch == 0) { | ||
323 | emit hasTouchChanged(false); | 330 | emit hasTouchChanged(false); | ||
324 | } | 331 | } | ||
325 | } | 332 | } | ||
333 | if (device->isTabletModeSwitch()) { | ||||
334 | m_tabletModeSwitch--; | ||||
335 | if (m_tabletModeSwitch == 0) { | ||||
336 | emit hasTabletModeSwitchChanged(false); | ||||
337 | } | ||||
338 | } | ||||
326 | device->deleteLater(); | 339 | device->deleteLater(); | ||
327 | break; | 340 | break; | ||
328 | } | 341 | } | ||
329 | case LIBINPUT_EVENT_KEYBOARD_KEY: { | 342 | case LIBINPUT_EVENT_KEYBOARD_KEY: { | ||
330 | KeyEvent *ke = static_cast<KeyEvent*>(event.data()); | 343 | KeyEvent *ke = static_cast<KeyEvent*>(event.data()); | ||
331 | emit keyChanged(ke->key(), ke->state(), ke->time(), ke->device()); | 344 | emit keyChanged(ke->key(), ke->state(), ke->time(), ke->device()); | ||
332 | break; | 345 | break; | ||
333 | } | 346 | } | ||
▲ Show 20 Lines • Show All 155 Lines • ▼ Show 20 Line(s) | 501 | if (m_alphaNumericKeyboardBeforeSuspend && !m_alphaNumericKeyboard) { | |||
489 | emit hasAlphaNumericKeyboardChanged(false); | 502 | emit hasAlphaNumericKeyboardChanged(false); | ||
490 | } | 503 | } | ||
491 | if (m_pointerBeforeSuspend && !m_pointer) { | 504 | if (m_pointerBeforeSuspend && !m_pointer) { | ||
492 | emit hasPointerChanged(false); | 505 | emit hasPointerChanged(false); | ||
493 | } | 506 | } | ||
494 | if (m_touchBeforeSuspend && !m_touch) { | 507 | if (m_touchBeforeSuspend && !m_touch) { | ||
495 | emit hasTouchChanged(false); | 508 | emit hasTouchChanged(false); | ||
496 | } | 509 | } | ||
510 | if (m_tabletModeSwitchBeforeSuspend && !m_tabletModeSwitch) { | ||||
511 | emit hasTabletModeSwitchChanged(false); | ||||
512 | } | ||||
497 | wasSuspended = false; | 513 | wasSuspended = false; | ||
498 | } | 514 | } | ||
499 | } | 515 | } | ||
500 | 516 | | |||
501 | void Connection::setScreenSize(const QSize &size) | 517 | void Connection::setScreenSize(const QSize &size) | ||
502 | { | 518 | { | ||
503 | m_size = size; | 519 | m_size = size; | ||
504 | } | 520 | } | ||
▲ Show 20 Lines • Show All 187 Lines • Show Last 20 Lines |