/src/compositor/extensions/qwaylandwlshell.h

https://gitlab.com/f3822/qtwayland · C Header · 162 lines · 106 code · 28 blank · 28 comment · 0 complexity · e271ed78ad8b0a6259a3267be6c80887 MD5 · raw file

  1. /****************************************************************************
  2. **
  3. ** Copyright (C) 2017 The Qt Company Ltd.
  4. ** Contact: https://www.qt.io/licensing/
  5. **
  6. ** This file is part of the QtWaylandCompositor module of the Qt Toolkit.
  7. **
  8. ** $QT_BEGIN_LICENSE:GPL$
  9. ** Commercial License Usage
  10. ** Licensees holding valid commercial Qt licenses may use this file in
  11. ** accordance with the commercial license agreement provided with the
  12. ** Software or, alternatively, in accordance with the terms contained in
  13. ** a written agreement between you and The Qt Company. For licensing terms
  14. ** and conditions see https://www.qt.io/terms-conditions. For further
  15. ** information use the contact form at https://www.qt.io/contact-us.
  16. **
  17. ** GNU General Public License Usage
  18. ** Alternatively, this file may be used under the terms of the GNU
  19. ** General Public License version 3 or (at your option) any later version
  20. ** approved by the KDE Free Qt Foundation. The licenses are as published by
  21. ** the Free Software Foundation and appearing in the file LICENSE.GPL3
  22. ** included in the packaging of this file. Please review the following
  23. ** information to ensure the GNU General Public License requirements will
  24. ** be met: https://www.gnu.org/licenses/gpl-3.0.html.
  25. **
  26. ** $QT_END_LICENSE$
  27. **
  28. ****************************************************************************/
  29. #ifndef QWAYLANDWLSHELL_H
  30. #define QWAYLANDWLSHELL_H
  31. #include <QtWaylandCompositor/QWaylandCompositorExtension>
  32. #include <QtWaylandCompositor/QWaylandResource>
  33. #include <QtWaylandCompositor/QWaylandShell>
  34. #include <QtWaylandCompositor/QWaylandShellSurface>
  35. #include <QtWaylandCompositor/qwaylandquickchildren.h>
  36. #include <QtCore/QSize>
  37. QT_BEGIN_NAMESPACE
  38. class QWaylandWlShellPrivate;
  39. class QWaylandWlShellSurfacePrivate;
  40. class QWaylandSurface;
  41. class QWaylandClient;
  42. class QWaylandSeat;
  43. class QWaylandOutput;
  44. class QWaylandSurfaceRole;
  45. class QWaylandWlShellSurface;
  46. class Q_WAYLANDCOMPOSITOR_EXPORT QWaylandWlShell : public QWaylandShellTemplate<QWaylandWlShell>
  47. {
  48. Q_OBJECT
  49. Q_DECLARE_PRIVATE(QWaylandWlShell)
  50. public:
  51. QWaylandWlShell();
  52. QWaylandWlShell(QWaylandCompositor *compositor);
  53. void initialize() override;
  54. QList<QWaylandWlShellSurface *> shellSurfaces() const;
  55. QList<QWaylandWlShellSurface *> shellSurfacesForClient(QWaylandClient* client) const;
  56. QList<QWaylandWlShellSurface *> mappedPopups() const;
  57. QWaylandClient *popupClient() const;
  58. static const struct wl_interface *interface();
  59. static QByteArray interfaceName();
  60. public Q_SLOTS:
  61. void closeAllPopups();
  62. Q_SIGNALS:
  63. void wlShellSurfaceRequested(QWaylandSurface *surface, const QWaylandResource &resource);
  64. void wlShellSurfaceCreated(QWaylandWlShellSurface *shellSurface);
  65. };
  66. class Q_WAYLANDCOMPOSITOR_EXPORT QWaylandWlShellSurface : public QWaylandShellSurfaceTemplate<QWaylandWlShellSurface>
  67. {
  68. Q_OBJECT
  69. Q_DECLARE_PRIVATE(QWaylandWlShellSurface)
  70. Q_WAYLAND_COMPOSITOR_DECLARE_QUICK_CHILDREN(QWaylandWlShellSurface)
  71. Q_PROPERTY(QWaylandSurface *surface READ surface NOTIFY surfaceChanged)
  72. Q_PROPERTY(QWaylandWlShell *shell READ shell NOTIFY shellChanged)
  73. Q_PROPERTY(QString title READ title NOTIFY titleChanged)
  74. Q_PROPERTY(QString className READ className NOTIFY classNameChanged)
  75. Q_MOC_INCLUDE("qwaylandsurface.h")
  76. public:
  77. enum FullScreenMethod {
  78. DefaultFullScreen,
  79. ScaleFullScreen,
  80. DriverFullScreen,
  81. FillFullScreen
  82. };
  83. Q_ENUM(FullScreenMethod);
  84. enum ResizeEdge {
  85. NoneEdge = 0,
  86. TopEdge = 1,
  87. BottomEdge = 2,
  88. LeftEdge = 4,
  89. TopLeftEdge = 5,
  90. BottomLeftEdge = 6,
  91. RightEdge = 8,
  92. TopRightEdge = 9,
  93. BottomRightEdge = 10
  94. };
  95. Q_ENUM(ResizeEdge);
  96. QWaylandWlShellSurface();
  97. QWaylandWlShellSurface(QWaylandWlShell *shell, QWaylandSurface *surface, const QWaylandResource &resource);
  98. ~QWaylandWlShellSurface() override;
  99. Q_INVOKABLE void initialize(QWaylandWlShell *shell, QWaylandSurface *surface, const QWaylandResource &resource);
  100. QString title() const;
  101. QString className() const;
  102. QWaylandSurface *surface() const;
  103. QWaylandWlShell *shell() const;
  104. Qt::WindowType windowType() const override;
  105. static const struct wl_interface *interface();
  106. static QByteArray interfaceName();
  107. static QWaylandSurfaceRole *role();
  108. static QWaylandWlShellSurface *fromResource(wl_resource *res);
  109. Q_INVOKABLE QSize sizeForResize(const QSizeF &size, const QPointF &delta, ResizeEdge edges);
  110. Q_INVOKABLE void sendConfigure(const QSize &size, ResizeEdge edges);
  111. Q_INVOKABLE void sendPopupDone();
  112. #if QT_CONFIG(wayland_compositor_quick)
  113. QWaylandQuickShellIntegration *createIntegration(QWaylandQuickShellSurfaceItem *item) override;
  114. #endif
  115. public Q_SLOTS:
  116. void ping();
  117. Q_SIGNALS:
  118. void surfaceChanged();
  119. void shellChanged();
  120. void titleChanged();
  121. void classNameChanged();
  122. void pong();
  123. void startMove(QWaylandSeat *seat);
  124. void startResize(QWaylandSeat *seat, ResizeEdge edges);
  125. void setDefaultToplevel();
  126. void setTransient(QWaylandSurface *parentSurface, const QPoint &relativeToParent, bool inactive);
  127. void setFullScreen(FullScreenMethod method, uint framerate, QWaylandOutput *output);
  128. void setPopup(QWaylandSeat *seat, QWaylandSurface *parentSurface, const QPoint &relativeToParent);
  129. void setMaximized(QWaylandOutput *output);
  130. private:
  131. void initialize() override;
  132. };
  133. QT_END_NAMESPACE
  134. #endif /*QWAYLANDWLSHELL_H*/