Changeset View
Changeset View
Standalone View
Standalone View
libinput/connection.cpp
Show All 22 Lines | |||||
23 | #include "events.h" | 23 | #include "events.h" | ||
24 | #ifndef KWIN_BUILD_TESTING | 24 | #ifndef KWIN_BUILD_TESTING | ||
25 | #include "../screens.h" | 25 | #include "../screens.h" | ||
26 | #endif | 26 | #endif | ||
27 | #include "../logind.h" | 27 | #include "../logind.h" | ||
28 | #include "../udev.h" | 28 | #include "../udev.h" | ||
29 | #include "libinput_logging.h" | 29 | #include "libinput_logging.h" | ||
30 | 30 | | |||
31 | #include <KConfigGroup> | | |||
32 | | ||||
33 | #include <QDBusMessage> | 31 | #include <QDBusMessage> | ||
34 | #include <QDBusConnection> | 32 | #include <QDBusConnection> | ||
35 | #include <QDBusPendingCall> | 33 | #include <QDBusPendingCall> | ||
36 | #include <QMutexLocker> | 34 | #include <QMutexLocker> | ||
37 | #include <QSocketNotifier> | 35 | #include <QSocketNotifier> | ||
38 | #include <QThread> | 36 | #include <QThread> | ||
39 | 37 | | |||
40 | #include <libinput.h> | 38 | #include <libinput.h> | ||
▲ Show 20 Lines • Show All 557 Lines • ▼ Show 20 Line(s) | 592 | { | |||
598 | return s_context->isSuspended(); | 596 | return s_context->isSuspended(); | ||
599 | } | 597 | } | ||
600 | 598 | | |||
601 | void Connection::applyDeviceConfig(Device *device) | 599 | void Connection::applyDeviceConfig(Device *device) | ||
602 | { | 600 | { | ||
603 | // pass configuration to Device | 601 | // pass configuration to Device | ||
604 | device->setConfig(m_config->group("Libinput").group(QString::number(device->vendor())).group(QString::number(device->product())).group(device->name())); | 602 | device->setConfig(m_config->group("Libinput").group(QString::number(device->vendor())).group(QString::number(device->product())).group(device->name())); | ||
605 | device->loadConfiguration(); | 603 | device->loadConfiguration(); | ||
606 | | ||||
607 | if (device->isPointer() && !device->isTouchpad()) { | | |||
608 | const KConfigGroup group = m_config->group("Mouse"); | | |||
609 | device->setLeftHanded(group.readEntry("MouseButtonMapping", "RightHanded") == QLatin1String("LeftHanded")); | | |||
610 | qreal accel = group.readEntry("Acceleration", -1.0); | | |||
611 | if (qFuzzyCompare(accel, -1.0) || qFuzzyCompare(accel, 1.0)) { | | |||
612 | // default value | | |||
613 | device->setPointerAcceleration(0.0); | | |||
614 | } else { | | |||
615 | // the X11-based config is mapped in [0.1,20.0] with 1.0 being the "normal" setting - we assume that's the default | | |||
616 | if (accel < 1.0) { | | |||
617 | device->setPointerAcceleration(-1.0 + ((accel * 10.0) - 1.0) / 9.0); | | |||
618 | } else { | | |||
619 | device->setPointerAcceleration((accel -1.0)/19.0); | | |||
620 | } | | |||
621 | } | | |||
622 | } | | |||
623 | } | 604 | } | ||
624 | 605 | | |||
625 | void Connection::slotKGlobalSettingsNotifyChange(int type, int arg) | 606 | void Connection::slotKGlobalSettingsNotifyChange(int type, int arg) | ||
626 | { | 607 | { | ||
627 | if (type == 3 /**SettingsChanged**/ && arg == 0 /** SETTINGS_MOUSE **/) { | 608 | if (type == 3 /**SettingsChanged**/ && arg == 0 /** SETTINGS_MOUSE **/) { | ||
628 | m_config->reparseConfiguration(); | 609 | m_config->reparseConfiguration(); | ||
629 | for (auto it = m_devices.constBegin(), end = m_devices.constEnd(); it != end; ++it) { | 610 | for (auto it = m_devices.constBegin(), end = m_devices.constEnd(); it != end; ++it) { | ||
630 | if ((*it)->isPointer()) { | 611 | if ((*it)->isPointer()) { | ||
▲ Show 20 Lines • Show All 75 Lines • Show Last 20 Lines |