File indexing completed on 2024-05-12 17:01:56
0001 /* 0002 KWin - the KDE window manager 0003 This file is part of the KDE project. 0004 0005 SPDX-FileCopyrightText: 2014 Martin Gräßlin <mgraesslin@kde.org> 0006 0007 SPDX-License-Identifier: GPL-2.0-or-later 0008 */ 0009 #pragma once 0010 0011 #include <kwinglobals.h> 0012 0013 #include <KSharedConfig> 0014 0015 #include <QObject> 0016 #include <QPointer> 0017 #include <QRecursiveMutex> 0018 #include <QSize> 0019 #include <QStringList> 0020 #include <QVector> 0021 #include <deque> 0022 0023 class QSocketNotifier; 0024 class QThread; 0025 0026 namespace KWin 0027 { 0028 0029 class Session; 0030 class Udev; 0031 0032 namespace LibInput 0033 { 0034 0035 class Event; 0036 class Device; 0037 class Context; 0038 class ConnectionAdaptor; 0039 0040 class KWIN_EXPORT Connection : public QObject 0041 { 0042 Q_OBJECT 0043 0044 public: 0045 ~Connection() override; 0046 0047 void setInputConfig(const KSharedConfigPtr &config) 0048 { 0049 m_config = config; 0050 } 0051 0052 void setup(); 0053 void updateScreens(); 0054 void deactivate(); 0055 void processEvents(); 0056 0057 QStringList devicesSysNames() const; 0058 0059 static std::unique_ptr<Connection> create(Session *session); 0060 0061 Q_SIGNALS: 0062 void deviceAdded(KWin::LibInput::Device *); 0063 void deviceRemoved(KWin::LibInput::Device *); 0064 0065 void eventsRead(); 0066 0067 private Q_SLOTS: 0068 void slotKGlobalSettingsNotifyChange(int type, int arg); 0069 0070 private: 0071 Connection(std::unique_ptr<Context> &&input); 0072 void handleEvent(); 0073 void applyDeviceConfig(Device *device); 0074 void applyScreenToDevice(Device *device); 0075 void doSetup(); 0076 std::unique_ptr<QSocketNotifier> m_notifier; 0077 QRecursiveMutex m_mutex; 0078 std::deque<std::unique_ptr<Event>> m_eventQueue; 0079 QVector<Device *> m_devices; 0080 KSharedConfigPtr m_config; 0081 std::unique_ptr<ConnectionAdaptor> m_connectionAdaptor; 0082 std::unique_ptr<Context> m_input; 0083 std::unique_ptr<Udev> m_udev; 0084 }; 0085 0086 } 0087 }