diff options
author | Jan Arne Petersen <jan.petersen@kdab.com> | 2013-11-01 12:46:22 +0100 |
---|---|---|
committer | Jørgen Lind <jorgen.lind@digia.com> | 2013-11-22 15:46:38 +0100 |
commit | d06c04238238c780b6d0019b305b4ae8c99de425 (patch) | |
tree | fa5fbf0a960e63b4525168d309ccfc78de4927fc /src/compositor/wayland_wrapper/qwldatadevice_p.h | |
parent | 19992cf8f509e178b0cb0e31df28ba30b8020057 (diff) | |
download | qtwayland-d06c04238238c780b6d0019b305b4ae8c99de425.tar.gz |
Add Drag&Drop support to compositor
Change-Id: Ic606ac4dfbb1c55ddb81ac8a912132102753455c
Reviewed-by: Jørgen Lind <jorgen.lind@digia.com>
Diffstat (limited to 'src/compositor/wayland_wrapper/qwldatadevice_p.h')
-rw-r--r-- | src/compositor/wayland_wrapper/qwldatadevice_p.h | 53 |
1 files changed, 30 insertions, 23 deletions
diff --git a/src/compositor/wayland_wrapper/qwldatadevice_p.h b/src/compositor/wayland_wrapper/qwldatadevice_p.h index 2b4acdc9..edbb517c 100644 --- a/src/compositor/wayland_wrapper/qwldatadevice_p.h +++ b/src/compositor/wayland_wrapper/qwldatadevice_p.h @@ -41,42 +41,49 @@ #ifndef WLDATADEVICE_H #define WLDATADEVICE_H -#include <private/qwldatadevicemanager_p.h> +#include <qwayland-server-wayland.h> +#include <qwlpointer_p.h> QT_BEGIN_NAMESPACE namespace QtWayland { +class Compositor; class DataSource; -class DataDeviceManager; +class InputDevice; +class Surface; -class DataDevice +class DataDevice : public QtWaylandServer::wl_data_device, public PointerGrabber { public: - DataDevice(DataDeviceManager *data_device_manager, struct wl_client *client, uint32_t id); + DataDevice(InputDevice *inputDevice); - void createAndSetSelectionSource(struct wl_client *client, uint32_t id, const char *name, uint32_t time); - void sendSelectionFocus(); + void setFocus(QtWaylandServer::wl_keyboard::Resource *focusResource); - struct wl_resource *dataDeviceResource() const; + void setDragFocus(Surface *focus, const QPointF &localPosition); + + Surface *dragIcon() const; + + void focus() Q_DECL_OVERRIDE; + void motion(uint32_t time) Q_DECL_OVERRIDE; + void button(uint32_t time, Qt::MouseButton button, uint32_t state) Q_DECL_OVERRIDE; +protected: + void data_device_start_drag(Resource *resource, struct ::wl_resource *source, struct ::wl_resource *origin, struct ::wl_resource *icon, uint32_t serial) Q_DECL_OVERRIDE; + void data_device_set_selection(Resource *resource, struct ::wl_resource *source, uint32_t serial) Q_DECL_OVERRIDE; - struct wl_display *display() const { return m_data_device_manager->display(); } private: - DataDeviceManager *m_data_device_manager; - uint32_t m_sent_selection_time; - struct wl_resource *m_data_device_resource; - - static const struct wl_data_device_interface data_device_interface; - static void start_drag(struct wl_client *client, - struct wl_resource *resource, - struct wl_resource *source, - struct wl_resource *surface, - struct wl_resource *icon, - uint32_t time); - static void set_selection(struct wl_client *client, - struct wl_resource *resource, - struct wl_resource *source, - uint32_t time); + Compositor *m_compositor; + InputDevice *m_inputDevice; + + DataSource *m_selectionSource; + + struct ::wl_client *m_dragClient; + DataSource *m_dragDataSource; + + Surface *m_dragFocus; + Resource *m_dragFocusResource; + + Surface *m_dragIcon; }; } |