KWayland

datadevice_interface.h
1 /*
2  SPDX-FileCopyrightText: 2014 Martin Gräßlin <[email protected]>
3 
4  SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
5 */
6 #ifndef WAYLAND_SERVER_DATA_DEVICE_INTERFACE_H
7 #define WAYLAND_SERVER_DATA_DEVICE_INTERFACE_H
8 
9 #include <QObject>
10 
11 #include <KWayland/Server/kwaylandserver_export.h>
12 
13 #include "resource.h"
14 
15 namespace KWayland
16 {
17 namespace Server
18 {
19 class DataDeviceManagerInterface;
20 class DataSourceInterface;
21 class SeatInterface;
22 class SurfaceInterface;
23 
24 /**
25  * @brief DataDeviceInterface allows clients to share data by copy-and-paste and drag-and-drop.
26  *
27  * The data device is per seat.
28  * Copy-and-paste use the selection functions.
29  *
30  * Represents the Resource for the wl_data_device interface.
31  *
32  * @see SeatInterface
33  * @see DataSourceInterface
34  **/
35 class KWAYLANDSERVER_EXPORT DataDeviceInterface : public Resource
36 {
37  Q_OBJECT
38 public:
39  ~DataDeviceInterface() override;
40 
41  SeatInterface *seat() const;
42  DataSourceInterface *dragSource() const;
43  SurfaceInterface *origin() const;
44  SurfaceInterface *icon() const;
45 
46  /**
47  * @returns the serial of the implicit grab which started the drag
48  * @since 5.6
49  **/
50  quint32 dragImplicitGrabSerial() const;
51 
52  DataSourceInterface *selection() const;
53 
54  void sendSelection(DataDeviceInterface *other);
55  void sendClearSelection();
56  /**
57  * The event is sent when a drag-and-drop operation is ended because the implicit grab is removed.
58  * @since 5.6
59  **/
60  void drop();
61  /**
62  * Updates the SurfaceInterface to which drag motion events are sent.
63  *
64  * If a SurfaceInterface was registered in this DataDeviceInterface for drag motion events, it
65  * will be sent a leave event.
66  *
67  * If @p surface is not null it will be sent a drag enter event.
68  *
69  * @param surface The SurfaceInterface which gets motion events
70  * @param serial The serial to be used for enter/leave
71  * @since 5.6
72  **/
73  void updateDragTarget(SurfaceInterface *surface, quint32 serial);
74  /**
75  * Mark this DataDeviceInterface as being a proxy device for @p remote.
76  * @since 5.56
77  **/
78  void updateProxy(SurfaceInterface *remote);
79 
80 Q_SIGNALS:
81  void dragStarted();
82  void selectionChanged(KWayland::Server::DataSourceInterface *);
83  void selectionCleared();
84 
85 private:
86  friend class DataDeviceManagerInterface;
87  explicit DataDeviceInterface(SeatInterface *seat, DataDeviceManagerInterface *parent, wl_resource *parentResource);
88 
89  class Private;
90  Private *d_func() const;
91 };
92 
93 }
94 }
95 
96 Q_DECLARE_METATYPE(KWayland::Server::DataDeviceInterface *)
97 
98 #endif
Represents a Seat on the Wayland Display.
Represents the Resource for the wl_data_source interface.
DataDeviceInterface allows clients to share data by copy-and-paste and drag-and-drop.
Represents a bound Resource.
Definition: resource.h:31
Resource representing a wl_surface.
Represents the Global for wl_data_device_manager interface.
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Mon Jan 30 2023 03:56:23 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.