1 /*
2     KWin - the KDE window manager
3     This file is part of the KDE project.
4 
5     SPDX-FileCopyrightText: 2019 Roman Gilg <subdiff@gmail.com>
6 
7     SPDX-License-Identifier: GPL-2.0-or-later
8 */
9 #ifndef KWIN_XWL_DRAG
10 #define KWIN_XWL_DRAG
11 
12 #include <QPoint>
13 #include <QObject>
14 
15 #include <xcb/xcb.h>
16 
17 namespace KWin
18 {
19 class Toplevel;
20 
21 namespace Xwl
22 {
23 enum class DragEventReply;
24 
25 /**
26  * An ongoing drag operation.
27  */
28 class Drag : public QObject
29 {
30     Q_OBJECT
31 
32 public:
33     explicit Drag(QObject *parent = nullptr);
34     ~Drag() override;
35 
36     static void sendClientMessage(xcb_window_t target, xcb_atom_t type, xcb_client_message_data_t *data);
37 
38     virtual bool handleClientMessage(xcb_client_message_event_t *event) = 0;
39     virtual DragEventReply moveFilter(Toplevel *target, const QPoint &pos) = 0;
40 
41     virtual bool end() = 0;
42 
43 Q_SIGNALS:
44     void finish(Drag *self);
45 
46 private:
47     Q_DISABLE_COPY(Drag)
48 };
49 
50 } // namespace Xwl
51 } // namespace KWin
52 
53 #endif
54