Changeset View
Changeset View
Standalone View
Standalone View
src/client/xdgshell.h
Show All 15 Lines | |||||
16 | 16 | | |||
17 | You should have received a copy of the GNU Lesser General Public | 17 | You should have received a copy of the GNU Lesser General Public | ||
18 | License along with this library. If not, see <http://www.gnu.org/licenses/>. | 18 | License along with this library. If not, see <http://www.gnu.org/licenses/>. | ||
19 | ****************************************************************************/ | 19 | ****************************************************************************/ | ||
20 | #ifndef KWAYLAND_CLIENT_XDG_SHELL_V5_H | 20 | #ifndef KWAYLAND_CLIENT_XDG_SHELL_V5_H | ||
21 | #define KWAYLAND_CLIENT_XDG_SHELL_V5_H | 21 | #define KWAYLAND_CLIENT_XDG_SHELL_V5_H | ||
22 | 22 | | |||
23 | #include <QObject> | 23 | #include <QObject> | ||
24 | 24 | #include <QSize> | |||
25 | #include <QRect> | ||||
25 | #include <KWayland/Client/kwaylandclient_export.h> | 26 | #include <KWayland/Client/kwaylandclient_export.h> | ||
26 | 27 | | |||
27 | struct xdg_shell; | 28 | struct xdg_shell; | ||
28 | struct xdg_surface; | 29 | struct xdg_surface; | ||
29 | struct xdg_popup; | 30 | struct xdg_popup; | ||
30 | 31 | | |||
32 | struct zxdg_shell_v6; | ||||
33 | struct zxdg_toplevel_v6; | ||||
34 | struct zxdg_surface_v6; | ||||
35 | struct zxdg_popup_v6; | ||||
36 | struct zxdg_position_v6; | ||||
37 | | ||||
31 | namespace KWayland | 38 | namespace KWayland | ||
32 | { | 39 | { | ||
33 | namespace Client | 40 | namespace Client | ||
34 | { | 41 | { | ||
35 | 42 | | |||
36 | class EventQueue; | 43 | class EventQueue; | ||
37 | class Output; | 44 | class Output; | ||
38 | class Surface; | 45 | class Surface; | ||
39 | class Seat; | 46 | class Seat; | ||
40 | class XdgShellPopup; | 47 | class XdgShellPopup; | ||
41 | class XdgShellSurface; | 48 | class XdgShellSurface; | ||
42 | 49 | | |||
50 | /* | ||||
51 | * Builder class describing how a popup should be positioned | ||||
52 | * when created | ||||
53 | * | ||||
54 | * @since 5.XDGMERGE_VERSION | ||||
55 | */ | ||||
56 | class KWAYLANDCLIENT_EXPORT XdgPositioner | ||||
57 | { | ||||
58 | public: | ||||
59 | /* | ||||
60 | * Flags describing how a popup should be reposition if constrained | ||||
61 | */ | ||||
62 | enum class Constraint { | ||||
63 | /* | ||||
64 | * Slide the popup on the X axis until there is room | ||||
65 | */ | ||||
66 | SlideX = 1 << 0, | ||||
67 | /* | ||||
68 | * Slide the popup on the Y axis until there is room | ||||
69 | */ | ||||
70 | SlideY = 1 << 1, | ||||
71 | /* | ||||
72 | * Invert the anchor and gravity on the X axis | ||||
73 | */ | ||||
74 | FlipX = 1 << 2, | ||||
75 | /* | ||||
76 | * Invert the anchor and gravity on the Y axis | ||||
77 | */ | ||||
78 | FlipY = 1 << 3, | ||||
79 | /* | ||||
80 | * Resize the popup in the X axis | ||||
81 | */ | ||||
82 | ResizeX = 1 << 4, | ||||
83 | /* | ||||
84 | * Resize the popup in the Y axis | ||||
85 | */ | ||||
86 | ResizeY = 1 << 5 | ||||
87 | }; | ||||
88 | | ||||
89 | Q_DECLARE_FLAGS(Constraints, Constraint) | ||||
90 | | ||||
91 | XdgPositioner(const QSize &initialSize = QSize(), const QRect &anchor = QRect()); | ||||
92 | XdgPositioner(const XdgPositioner &other); | ||||
93 | ~XdgPositioner(); | ||||
94 | | ||||
95 | /* | ||||
graesslin: In case you wanted to make those comments doxygen comments: you need to use /** instead of /*… | |||||
96 | * Which edge of the anchor should the popup be positioned around | ||||
97 | */ | ||||
98 | Qt::Edges anchorEdge() const; | ||||
99 | void setAnchorEdge(Qt::Edges edge); | ||||
100 | | ||||
101 | /* | ||||
102 | * Specifies in what direction the popup should be positioned around the anchor | ||||
103 | * i.e if the gravity is "bottom", then then the top of top of the poup will be at the anchor edge | ||||
104 | * if the gravity is top, then the bottom of the popup will be at the anchor edge | ||||
105 | * | ||||
106 | */ | ||||
107 | Qt::Edges gravity() const; | ||||
108 | void setGravity(Qt::Edges edge); | ||||
109 | | ||||
110 | /* | ||||
111 | * The area this popup should be positioned around | ||||
112 | */ | ||||
113 | QRect anchorRect() const; | ||||
114 | void setAnchorRect(const QRect &anchor); | ||||
115 | | ||||
116 | /* | ||||
117 | * The size of the surface that is to be positioned. | ||||
118 | */ | ||||
119 | QSize initialSize() const; | ||||
120 | void setInitialSize(const QSize &size); | ||||
121 | | ||||
122 | /* | ||||
123 | * Specifies how the compositor should position the popup if it does not fit in the requested position | ||||
124 | */ | ||||
125 | Constraints constraints() const; | ||||
126 | void setConstraints(Constraints constaints); | ||||
127 | | ||||
128 | /* | ||||
129 | * An additional offset that should be applied from the anchor. | ||||
130 | */ | ||||
131 | QPoint anchorOffset() const; | ||||
132 | void setAnchorOffset(const QPoint &offset); | ||||
133 | | ||||
134 | private: | ||||
135 | class Private; | ||||
136 | QScopedPointer<Private> d; | ||||
137 | }; | ||||
138 | | ||||
43 | /** | 139 | /** | ||
44 | * @short Wrapper for the xdg_shell interface. | 140 | * @short Wrapper for the xdg_shell interface. | ||
45 | * | 141 | * | ||
46 | * This class provides a convenient wrapper for the xdg_shell interface. | 142 | * This class provides a convenient wrapper for the xdg_shell interface. | ||
47 | * | 143 | * | ||
48 | * To use this class one needs to interact with the Registry. There are two | 144 | * To use this class one needs to interact with the Registry. There are two | ||
49 | * possible ways to create the XdgShell interface: | 145 | * possible ways to create the XdgShell interface: | ||
50 | * @code | 146 | * @code | ||
Show All 20 Lines | 166 | public: | |||
71 | virtual ~XdgShell(); | 167 | virtual ~XdgShell(); | ||
72 | 168 | | |||
73 | /** | 169 | /** | ||
74 | * Setup this XdgShell to manage the @p xdgshellv5. | 170 | * Setup this XdgShell to manage the @p xdgshellv5. | ||
75 | * When using Registry::createXdgShell there is no need to call this | 171 | * When using Registry::createXdgShell there is no need to call this | ||
76 | * method. | 172 | * method. | ||
77 | **/ | 173 | **/ | ||
78 | void setup(xdg_shell *xdgshellv5); | 174 | void setup(xdg_shell *xdgshellv5); | ||
175 | | ||||
176 | void setup(zxdg_shell_v6 *xdgshellv6); | ||||
graesslin: lacking documentation including an @since. | |||||
177 | | ||||
79 | /** | 178 | /** | ||
80 | * @returns @c true if managing a xdg_shell. | 179 | * @returns @c true if managing a xdg_shell. | ||
81 | **/ | 180 | **/ | ||
82 | bool isValid() const; | 181 | bool isValid() const; | ||
83 | /** | 182 | /** | ||
84 | * Releases the xdg_shell interface. | 183 | * Releases the xdg_shell interface. | ||
85 | * After the interface has been released the XdgShell instance is no | 184 | * After the interface has been released the XdgShell instance is no | ||
86 | * longer valid and can be setup with another xdg_shell interface. | 185 | * longer valid and can be setup with another xdg_shell interface. | ||
Show All 26 Lines | |||||
113 | 212 | | |||
114 | /** | 213 | /** | ||
115 | * Creates a new XdgShellSurface for the given @p surface. | 214 | * Creates a new XdgShellSurface for the given @p surface. | ||
116 | **/ | 215 | **/ | ||
117 | XdgShellSurface *createSurface(Surface *surface, QObject *parent = nullptr); | 216 | XdgShellSurface *createSurface(Surface *surface, QObject *parent = nullptr); | ||
118 | 217 | | |||
119 | /** | 218 | /** | ||
120 | * Creates a new XdgShellPopup for the given @p surface on top of @p parentSurface. | 219 | * Creates a new XdgShellPopup for the given @p surface on top of @p parentSurface. | ||
220 | * @deprecated This method is only valid for v5 | ||||
121 | **/ | 221 | **/ | ||
122 | XdgShellPopup *createPopup(Surface *surface, Surface *parentSurface, Seat *seat, quint32 serial, const QPoint &parentPos, QObject *parent = nullptr); | 222 | XdgShellPopup *createPopup(Surface *surface, Surface *parentSurface, Seat *seat, quint32 serial, const QPoint &parentPos, QObject *parent = nullptr); | ||
If the comment is deprecated, the method should be deprecated as well. But I disagree on the point of deprecation. It is not deprecated if it's used with xdgShellv5. That should probably just be documented properly. graesslin: If the comment is deprecated, the method should be deprecated as well. But I disagree on the… | |||||
123 | 223 | | |||
224 | /** | ||||
225 | * Creates a new XdgShellPopup for the given @p surface on top of @p parentSurface with the given @p positioner. | ||||
226 | **/ | ||||
graesslin: @since missing | |||||
227 | XdgShellPopup *createPopup(Surface *surface, XdgShellSurface *parentSurface, const XdgPositioner &positioner, QObject *parent = nullptr); | ||||
228 | | ||||
229 | /** | ||||
graesslin: looks like wrong indentation. | |||||
230 | * Creates a new XdgShellPopup for the given @p surface on top of @p parentSurface with the given @p positioner. | ||||
231 | **/ | ||||
graesslin: @since missing | |||||
232 | XdgShellPopup *createPopup(Surface *surface, XdgShellPopup *parentSurface, const XdgPositioner &positioner, QObject *parent = nullptr); | ||||
233 | | ||||
124 | operator xdg_shell*(); | 234 | operator xdg_shell*(); | ||
125 | operator xdg_shell*() const; | 235 | operator xdg_shell*() const; | ||
236 | operator zxdg_shell_v6*(); | ||||
237 | operator zxdg_shell_v6*() const; | ||||
238 | | ||||
126 | 239 | | |||
127 | Q_SIGNALS: | 240 | Q_SIGNALS: | ||
128 | /** | 241 | /** | ||
129 | * The corresponding global for this interface on the Registry got removed. | 242 | * The corresponding global for this interface on the Registry got removed. | ||
130 | * | 243 | * | ||
131 | * This signal gets only emitted if the XdgShell got created by | 244 | * This signal gets only emitted if the XdgShell got created by | ||
132 | * Registry::createXdgShell | 245 | * Registry::createXdgShell | ||
133 | **/ | 246 | **/ | ||
▲ Show 20 Lines • Show All 46 Lines • ▼ Show 20 Line(s) | 270 | public: | |||
180 | Q_DECLARE_FLAGS(States, State) | 293 | Q_DECLARE_FLAGS(States, State) | ||
181 | 294 | | |||
182 | /** | 295 | /** | ||
183 | * Setup this XdgShellSurface to manage the @p xdgsurfacev5. | 296 | * Setup this XdgShellSurface to manage the @p xdgsurfacev5. | ||
184 | * When using XdgShell::createXdgShellSurface there is no need to call this | 297 | * When using XdgShell::createXdgShellSurface there is no need to call this | ||
185 | * method. | 298 | * method. | ||
186 | **/ | 299 | **/ | ||
187 | void setup(xdg_surface *xdgsurfacev5); | 300 | void setup(xdg_surface *xdgsurfacev5); | ||
301 | | ||||
302 | void setup(zxdg_surface_v6 *xdgsurfacev6, zxdg_toplevel_v6 *toplevel); | ||||
graesslin: missing documentation. | |||||
303 | | ||||
188 | /** | 304 | /** | ||
189 | * @returns @c true if managing a xdg_surface. | 305 | * @returns @c true if managing a xdg_surface. | ||
190 | **/ | 306 | **/ | ||
191 | bool isValid() const; | 307 | bool isValid() const; | ||
192 | /** | 308 | /** | ||
193 | * Releases the xdg_surface interface. | 309 | * Releases the xdg_surface interface. | ||
194 | * After the interface has been released the XdgShellSurface instance is no | 310 | * After the interface has been released the XdgShellSurface instance is no | ||
195 | * longer valid and can be setup with another xdg_surface interface. | 311 | * longer valid and can be setup with another xdg_surface interface. | ||
▲ Show 20 Lines • Show All 107 Lines • ▼ Show 20 Line(s) | |||||
303 | **/ | 419 | **/ | ||
304 | void setFullscreen(bool set, Output *output = nullptr); | 420 | void setFullscreen(bool set, Output *output = nullptr); | ||
305 | 421 | | |||
306 | /** | 422 | /** | ||
307 | * Request to the compositor to minimize this XdgShellSurface. | 423 | * Request to the compositor to minimize this XdgShellSurface. | ||
308 | **/ | 424 | **/ | ||
309 | void requestMinimize(); | 425 | void requestMinimize(); | ||
310 | 426 | | |||
427 | /* | ||||
graesslin: same as with the other class: that's not a documentation comment. | |||||
428 | * Set this surface to have a given maximum size | ||||
429 | * @since 5.XDGMERGE_VERSION | ||||
430 | */ | ||||
431 | void setMaxSize(const QSize &size); | ||||
432 | | ||||
433 | /* | ||||
434 | * Set this surface to have a given minimum size | ||||
435 | * @since 5.XDGMERGE_VERSION | ||||
436 | */ | ||||
437 | void setMinSize(const QSize &size); | ||||
438 | | ||||
311 | operator xdg_surface*(); | 439 | operator xdg_surface*(); | ||
312 | operator xdg_surface*() const; | 440 | operator xdg_surface*() const; | ||
313 | 441 | | |||
442 | operator zxdg_surface_v6*(); | ||||
443 | operator zxdg_surface_v6*() const; | ||||
444 | operator zxdg_toplevel_v6*(); | ||||
445 | operator zxdg_toplevel_v6*() const; | ||||
446 | | ||||
314 | Q_SIGNALS: | 447 | Q_SIGNALS: | ||
315 | /** | 448 | /** | ||
316 | * The compositor requested to close this window. | 449 | * The compositor requested to close this window. | ||
317 | **/ | 450 | **/ | ||
318 | void closeRequested(); | 451 | void closeRequested(); | ||
319 | /** | 452 | /** | ||
320 | * The compositor sent a configure with the new @p size and the @p states. | 453 | * The compositor sent a configure with the new @p size and the @p states. | ||
321 | * Before the next commit of the surface the @p serial needs to be passed to ackConfigure. | 454 | * Before the next commit of the surface the @p serial needs to be passed to ackConfigure. | ||
Show All 32 Lines | 486 | public: | |||
354 | virtual ~XdgShellPopup(); | 487 | virtual ~XdgShellPopup(); | ||
355 | 488 | | |||
356 | /** | 489 | /** | ||
357 | * Setup this XdgShellPopup to manage the @p xdgpopupv5. | 490 | * Setup this XdgShellPopup to manage the @p xdgpopupv5. | ||
358 | * When using XdgShell::createXdgShellPopup there is no need to call this | 491 | * When using XdgShell::createXdgShellPopup there is no need to call this | ||
359 | * method. | 492 | * method. | ||
360 | **/ | 493 | **/ | ||
361 | void setup(xdg_popup *xdgpopupv5); | 494 | void setup(xdg_popup *xdgpopupv5); | ||
495 | | ||||
496 | /** | ||||
497 | * Setup this XdgShellPopup to manage the @p xdgpopupv6 | ||||
498 | * When using XdgShell::createXdgShellPopup there is no need to call this | ||||
499 | * method. | ||||
500 | **/ | ||||
graesslin: @since missing | |||||
501 | void setup(zxdg_surface_v6 *xdgsurfacev6, zxdg_popup_v6 *xdgpopup6); | ||||
502 | | ||||
362 | /** | 503 | /** | ||
363 | * @returns @c true if managing an xdg_popup. | 504 | * @returns @c true if managing an xdg_popup. | ||
364 | **/ | 505 | **/ | ||
365 | bool isValid() const; | 506 | bool isValid() const; | ||
366 | /** | 507 | /** | ||
367 | * Releases the xdg_popup interface. | 508 | * Releases the xdg_popup interface. | ||
368 | * After the interface has been released the XdgShellPopup instance is no | 509 | * After the interface has been released the XdgShellPopup instance is no | ||
369 | * longer valid and can be setup with another xdg_popup interface. | 510 | * longer valid and can be setup with another xdg_popup interface. | ||
Show All 20 Lines | |||||
390 | * Sets the @p queue to use for bound proxies. | 531 | * Sets the @p queue to use for bound proxies. | ||
391 | **/ | 532 | **/ | ||
392 | void setEventQueue(EventQueue *queue); | 533 | void setEventQueue(EventQueue *queue); | ||
393 | /** | 534 | /** | ||
394 | * @returns The event queue to use for bound proxies. | 535 | * @returns The event queue to use for bound proxies. | ||
395 | **/ | 536 | **/ | ||
396 | EventQueue *eventQueue(); | 537 | EventQueue *eventQueue(); | ||
397 | 538 | | |||
539 | /** | ||||
540 | * Requests a grab on this popup | ||||
541 | * @since 5.XDGMERGE_VERSION | ||||
542 | */ | ||||
543 | void requestGrab(Seat *seat, quint32 serial); | ||||
544 | | ||||
545 | | ||||
398 | operator xdg_popup*(); | 546 | operator xdg_popup*(); | ||
399 | operator xdg_popup*() const; | 547 | operator xdg_popup*() const; | ||
548 | operator zxdg_surface_v6*(); | ||||
549 | operator zxdg_surface_v6*() const; | ||||
550 | operator zxdg_popup_v6*(); | ||||
551 | operator zxdg_popup_v6*() const; | ||||
552 | | ||||
400 | 553 | | |||
401 | Q_SIGNALS: | 554 | Q_SIGNALS: | ||
402 | /** | 555 | /** | ||
403 | * This signal is emitted when a XdgShellPopup is dismissed by the | 556 | * This signal is emitted when a XdgShellPopup is dismissed by the | ||
404 | * compositor. The user should delete this instance at this point. | 557 | * compositor. The user should delete this instance at this point. | ||
405 | **/ | 558 | **/ | ||
406 | void popupDone(); | 559 | void popupDone(); | ||
407 | 560 | | |||
561 | /** | ||||
562 | * | ||||
graesslin: documentation missing | |||||
563 | **/ | ||||
564 | void configureRequested(const QRect &relativePosition, quint32 serial); | ||||
565 | | ||||
566 | | ||||
408 | protected: | 567 | protected: | ||
409 | class Private; | 568 | class Private; | ||
410 | explicit XdgShellPopup(Private *p, QObject *parent = nullptr); | 569 | explicit XdgShellPopup(Private *p, QObject *parent = nullptr); | ||
411 | 570 | | |||
412 | private: | 571 | private: | ||
413 | QScopedPointer<Private> d; | 572 | QScopedPointer<Private> d; | ||
414 | }; | 573 | }; | ||
415 | 574 | | |||
416 | } | 575 | } | ||
417 | } | 576 | } | ||
418 | 577 | | |||
578 | Q_DECLARE_OPERATORS_FOR_FLAGS(KWayland::Client::XdgShellSurface::States) | ||||
579 | Q_DECLARE_OPERATORS_FOR_FLAGS(KWayland::Client::XdgPositioner::Constraints) | ||||
580 | | ||||
581 | Q_DECLARE_METATYPE(KWayland::Client::XdgPositioner) | ||||
419 | Q_DECLARE_METATYPE(KWayland::Client::XdgShellSurface::State) | 582 | Q_DECLARE_METATYPE(KWayland::Client::XdgShellSurface::State) | ||
420 | Q_DECLARE_METATYPE(KWayland::Client::XdgShellSurface::States) | 583 | Q_DECLARE_METATYPE(KWayland::Client::XdgShellSurface::States) | ||
584 | Q_DECLARE_METATYPE(KWayland::Client::XdgPositioner::Constraint) | ||||
585 | Q_DECLARE_METATYPE(KWayland::Client::XdgPositioner::Constraints) | ||||
586 | | ||||
421 | 587 | | |||
422 | #endif | 588 | #endif |
In case you wanted to make those comments doxygen comments: you need to use /** instead of /*
Applies for all comments in this class.