summaryrefslogtreecommitdiffstats
path: root/src/compositor/wayland_wrapper
diff options
context:
space:
mode:
authorPaul Olav Tvete <paul.tvete@theqtcompany.com>2015-09-15 14:39:39 +0200
committerJørgen Lind <jorgen.lind@theqtcompany.com>2015-09-15 13:31:31 +0000
commit0345bba55ab67249fd3cda721de12b5fa1d95c36 (patch)
tree7c3db1fb27e0ca171caac44c505048cb60fb53b9 /src/compositor/wayland_wrapper
parentf5f06c709937b657c66ca4e35f4e3065ba390153 (diff)
Remove the mouse grabber
This is no longer used for move/resize, and we are going to introduce a new concept for drag and drop (which stopped working several changes ago anyway). The old drag and drop code is left commented out to assist in the new implementation. Change-Id: I18cb41d04f09d6033d1c9e666a739793fcef494b Reviewed-by: Jørgen Lind <jorgen.lind@theqtcompany.com>
Diffstat (limited to 'src/compositor/wayland_wrapper')
-rw-r--r--src/compositor/wayland_wrapper/qwldatadevice.cpp123
-rw-r--r--src/compositor/wayland_wrapper/qwldatadevice_p.h6
2 files changed, 64 insertions, 65 deletions
diff --git a/src/compositor/wayland_wrapper/qwldatadevice.cpp b/src/compositor/wayland_wrapper/qwldatadevice.cpp
index 85895ae9c..eec142a85 100644
--- a/src/compositor/wayland_wrapper/qwldatadevice.cpp
+++ b/src/compositor/wayland_wrapper/qwldatadevice.cpp
@@ -134,69 +134,72 @@ void DataDevice::sourceDestroyed(DataSource *source)
m_selectionSource = 0;
}
-void DataDevice::focus()
-{
- QWaylandView *focus = pointer->mouseFocus();
- if (focus != m_dragFocus) {
- setDragFocus(focus, pointer->currentLocalPosition());
- }
-}
-
-void DataDevice::motion(uint32_t time)
-{
- Q_EMIT m_inputDevice->drag()->positionChanged();
- Q_UNUSED(time);
-// This abstraction is wrong.
-// We might intersept hover events or something, but forget about global coordinates mapping to local coordinates
-// m_dragIconPosition = pointer->currentSpacePosition();
-
-// if (m_dragFocusResource && m_dragFocus) {
-// const QPointF &surfacePoint = outputSpace()->mapToView(m_dragFocus, pointer->currentSpacePosition());
-// send_motion(m_dragFocusResource->handle, time,
-// wl_fixed_from_double(surfacePoint.x()), wl_fixed_from_double(surfacePoint.y()));
-// }
-}
-
-void DataDevice::button(uint32_t time, Qt::MouseButton button, uint32_t state)
-{
- Q_UNUSED(time);
-
- if (m_dragFocusResource &&
- pointer->grabButton() == button &&
- state == QWaylandPointerPrivate::button_state_released)
- send_drop(m_dragFocusResource->handle);
-
- if (!pointer->isButtonPressed() &&
- state == QWaylandPointerPrivate::button_state_released) {
-
- if (m_dragIcon) {
- m_dragIcon = 0;
- m_dragIconPosition = QPointF();
- Q_EMIT m_inputDevice->drag()->positionChanged();
- Q_EMIT m_inputDevice->drag()->iconChanged();
- }
-
- setDragFocus(0, QPointF());
- pointer->endGrab();
- }
-}
+// void DataDevice::focus()
+// {
+// QWaylandView *focus = pointer->mouseFocus();
+// if (focus != m_dragFocus) {
+// setDragFocus(focus, pointer->currentLocalPosition());
+// }
+// }
+
+// void DataDevice::motion(uint32_t time)
+// {
+// Q_EMIT m_inputDevice->drag()->positionChanged();
+// Q_UNUSED(time);
+// // This abstraction is wrong.
+// // We might intersept hover events or something, but forget about global coordinates mapping to local coordinates
+// // m_dragIconPosition = pointer->currentSpacePosition();
+
+// // if (m_dragFocusResource && m_dragFocus) {
+// // const QPointF &surfacePoint = outputSpace()->mapToView(m_dragFocus, pointer->currentSpacePosition());
+// // send_motion(m_dragFocusResource->handle, time,
+// // wl_fixed_from_double(surfacePoint.x()), wl_fixed_from_double(surfacePoint.y()));
+// // }
+// }
+
+// void DataDevice::button(uint32_t time, Qt::MouseButton button, uint32_t state)
+// {
+// Q_UNUSED(time);
+
+// if (m_dragFocusResource &&
+// pointer->grabButton() == button &&
+// state == QWaylandPointerPrivate::button_state_released)
+// send_drop(m_dragFocusResource->handle);
+
+// if (!pointer->isButtonPressed() &&
+// state == QWaylandPointerPrivate::button_state_released) {
+
+// if (m_dragIcon) {
+// m_dragIcon = 0;
+// m_dragIconPosition = QPointF();
+// Q_EMIT m_inputDevice->drag()->positionChanged();
+// Q_EMIT m_inputDevice->drag()->iconChanged();
+// }
+
+// setDragFocus(0, QPointF());
+// pointer->endGrab();
+// }
+// }
void DataDevice::data_device_start_drag(Resource *resource, struct ::wl_resource *source, struct ::wl_resource *origin, struct ::wl_resource *icon, uint32_t serial)
{
- if (m_inputDevice->pointer()->grabSerial() == serial) {
- if (!m_inputDevice->pointer()->isButtonPressed() ||
- m_inputDevice->mouseFocus()->surfaceResource() != origin)
- return;
-
- m_dragClient = resource->client();
- m_dragDataSource = source != 0 ? DataSource::fromResource(source) : 0;
- m_dragIcon = icon != 0 ? QWaylandSurface::fromResource(icon) : 0;
- m_dragIconPosition = QPointF();
- Q_EMIT m_inputDevice->drag()->positionChanged();
- Q_EMIT m_inputDevice->drag()->iconChanged();
-
- m_inputDevice->pointer()->startGrab(this);
- }
+
+ qDebug() << "data_device_start_drag";
+
+ // if (m_inputDevice->pointer()->grabSerial() == serial) {
+ // if (!m_inputDevice->pointer()->isButtonPressed() ||
+ // m_inputDevice->mouseFocus()->surfaceResource() != origin)
+ // return;
+
+ // m_dragClient = resource->client();
+ // m_dragDataSource = source != 0 ? DataSource::fromResource(source) : 0;
+ // m_dragIcon = icon != 0 ? QWaylandSurface::fromResource(icon) : 0;
+ // m_dragIconPosition = QPointF();
+ // Q_EMIT m_inputDevice->drag()->positionChanged();
+ // Q_EMIT m_inputDevice->drag()->iconChanged();
+
+ // m_inputDevice->pointer()->startGrab(this);
+ // }
}
void DataDevice::data_device_set_selection(Resource *, struct ::wl_resource *source, uint32_t serial)
diff --git a/src/compositor/wayland_wrapper/qwldatadevice_p.h b/src/compositor/wayland_wrapper/qwldatadevice_p.h
index 11946df59..e440b7d86 100644
--- a/src/compositor/wayland_wrapper/qwldatadevice_p.h
+++ b/src/compositor/wayland_wrapper/qwldatadevice_p.h
@@ -38,7 +38,6 @@
#define WLDATADEVICE_H
#include <QtWaylandCompositor/private/qwayland-server-wayland.h>
-#include <QtWaylandCompositor/QWaylandPointerGrabber>
#include <QtWaylandCompositor/QWaylandInputDevice>
#include <QtWaylandCompositor/QWaylandOutputSpace>
@@ -53,7 +52,7 @@ class DataSource;
class InputDevice;
class Surface;
-class DataDevice : public QtWaylandServer::wl_data_device, public QWaylandPointerGrabber
+class DataDevice : public QtWaylandServer::wl_data_device
{
public:
DataDevice(QWaylandInputDevice *inputDevice);
@@ -67,9 +66,6 @@ public:
void sourceDestroyed(DataSource *source);
- 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;