qwaylandkeyboard.h 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. /****************************************************************************
  2. **
  3. ** Copyright (C) 2015 The Qt Company Ltd.
  4. ** Copyright (C) 2013 Klarälvdalens Datakonsult AB (KDAB).
  5. ** Contact: http://www.qt.io/licensing/
  6. **
  7. ** This file is part of the QtWaylandCompositor module of the Qt Toolkit.
  8. **
  9. ** $QT_BEGIN_LICENSE:LGPL3$
  10. ** Commercial License Usage
  11. ** Licensees holding valid commercial Qt licenses may use this file in
  12. ** accordance with the commercial license agreement provided with the
  13. ** Software or, alternatively, in accordance with the terms contained in
  14. ** a written agreement between you and The Qt Company. For licensing terms
  15. ** and conditions see http://www.qt.io/terms-conditions. For further
  16. ** information use the contact form at http://www.qt.io/contact-us.
  17. **
  18. ** GNU Lesser General Public License Usage
  19. ** Alternatively, this file may be used under the terms of the GNU Lesser
  20. ** General Public License version 3 as published by the Free Software
  21. ** Foundation and appearing in the file LICENSE.LGPLv3 included in the
  22. ** packaging of this file. Please review the following information to
  23. ** ensure the GNU Lesser General Public License version 3 requirements
  24. ** will be met: https://www.gnu.org/licenses/lgpl.html.
  25. **
  26. ** GNU General Public License Usage
  27. ** Alternatively, this file may be used under the terms of the GNU
  28. ** General Public License version 2.0 or later as published by the Free
  29. ** Software Foundation and appearing in the file LICENSE.GPL included in
  30. ** the packaging of this file. Please review the following information to
  31. ** ensure the GNU General Public License version 2.0 requirements will be
  32. ** met: http://www.gnu.org/licenses/gpl-2.0.html.
  33. **
  34. ** $QT_END_LICENSE$
  35. **
  36. ****************************************************************************/
  37. #ifndef QWAYLANDKEYBOARD_H
  38. #define QWAYLANDKEYBOARD_H
  39. #include <QtCore/QObject>
  40. #include <QtWaylandCompositor/QWaylandCompositorExtension>
  41. #include <QtWaylandCompositor/QWaylandSurface>
  42. QT_BEGIN_NAMESPACE
  43. class QWaylandKeyboard;
  44. class QWaylandKeyboardPrivate;
  45. class QWaylandInputDevice;
  46. class Q_WAYLAND_COMPOSITOR_EXPORT QWaylandKeymap
  47. {
  48. public:
  49. QWaylandKeymap(const QString &layout = QString(), const QString &variant = QString(), const QString &options = QString(),
  50. const QString &model = QString(), const QString &rules = QString());
  51. inline QString layout() const { return m_layout; }
  52. inline QString variant() const { return m_variant; }
  53. inline QString options() const { return m_options; }
  54. inline QString rules() const { return m_rules; }
  55. inline QString model() const { return m_model; }
  56. private:
  57. QString m_layout;
  58. QString m_variant;
  59. QString m_options;
  60. QString m_rules;
  61. QString m_model;
  62. };
  63. class Q_WAYLAND_COMPOSITOR_EXPORT QWaylandKeyboard : public QWaylandObject
  64. {
  65. Q_OBJECT
  66. Q_DECLARE_PRIVATE(QWaylandKeyboard)
  67. Q_PROPERTY(quint32 repeatRate READ repeatRate WRITE setRepeatRate NOTIFY repeatRateChanged)
  68. Q_PROPERTY(quint32 repeatDelay READ repeatDelay WRITE setRepeatDelay NOTIFY repeatDelayChanged)
  69. public:
  70. QWaylandKeyboard(QWaylandInputDevice *inputDevice, QObject *parent = nullptr);
  71. QWaylandInputDevice *inputDevice() const;
  72. QWaylandCompositor *compositor() const;
  73. quint32 repeatRate() const;
  74. void setRepeatRate(quint32 rate);
  75. quint32 repeatDelay() const;
  76. void setRepeatDelay(quint32 delay);
  77. virtual void setFocus(QWaylandSurface *surface);
  78. virtual void setKeymap(const QWaylandKeymap &keymap);
  79. virtual void sendKeyModifiers(QWaylandClient *client, uint32_t serial);
  80. virtual void sendKeyPressEvent(uint code);
  81. virtual void sendKeyReleaseEvent(uint code);
  82. QWaylandSurface *focus() const;
  83. QWaylandClient *focusClient() const;
  84. virtual void addClient(QWaylandClient *client, uint32_t id, uint32_t version);
  85. Q_SIGNALS:
  86. void focusChanged(QWaylandSurface *surface);
  87. void repeatRateChanged(quint32 repeatRate);
  88. void repeatDelayChanged(quint32 repeatDelay);
  89. private:
  90. void focusDestroyed(void *data);
  91. };
  92. QT_END_NAMESPACE
  93. #endif //QWAYLANDKEYBOARD_H