Changeset View
Standalone View
src/server/xdgshell_interface.h
Show First 20 Lines • Show All 44 Lines • ▼ Show 20 Line(s) | |||||
45 | * | 45 | * | ||
46 | * @since 5.25 | 46 | * @since 5.25 | ||
47 | **/ | 47 | **/ | ||
48 | enum class XdgShellInterfaceVersion | 48 | enum class XdgShellInterfaceVersion | ||
49 | { | 49 | { | ||
50 | /** | 50 | /** | ||
51 | * xdg_shell (unstable v5) | 51 | * xdg_shell (unstable v5) | ||
52 | **/ | 52 | **/ | ||
53 | UnstableV5 | 53 | UnstableV5, | ||
54 | /** | ||||
55 | * zxdg_shell_v6 (unstable v6) | ||||
56 | * @since 5.XDGMERGE_VERSION | ||||
57 | **/ | ||||
58 | UnstableV6 | ||||
54 | }; | 59 | }; | ||
55 | 60 | | |||
61 | /* | ||||
62 | * Flags describing how a popup should be reposition if constrained | ||||
63 | * @since 5.XDGMERGE_VERSION | ||||
64 | */ | ||||
65 | enum class PositionerConstraint { | ||||
66 | /* | ||||
67 | * Slide the popup on the X axis until there is room | ||||
68 | */ | ||||
69 | SlideX = 1 << 0, | ||||
70 | /* | ||||
71 | * Slide the popup on the Y axis until there is room | ||||
72 | */ | ||||
73 | SlideY = 1 << 1, | ||||
74 | /* | ||||
75 | * Invert the anchor and gravity on the X axis | ||||
graesslin: what is "gravity"? | |||||
as far i understood, it's an hint that tells the window the direction it prefers to popup, so like "please dear compositor make it show below the point i asked to", or at the left, or whatever mart: as far i understood, it's an hint that tells the window the direction it prefers to popup, so… | |||||
76 | */ | ||||
77 | FlipX = 1 << 2, | ||||
78 | /* | ||||
79 | * Invert the anchor and gravity on the Y axis | ||||
80 | */ | ||||
We need the serial Ids here, otherwise it's not very usable; especially as the pong doesn't have an elapsed time. A kjob like API wrapping this might be perfect for here? davidedmundson: We need the serial Ids here, otherwise it's not very usable; especially as the pong doesn't… | |||||
so storing all the ids of pings in progress somewhere to make a more recent ping not cancel an older one still pending? mart: so storing all the ids of pings in progress somewhere to make a more recent ping not cancel an… | |||||
from kwin, client.cpp: void Client::pingWindow() if (!info->supportsProtocol(NET::PingProtocol)) return; // Can't ping :( if (options->killPingTimeout() == 0) return; // Turned off if (ping_timer != NULL) return; // Pinging already ping_timer = new QTimer(this); connect(ping_timer, &QTimer::timeout, this, [this]() { if (unresponsive()) { qCDebug(KWIN_CORE) << "Final ping timeout, asking to kill:" << caption(); ping_timer->deleteLater(); ping_timer = nullptr; killProcess(true, m_pingTimestamp); return; } qCDebug(KWIN_CORE) << "First ping timeout:" << caption(); setUnresponsive(true); ping_timer->start(); } ); mart: from kwin, client.cpp:
i guess that's the kwin part that will have to use this.
it uses a… | |||||
please note that this is X11 code which has a different ping concept. On Wayland we don't ping yet. graesslin: please note that this is X11 code which has a different ping concept. On Wayland we don't ping… | |||||
@davidedmundson for the ping you could check the old wl_shell_surface implementation in KWayland. graesslin: @davidedmundson for the ping you could check the old wl_shell_surface implementation in… | |||||
the implementation here in xdgshell_interface is basically copied over the kwayland wl_shell_surface. the code pasted above, is the only kwin part i found that was managing pings in any way, which is the x11 implementation (Client) mart: the implementation here in xdgshell_interface is basically copied over the kwayland… | |||||
81 | FlipY = 1 << 3, | ||||
82 | /* | ||||
83 | * Resize the popup in the X axis | ||||
84 | */ | ||||
85 | ResizeX = 1 << 4, | ||||
86 | /* | ||||
87 | * Resize the popup in the Y axis | ||||
88 | */ | ||||
89 | ResizeY = 1 << 5 | ||||
90 | }; | ||||
91 | | ||||
92 | Q_DECLARE_FLAGS(PositionerConstraints, PositionerConstraint) | ||||
93 | | ||||
56 | /** | 94 | /** | ||
57 | * | 95 | * | ||
58 | * @since 5.25 | 96 | * @since 5.25 | ||
59 | **/ | 97 | **/ | ||
60 | class KWAYLANDSERVER_EXPORT XdgShellInterface : public Global | 98 | class KWAYLANDSERVER_EXPORT XdgShellInterface : public Global | ||
61 | { | 99 | { | ||
62 | Q_OBJECT | 100 | Q_OBJECT | ||
63 | public: | 101 | public: | ||
64 | virtual ~XdgShellInterface(); | 102 | virtual ~XdgShellInterface(); | ||
65 | 103 | | |||
66 | /** | 104 | /** | ||
67 | * @returns The interface version used by this XdgShellInterface | 105 | * @returns The interface version used by this XdgShellInterface | ||
68 | **/ | 106 | **/ | ||
69 | XdgShellInterfaceVersion interfaceVersion() const; | 107 | XdgShellInterfaceVersion interfaceVersion() const; | ||
70 | 108 | | |||
71 | /** | 109 | /** | ||
72 | * @returns The XdgShellSurfaceInterface for the @p native resource. | 110 | * @returns The XdgShellSurfaceInterface for the @p native resource. | ||
73 | **/ | 111 | **/ | ||
74 | XdgShellSurfaceInterface *getSurface(wl_resource *native); | 112 | XdgShellSurfaceInterface *getSurface(wl_resource *native); | ||
75 | 113 | | |||
114 | /** | ||||
115 | * Confirm the client is still alive and responding | ||||
116 | * | ||||
117 | * Will result in pong being emitted | ||||
118 | * | ||||
119 | * @returns unique identifier for this request | ||||
120 | * @since XDGMERGE_VERSION | ||||
121 | */ | ||||
122 | quint32 ping(); | ||||
123 | | ||||
76 | Q_SIGNALS: | 124 | Q_SIGNALS: | ||
graesslin: please add what the replacement is | |||||
77 | void surfaceCreated(KWayland::Server::XdgShellSurfaceInterface *surface); | 125 | void surfaceCreated(KWayland::Server::XdgShellSurfaceInterface *surface); | ||
126 | | ||||
78 | /** | 127 | /** | ||
79 | * Emitted whenever a new popup got created. | 128 | * Emitted whenever a new popup got created. | ||
80 | * | 129 | * | ||
81 | * A popup only gets created in response to an action on the @p seat. | 130 | * A popup only gets created in response to an action on the @p seat. | ||
82 | * | 131 | * | ||
132 | * | ||||
83 | * @param surface The popup xdg shell surface which got created | 133 | * @param surface The popup xdg shell surface which got created | ||
84 | * @param seat The seat on which an action triggered the popup | 134 | * @param seat The seat on which an action triggered the popup | ||
85 | * @param serial The serial of the action on the seat | 135 | * @param serial The serial of the action on the seat | ||
136 | * | ||||
137 | * @deprecated use both xdgPopupCreated | ||||
138 | * and XdgShellPopupInterface::grabbed | ||||
86 | **/ | 139 | **/ | ||
140 | | ||||
87 | void popupCreated(KWayland::Server::XdgShellPopupInterface *surface, KWayland::Server::SeatInterface *seat, quint32 serial); | 141 | void popupCreated(KWayland::Server::XdgShellPopupInterface *surface, KWayland::Server::SeatInterface *seat, quint32 serial); | ||
88 | 142 | | |||
graesslin: can we have a better name than popupCreated2? | |||||
143 | /* | ||||
144 | * Emitted whenever a new popup gets created. | ||||
145 | * | ||||
graesslin: documentation missing | |||||
146 | * @param surface The popup xdg shell surface which got created | ||||
147 | * @since XDGMERGE_VERSION | ||||
148 | */ | ||||
149 | void xdgPopupCreated(KWayland::Server::XdgShellPopupInterface *surface); | ||||
150 | | ||||
151 | /* | ||||
152 | * Emitted in response to a ping request | ||||
153 | * | ||||
154 | * @param serial unique identifier for the request | ||||
155 | * @since XDGMERGE_VERSION | ||||
156 | */ | ||||
157 | void pongReceived(quint32 serial); | ||||
158 | | ||||
159 | /* | ||||
160 | * Emitted when the application takes more than expected | ||||
161 | * to answer to a ping, this will always be emitted before | ||||
162 | * eventuallt pingTimeout gets emitted | ||||
163 | * | ||||
164 | * @param serial unique identifier for the request | ||||
165 | * @since XDGMERGE_VERSION | ||||
166 | */ | ||||
167 | void pingDelayed(quint32 serial); | ||||
168 | | ||||
169 | /* | ||||
170 | * Emitted when the application doesn't answer to a ping | ||||
171 | * and the serve gave up on it | ||||
172 | * | ||||
173 | * @param serial unique identifier for the request | ||||
174 | * @since XDGMERGE_VERSION | ||||
175 | */ | ||||
176 | void pingTimeout(quint32 serial); | ||||
177 | | ||||
89 | protected: | 178 | protected: | ||
90 | class Private; | 179 | class Private; | ||
91 | explicit XdgShellInterface(Private *d, QObject *parent = nullptr); | 180 | explicit XdgShellInterface(Private *d, QObject *parent = nullptr); | ||
92 | 181 | | |||
93 | private: | 182 | private: | ||
94 | Private *d_func() const; | 183 | Private *d_func() const; | ||
95 | }; | 184 | }; | ||
96 | 185 | | |||
▲ Show 20 Lines • Show All 137 Lines • ▼ Show 20 Line(s) | 275 | Q_SIGNALS: | |||
234 | void configureAcknowledged(quint32 serial); | 323 | void configureAcknowledged(quint32 serial); | ||
235 | /** | 324 | /** | ||
236 | * Emitted whenever the parent surface changes. | 325 | * Emitted whenever the parent surface changes. | ||
237 | * @see isTransient | 326 | * @see isTransient | ||
238 | * @see transientFor | 327 | * @see transientFor | ||
239 | **/ | 328 | **/ | ||
240 | void transientForChanged(); | 329 | void transientForChanged(); | ||
241 | 330 | | |||
331 | /** | ||||
332 | * Emitted whenever the maximun size hint changes | ||||
333 | * @since 5.XDGMERGE_VERSION | ||||
334 | */ | ||||
335 | void maxSizeChanged(const QSize &size); | ||||
336 | | ||||
337 | /** | ||||
338 | * Emitted whenever the minimum size hint changes | ||||
339 | * @since 5.XDGMERGE_VERSION | ||||
340 | */ | ||||
341 | void minSizeChanged(const QSize &size); | ||||
342 | | ||||
242 | protected: | 343 | protected: | ||
243 | class Private; | 344 | class Private; | ||
244 | explicit XdgShellSurfaceInterface(Private *p); | 345 | explicit XdgShellSurfaceInterface(Private *p); | ||
245 | 346 | | |||
246 | private: | 347 | private: | ||
247 | Private *d_func() const; | 348 | Private *d_func() const; | ||
248 | friend class GenericShellSurface<XdgShellSurfaceInterface>; | 349 | friend class GenericShellSurface<XdgShellSurfaceInterface>; | ||
249 | }; | 350 | }; | ||
250 | 351 | | |||
251 | /** | 352 | /** | ||
252 | * | 353 | * | ||
253 | * @since 5.25 | 354 | * @since 5.25 | ||
254 | **/ | 355 | **/ | ||
255 | class KWAYLANDSERVER_EXPORT XdgShellPopupInterface : public Resource | 356 | class KWAYLANDSERVER_EXPORT XdgShellPopupInterface : public Resource | ||
256 | { | 357 | { | ||
257 | Q_OBJECT | 358 | Q_OBJECT | ||
258 | public: | 359 | public: | ||
259 | virtual ~XdgShellPopupInterface(); | 360 | virtual ~XdgShellPopupInterface(); | ||
260 | 361 | | |||
261 | /** | 362 | /** | ||
262 | * @return The SurfaceInterface this XdgShellPopupInterface got created for. | 363 | * @return The SurfaceInterface this XdgShellPopupInterface got created for. | ||
263 | **/ | 364 | **/ | ||
264 | SurfaceInterface *surface() const; | 365 | SurfaceInterface *surface() const; | ||
265 | 366 | | |||
367 | /* | ||||
368 | * Ask the popup surface to configure itself for the given configuration. | ||||
369 | * | ||||
370 | * @arg rect. The position of the surface relative to the transient parent | ||||
371 | * @since 5.XDGMERGE_VERSION | ||||
372 | */ | ||||
373 | quint32 configure(const QRect &rect); | ||||
374 | | ||||
266 | /** | 375 | /** | ||
267 | * @returns the parent surface. | 376 | * @returns the parent surface. | ||
268 | * @see transientOffset | 377 | * @see transientOffset | ||
269 | **/ | 378 | **/ | ||
270 | QPointer<SurfaceInterface> transientFor() const; | 379 | QPointer<SurfaceInterface> transientFor() const; | ||
380 | | ||||
271 | /** | 381 | /** | ||
272 | * The offset of the Surface in the coordinate system of the SurfaceInterface this surface is a transient for. | 382 | * The offset of the Surface in the coordinate system of the SurfaceInterface this surface is a transient for. | ||
273 | * | 383 | * | ||
384 | * For XDG V6 this returns the point on the anchorRect defined by the anchor edge. | ||||
385 | * | ||||
274 | * @returns offset in parent coordinate system. | 386 | * @returns offset in parent coordinate system. | ||
275 | * @see transientFor | 387 | * @see transientFor | ||
276 | **/ | 388 | **/ | ||
277 | QPoint transientOffset() const; | 389 | QPoint transientOffset() const; | ||
278 | 390 | | |||
391 | /* | ||||
392 | * The size of the surface that is to be positioned. | ||||
393 | * | ||||
394 | * @since 5.XDGMERGE_VERSION | ||||
395 | */ | ||||
396 | QSize initialSize() const; | ||||
397 | | ||||
398 | /* | ||||
399 | * The area this popup should be positioned around | ||||
400 | * @since 5.XDGMERGE_VERSION | ||||
401 | */ | ||||
402 | QRect anchorRect() const; | ||||
403 | | ||||
404 | /* | ||||
405 | * Which edge of the anchor should the popup be positioned around | ||||
406 | * @since 5.XDGMERGE_VERSION | ||||
407 | */ | ||||
408 | Qt::Edges anchorEdge() const; | ||||
409 | | ||||
410 | /* | ||||
411 | * An additional offset that should be applied to the popup from the anchor rect | ||||
412 | * | ||||
413 | * @since 5.XDGMERGE_VERSION | ||||
414 | */ | ||||
415 | QPoint anchorOffset() const; | ||||
416 | | ||||
417 | /* | ||||
418 | * Specifies in what direction the popup should be positioned around the anchor | ||||
419 | * i.e if the gravity is "bottom", then then the top of top of the poup will be at the anchor edge | ||||
420 | * if the gravity is top, then the bottom of the popup will be at the anchor edge | ||||
421 | * | ||||
422 | * @since 5.XDGMERGE_VERSION | ||||
423 | */ | ||||
424 | | ||||
425 | //DAVE left + right is illegal, so this is possible a useless return value? Maybe an enum with 9 entries left, topleft, top, .. | ||||
426 | Qt::Edges gravity() const; | ||||
427 | | ||||
428 | /* | ||||
429 | * Specifies how the compositor should position the popup if it does not fit in the requested position | ||||
430 | * @since 5.XDGMERGE_VERSION | ||||
431 | */ | ||||
432 | PositionerConstraints constraintAdjustments() const; | ||||
433 | | ||||
279 | /** | 434 | /** | ||
280 | * Dismiss this popup. This indicates to the client that it should destroy this popup. | 435 | * Dismiss this popup. This indicates to the client that it should destroy this popup. | ||
281 | * The Compositor can invoke this method when e.g. the user clicked outside the popup | 436 | * The Compositor can invoke this method when e.g. the user clicked outside the popup | ||
282 | * to dismiss it. | 437 | * to dismiss it. | ||
283 | **/ | 438 | **/ | ||
284 | void popupDone(); | 439 | void popupDone(); | ||
285 | 440 | | |||
441 | Q_SIGNALS: | ||||
442 | /** | ||||
443 | * A configure event with @p serial got acknowledged. | ||||
444 | * @see configure | ||||
445 | * @since 5.XDGMERGE_VERSION | ||||
446 | **/ | ||||
447 | void configureAcknowledged(quint32 serial); | ||||
448 | | ||||
449 | /* | ||||
450 | * The client requested that this popup gets a grab event | ||||
451 | * | ||||
452 | * @param seat The seat on which an action triggered the popup | ||||
453 | * @param serial The serial of the action on the seat | ||||
454 | * @since 5.XDGMERGE_VERSION | ||||
455 | */ | ||||
456 | void grabbed(KWayland::Server::SeatInterface *seat, quint32 serial); | ||||
457 | | ||||
286 | protected: | 458 | protected: | ||
If it's something the client request, I would suggest a rename to grabRequested. Could you please explain what "grab" is supposed to be? graesslin: If it's something the client request, I would suggest a rename to grabRequested.
Could you… | |||||
287 | class Private; | 459 | class Private; | ||
288 | explicit XdgShellPopupInterface(Private *p); | 460 | explicit XdgShellPopupInterface(Private *p); | ||
289 | 461 | | |||
290 | private: | 462 | private: | ||
291 | friend class GenericShellSurface<XdgShellPopupInterface>; | 463 | friend class GenericShellSurface<XdgShellPopupInterface>; | ||
292 | 464 | | |||
293 | Private *d_func() const; | 465 | Private *d_func() const; | ||
294 | }; | 466 | }; | ||
Show All 10 Lines |
what is "gravity"?