Changeset View
Changeset View
Standalone View
Standalone View
kcms/touchpad/src/backends/x11/xlibbackend.cpp
Show First 20 Lines • Show All 88 Lines • ▼ Show 20 Line(s) | 78 | { | |||
---|---|---|---|---|---|
89 | m_keyboardAtom.intern(m_connection, XI_KEYBOARD); | 89 | m_keyboardAtom.intern(m_connection, XI_KEYBOARD); | ||
90 | m_touchpadAtom.intern(m_connection, XI_TOUCHPAD); | 90 | m_touchpadAtom.intern(m_connection, XI_TOUCHPAD); | ||
91 | m_enabledAtom.intern(m_connection, XI_PROP_ENABLED); | 91 | m_enabledAtom.intern(m_connection, XI_PROP_ENABLED); | ||
92 | 92 | | |||
93 | m_synapticsIdentifierAtom.intern(m_connection, SYNAPTICS_PROP_CAPABILITIES); | 93 | m_synapticsIdentifierAtom.intern(m_connection, SYNAPTICS_PROP_CAPABILITIES); | ||
94 | m_libinputIdentifierAtom.intern(m_connection, "libinput Send Events Modes Available"); | 94 | m_libinputIdentifierAtom.intern(m_connection, "libinput Send Events Modes Available"); | ||
95 | 95 | | |||
96 | m_device.reset(findTouchpad()); | 96 | m_device.reset(findTouchpad()); | ||
97 | | ||||
97 | if (!m_device) { | 98 | if (!m_device) { | ||
98 | m_errorString = i18n("No touchpad found"); | 99 | m_errorString = i18n("No touchpad found"); | ||
99 | } | 100 | } | ||
100 | } | 101 | } | ||
101 | 102 | | |||
102 | XlibTouchpad* XlibBackend::findTouchpad() | 103 | XlibTouchpad* XlibBackend::findTouchpad() | ||
103 | { | 104 | { | ||
104 | int nDevices = 0; | 105 | int nDevices = 0; | ||
▲ Show 20 Lines • Show All 239 Lines • ▼ Show 20 Line(s) | 325 | for (XDeviceInfo *i = info.data(); i != info.data() + nDevices; i++) { | |||
344 | list.append(name); | 345 | list.append(name); | ||
345 | } | 346 | } | ||
346 | 347 | | |||
347 | return list; | 348 | return list; | ||
348 | } | 349 | } | ||
349 | 350 | | |||
350 | QVector<QObject *> XlibBackend::getDevices() const | 351 | QVector<QObject *> XlibBackend::getDevices() const | ||
351 | { | 352 | { | ||
352 | return m_device ? QVector<QObject*> { m_device.data() } : QVector<QObject*>(); | 353 | QVector<QObject*> touchpads; | ||
354 | | ||||
355 | LibinputTouchpad* libinputtouchpad = dynamic_cast<LibinputTouchpad*> (m_device.data()); | ||||
356 | SynapticsTouchpad* synaptics = dynamic_cast<SynapticsTouchpad*> (m_device.data()); | ||||
357 | | ||||
358 | if ( libinputtouchpad) { | ||||
359 | touchpads.push_back(libinputtouchpad); | ||||
360 | } | ||||
361 | if (synaptics) { | ||||
362 | touchpads.push_back(synaptics); | ||||
363 | } | ||||
364 | return touchpads; | ||||
353 | } | 365 | } | ||
354 | 366 | | |||
355 | void XlibBackend::watchForEvents(bool keyboard) | 367 | void XlibBackend::watchForEvents(bool keyboard) | ||
356 | { | 368 | { | ||
357 | if (!m_notifications) { | 369 | if (!m_notifications) { | ||
358 | m_notifications.reset(new XlibNotifications(m_display.data(), m_device ? m_device->deviceId() : XIAllDevices)); | 370 | m_notifications.reset(new XlibNotifications(m_display.data(), m_device ? m_device->deviceId() : XIAllDevices)); | ||
359 | connect(m_notifications.data(), SIGNAL(devicePlugged(int)), | 371 | connect(m_notifications.data(), SIGNAL(devicePlugged(int)), | ||
360 | SLOT(devicePlugged(int))); | 372 | SLOT(devicePlugged(int))); | ||
Show All 21 Lines |