KWayland

remote_access_interface.h
1 /*
2  SPDX-FileCopyrightText: 2016 Oleg Chernovskiy <[email protected]>
3 
4  SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
5 */
6 #ifndef KWAYLAND_SERVER_REMOTE_ACCESS_INTERFACE_H
7 #define KWAYLAND_SERVER_REMOTE_ACCESS_INTERFACE_H
8 
9 #include "global.h"
10 
11 namespace KWayland
12 {
13 namespace Server
14 {
15 class Display;
16 class OutputInterface;
17 
18 /**
19  * The structure server should fill to use this interface.
20  * Lifecycle:
21  * 1. BufferHandle is filled and passed to RemoteAccessManager
22  * (stored in manager's sent list)
23  * 2. Clients confirm that they wants this buffer, the RemoteBuffer
24  * interfaces are then created and wrapped around BufferHandle.
25  * 3. Once all clients are done with buffer (or disconnected),
26  * RemoteBuffer notifies manager and release signal is emitted.
27  *
28  * It's the responsibility of your process to delete this BufferHandle
29  * and release its' fd afterwards.
30  **/
31 class KWAYLANDSERVER_EXPORT BufferHandle
32 {
33 public:
34  explicit BufferHandle();
35  virtual ~BufferHandle();
36  void setFd(qint32 fd);
37  void setSize(quint32 width, quint32 height);
38  void setStride(quint32 stride);
39  void setFormat(quint32 format);
40 
41  qint32 fd() const;
42  quint32 height() const;
43  quint32 width() const;
44  quint32 stride() const;
45  quint32 format() const;
46 
47 private:
48  friend class RemoteAccessManagerInterface;
49  friend class RemoteBufferInterface;
50  class Private;
52 };
53 
54 class KWAYLANDSERVER_EXPORT RemoteAccessManagerInterface : public Global
55 {
56  Q_OBJECT
57 public:
58  ~RemoteAccessManagerInterface() override = default;
59 
60  /**
61  * Store buffer in sent list and notify client that we have a buffer for it
62  **/
63  void sendBufferReady(const OutputInterface *output, const BufferHandle *buf);
64  /**
65  * Check whether interface has been bound
66  **/
67  bool isBound() const;
68 
69 Q_SIGNALS:
70  /**
71  * Previously sent buffer has been released by client
72  */
73  void bufferReleased(const BufferHandle *buf);
74 
75 private:
76  explicit RemoteAccessManagerInterface(Display *display, QObject *parent = nullptr);
77  friend class Display;
78  class Private;
79 };
80 
81 }
82 }
83 
84 #endif
The structure server should fill to use this interface.
Class holding the Wayland server display loop.
Definition: display.h:86
Global for the wl_output interface.
Base class for all Globals.
Definition: global.h:46
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Mon Jan 30 2023 03:56:24 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.