Changeset View
Changeset View
Standalone View
Standalone View
input.cpp
Show First 20 Lines • Show All 44 Lines • ▼ Show 20 Line(s) | |||||
45 | #include "shell_client.h" | 45 | #include "shell_client.h" | ||
46 | #include "wayland_server.h" | 46 | #include "wayland_server.h" | ||
47 | #include <KWayland/Server/display.h> | 47 | #include <KWayland/Server/display.h> | ||
48 | #include <KWayland/Server/fakeinput_interface.h> | 48 | #include <KWayland/Server/fakeinput_interface.h> | ||
49 | #include <KWayland/Server/seat_interface.h> | 49 | #include <KWayland/Server/seat_interface.h> | ||
50 | #include <KWayland/Server/relativepointer_interface.h> | 50 | #include <KWayland/Server/relativepointer_interface.h> | ||
51 | #include <decorations/decoratedclient.h> | 51 | #include <decorations/decoratedclient.h> | ||
52 | #include <KDecoration2/Decoration> | 52 | #include <KDecoration2/Decoration> | ||
53 | #include <KGlobalAccel> | ||||
54 | | ||||
53 | //screenlocker | 55 | //screenlocker | ||
54 | #include <KScreenLocker/KsldApp> | 56 | #include <KScreenLocker/KsldApp> | ||
55 | // Qt | 57 | // Qt | ||
56 | #include <QKeyEvent> | 58 | #include <QKeyEvent> | ||
57 | 59 | | |||
58 | #include <xkbcommon/xkbcommon.h> | 60 | #include <xkbcommon/xkbcommon.h> | ||
59 | 61 | | |||
60 | namespace KWin | 62 | namespace KWin | ||
▲ Show 20 Lines • Show All 1364 Lines • ▼ Show 20 Line(s) | 1395 | bool pointerEvent(QMouseEvent *event, quint32 nativeButton) override { | |||
1425 | } | 1427 | } | ||
1426 | // TODO: should we pass through effects? | 1428 | // TODO: should we pass through effects? | ||
1427 | return true; | 1429 | return true; | ||
1428 | } | 1430 | } | ||
1429 | }; | 1431 | }; | ||
1430 | 1432 | | |||
1431 | KWIN_SINGLETON_FACTORY(InputRedirection) | 1433 | KWIN_SINGLETON_FACTORY(InputRedirection) | ||
1432 | 1434 | | |||
1435 | static const QString s_touchpadComponent = QStringLiteral("kcm_touchpad"); | ||||
1436 | | ||||
1433 | InputRedirection::InputRedirection(QObject *parent) | 1437 | InputRedirection::InputRedirection(QObject *parent) | ||
1434 | : QObject(parent) | 1438 | : QObject(parent) | ||
1435 | , m_keyboard(new KeyboardInputRedirection(this)) | 1439 | , m_keyboard(new KeyboardInputRedirection(this)) | ||
1436 | , m_pointer(new PointerInputRedirection(this)) | 1440 | , m_pointer(new PointerInputRedirection(this)) | ||
1437 | , m_touch(new TouchInputRedirection(this)) | 1441 | , m_touch(new TouchInputRedirection(this)) | ||
1438 | , m_shortcuts(new GlobalShortcutsManager(this)) | 1442 | , m_shortcuts(new GlobalShortcutsManager(this)) | ||
1439 | { | 1443 | { | ||
1440 | qRegisterMetaType<KWin::InputRedirection::KeyboardKeyState>(); | 1444 | qRegisterMetaType<KWin::InputRedirection::KeyboardKeyState>(); | ||
▲ Show 20 Lines • Show All 304 Lines • ▼ Show 20 Line(s) | 1670 | if (conn) { | |||
1745 | connect(LogindIntegration::self(), &LogindIntegration::sessionActiveChanged, m_libInput, | 1749 | connect(LogindIntegration::self(), &LogindIntegration::sessionActiveChanged, m_libInput, | ||
1746 | [this] (bool active) { | 1750 | [this] (bool active) { | ||
1747 | if (!active) { | 1751 | if (!active) { | ||
1748 | m_libInput->deactivate(); | 1752 | m_libInput->deactivate(); | ||
1749 | } | 1753 | } | ||
1750 | } | 1754 | } | ||
1751 | ); | 1755 | ); | ||
1752 | } | 1756 | } | ||
1757 | | ||||
1758 | // steal touchpad shortcuts | ||||
1759 | QAction *touchpadToggleAction = new QAction(this); | ||||
graesslin: I think this should be in the if (con) branch.
Given that the method is already quite long… | |||||
1760 | QAction *touchpadOnAction = new QAction(this); | ||||
1761 | QAction *touchpadOffAction = new QAction(this); | ||||
1762 | | ||||
1763 | touchpadToggleAction->setObjectName(QStringLiteral("Toggle Touchpad")); | ||||
1764 | touchpadToggleAction->setProperty("componentName", s_touchpadComponent); | ||||
1765 | touchpadOnAction->setObjectName(QStringLiteral("Enable Touchpad")); | ||||
1766 | touchpadOnAction->setProperty("componentName", s_touchpadComponent); | ||||
1767 | touchpadOffAction->setObjectName(QStringLiteral("Disable Touchpad")); | ||||
1768 | touchpadOffAction->setProperty("componentName", s_touchpadComponent); | ||||
1769 | KGlobalAccel::self()->setDefaultShortcut(touchpadToggleAction, QList<QKeySequence>{Qt::Key_TouchpadToggle}); | ||||
1770 | KGlobalAccel::self()->setShortcut(touchpadToggleAction, QList<QKeySequence>{Qt::Key_TouchpadToggle}); | ||||
1771 | KGlobalAccel::self()->setDefaultShortcut(touchpadOnAction, QList<QKeySequence>{Qt::Key_TouchpadOn}); | ||||
1772 | KGlobalAccel::self()->setShortcut(touchpadOnAction, QList<QKeySequence>{Qt::Key_TouchpadOn}); | ||||
1773 | KGlobalAccel::self()->setDefaultShortcut(touchpadOffAction, QList<QKeySequence>{Qt::Key_TouchpadOff}); | ||||
1774 | KGlobalAccel::self()->setShortcut(touchpadOffAction, QList<QKeySequence>{Qt::Key_TouchpadOff}); | ||||
1775 | #ifndef KWIN_BUILD_TESTING | ||||
1776 | registerShortcut(Qt::Key_TouchpadToggle, touchpadToggleAction); | ||||
1777 | registerShortcut(Qt::Key_TouchpadOn, touchpadOnAction); | ||||
1778 | registerShortcut(Qt::Key_TouchpadOff, touchpadOffAction); | ||||
1779 | #endif | ||||
1780 | connect(touchpadToggleAction, &QAction::triggered, conn, &LibInput::Connection::toggleTouchpads); | ||||
1781 | connect(touchpadOnAction, &QAction::triggered, conn, &LibInput::Connection::enableTouchpads); | ||||
1782 | connect(touchpadOffAction, &QAction::triggered, conn, &LibInput::Connection::disableTouchpads); | ||||
1753 | #endif | 1783 | #endif | ||
1754 | } | 1784 | } | ||
1755 | 1785 | | |||
1756 | bool InputRedirection::hasAlphaNumericKeyboard() | 1786 | bool InputRedirection::hasAlphaNumericKeyboard() | ||
1757 | { | 1787 | { | ||
1758 | #if HAVE_INPUT | 1788 | #if HAVE_INPUT | ||
1759 | if (m_libInput) { | 1789 | if (m_libInput) { | ||
1760 | return m_libInput->hasAlphaNumericKeyboard(); | 1790 | return m_libInput->hasAlphaNumericKeyboard(); | ||
▲ Show 20 Lines • Show All 331 Lines • Show Last 20 Lines |
I think this should be in the if (con) branch.
Given that the method is already quite long maybe move to a dedicated method.