File indexing completed on 2024-11-10 04:56:36

0001 /*
0002     KWin - the KDE window manager
0003     This file is part of the KDE project.
0004 
0005     SPDX-FileCopyrightText: 2016 Martin Gräßlin <mgraesslin@kde.org>
0006 
0007     SPDX-License-Identifier: GPL-2.0-or-later
0008 */
0009 #pragma once
0010 
0011 #include <QObject>
0012 #include <QPointer>
0013 #include <memory>
0014 typedef struct _XDisplay Display;
0015 
0016 namespace KWin
0017 {
0018 
0019 class XInputEventFilter;
0020 class XKeyPressReleaseEventFilter;
0021 class X11Cursor;
0022 
0023 class XInputIntegration : public QObject
0024 {
0025     Q_OBJECT
0026 public:
0027     explicit XInputIntegration(::Display *display, QObject *parent);
0028     ~XInputIntegration() override;
0029 
0030     void init();
0031     void startListening();
0032 
0033     bool hasXinput() const
0034     {
0035         return m_hasXInput;
0036     }
0037     void setCursor(X11Cursor *cursor);
0038 
0039 private:
0040     ::Display *display() const
0041     {
0042         return m_x11Display;
0043     }
0044 
0045     bool m_hasXInput = false;
0046     int m_xiOpcode = 0;
0047     int m_majorVersion = 0;
0048     int m_minorVersion = 0;
0049     QPointer<X11Cursor> m_x11Cursor;
0050     ::Display *m_x11Display;
0051 
0052     std::unique_ptr<XInputEventFilter> m_xiEventFilter;
0053     std::unique_ptr<XKeyPressReleaseEventFilter> m_keyPressFilter;
0054     std::unique_ptr<XKeyPressReleaseEventFilter> m_keyReleaseFilter;
0055 };
0056 
0057 }