summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJørgen Lind <jorgen.lind@theqtcompany.com>2015-09-14 12:35:52 +0200
committerPaul Olav Tvete <paul.tvete@theqtcompany.com>2015-09-14 12:17:05 +0000
commitf5f06c709937b657c66ca4e35f4e3065ba390153 (patch)
tree1019883bf566cc7de6d86b9cd2ab4f43b342b26c
parent2deffa537c82e2f21e01dff5c8f5ba283dd06032 (diff)
Remove global coordinates
This involves removing: - pickView and mapView from QWaylandOutput - requestedPos[X,Y] from QWaylandView Change-Id: Ie53eef434ac6ae7d0d5474f649f78a59ae857167 Reviewed-by: Paul Olav Tvete <paul.tvete@theqtcompany.com>
-rw-r--r--examples/wayland/pure-qml/qml/Chrome.qml13
-rw-r--r--examples/wayland/pure-qml/qml/main.qml35
-rw-r--r--src/compositor/compositor_api/qwaylandkeyboard.cpp2
-rw-r--r--src/compositor/compositor_api/qwaylandoutput.cpp21
-rw-r--r--src/compositor/compositor_api/qwaylandoutput.h3
-rw-r--r--src/compositor/compositor_api/qwaylandoutputspace.cpp22
-rw-r--r--src/compositor/compositor_api/qwaylandoutputspace.h4
-rw-r--r--src/compositor/compositor_api/qwaylandquickitem.cpp10
-rw-r--r--src/compositor/compositor_api/qwaylandquickitem.h6
-rw-r--r--src/compositor/compositor_api/qwaylandtouch.cpp4
-rw-r--r--src/compositor/compositor_api/qwaylandview.cpp45
-rw-r--r--src/compositor/compositor_api/qwaylandview.h13
-rw-r--r--src/compositor/extensions/qwaylandshell.cpp379
-rw-r--r--src/compositor/extensions/qwaylandshell.h70
-rw-r--r--src/compositor/extensions/qwaylandshell_p.h99
-rw-r--r--src/compositor/extensions/qwlqttouch.cpp6
-rw-r--r--src/compositor/wayland_wrapper/qwldatadevice.cpp17
-rw-r--r--src/imports/compositor/qwaylandquickcompositorplugin.cpp5
18 files changed, 150 insertions, 604 deletions
diff --git a/examples/wayland/pure-qml/qml/Chrome.qml b/examples/wayland/pure-qml/qml/Chrome.qml
index 4a365fc7b..f52582816 100644
--- a/examples/wayland/pure-qml/qml/Chrome.qml
+++ b/examples/wayland/pure-qml/qml/Chrome.qml
@@ -43,8 +43,6 @@ import QtWayland.Compositor 1.0
WaylandQuickItem {
id: rootChrome
- x: clampXPos()
- y: clampYPos()
onSurfaceDestroyed: {
lockedBuffer = true;
@@ -69,15 +67,4 @@ WaylandQuickItem {
}
]
- function clampXPos() {
- if (!parent)
- return view.requestedXPosition;
- return Math.max(Math.min(view.requestedXPosition, parent.width - 10), 0)
- }
- function clampYPos() {
- if (!parent)
- return view.requestedYPosition;
- return Math.max(Math.min(view.requestedYPosition, parent.height - 30), 0)
- }
-
}
diff --git a/examples/wayland/pure-qml/qml/main.qml b/examples/wayland/pure-qml/qml/main.qml
index 12f6063b4..7f47e1325 100644
--- a/examples/wayland/pure-qml/qml/main.qml
+++ b/examples/wayland/pure-qml/qml/main.qml
@@ -53,7 +53,8 @@ WaylandCompositor {
Component {
id: chromeComponent
- Chrome { }
+ Chrome {
+ }
}
Component {
@@ -69,13 +70,38 @@ WaylandCompositor {
Component {
id: shellSurfaceComponent
- DefaultShellSurface { }
+ DefaultShellSurface {
+ property Item chrome
+ property var previousMousePosition
+ property var originalInputEventsEnabled
+ Connections {
+ target: chrome ? chrome : null
+ onMouseMove: {
+ var deltaX = windowPosition.x - previousMousePosition.x
+ var deltaY = windowPosition.y - previousMousePosition.y
+ chrome.x = chrome.x + deltaX
+ chrome.y = chrome.y + deltaY
+ previousMousePosition = windowPosition;
+ }
+ onMouseRelease: {
+ chrome.inputEventsEnabled = originalInputEventsEnabled;
+ }
+ }
+
+ onStartMove: {
+ previousMousePosition = chrome.mousePressPosition
+ originalInputEventsEnabled = chrome.inputEventsEnabled
+ chrome.inputEventsEnabled = false;
+ }
+
+ }
}
onCreateShellSurface: {
var item = chromeComponent.createObject(defaultOutput.surfaceArea, { "surface": surface } );
- var shellSurface = shellSurfaceComponent.createObject();
- shellSurface.initialize(defaultShell, surface, item.view, client, id);
+ var shellSurface = shellSurfaceComponent.createObject( null, { "chrome": item });
+ shellSurface.chrome = item;
+ shellSurface.initialize(defaultShell, surface, client, id);
surface.shellSurface = shellSurface;
}
@@ -88,6 +114,7 @@ WaylandCompositor {
onCreateSurface: {
var surface = surfaceComponent.createObject(0, { } );
surface.initialize(compositor, client, id, version);
+
}
Component.onCompleted: {
diff --git a/src/compositor/compositor_api/qwaylandkeyboard.cpp b/src/compositor/compositor_api/qwaylandkeyboard.cpp
index b61dd562a..08fd783ab 100644
--- a/src/compositor/compositor_api/qwaylandkeyboard.cpp
+++ b/src/compositor/compositor_api/qwaylandkeyboard.cpp
@@ -400,7 +400,7 @@ bool QWaylandKeyboard::setFocus(QWaylandSurface *surface)
{
Q_D(QWaylandKeyboard);
QWaylandShellSurface *shellsurface = QWaylandShellSurface::findIn(surface);
- if (shellsurface && shellsurface->isTransientInactive())
+ if (shellsurface && shellsurface->focusPolicy() == QWaylandShellSurface::NoKeyboardFocus)
return false;
d->grab->focused(surface);
return true;
diff --git a/src/compositor/compositor_api/qwaylandoutput.cpp b/src/compositor/compositor_api/qwaylandoutput.cpp
index 2b027cdd4..7c93d2563 100644
--- a/src/compositor/compositor_api/qwaylandoutput.cpp
+++ b/src/compositor/compositor_api/qwaylandoutput.cpp
@@ -566,27 +566,6 @@ void QWaylandOutput::surfaceLeave(QWaylandSurface *surface)
QWaylandSurfacePrivate::get(surface)->send_leave(resourceForClient(surface->client()));
}
-QWaylandView *QWaylandOutput::pickView(const QPointF &outputPosition) const
-{
- Q_D(const QWaylandOutput);
- for (int nSurface = 0; nSurface < d->surfaceViews.size(); nSurface++) {
- const QWaylandSurface *surface = d->surfaceViews.at(nSurface).surface;
- if (surface->isCursorSurface())
- continue;
- const QVector<QWaylandView *> views = d->surfaceViews.at(nSurface).views;
- for (int nView = 0; nView < views.size(); nView++) {
- if (QRectF(views.at(nView)->requestedPosition(), surface->size()).contains(outputPosition))
- return views.at(nView);
- }
- }
- return Q_NULLPTR;
-}
-
-QPointF QWaylandOutput::mapToView(QWaylandView *view, const QPointF &outputPosition) const
-{
- return outputPosition - view->requestedPosition();
-}
-
void QWaylandOutput::setWidth(int newWidth)
{
Q_D(QWaylandOutput);
diff --git a/src/compositor/compositor_api/qwaylandoutput.h b/src/compositor/compositor_api/qwaylandoutput.h
index 5f4d9fab2..38f624130 100644
--- a/src/compositor/compositor_api/qwaylandoutput.h
+++ b/src/compositor/compositor_api/qwaylandoutput.h
@@ -165,9 +165,6 @@ public:
virtual void update();
- Q_INVOKABLE virtual QWaylandView *pickView(const QPointF &outputPosition) const;
- Q_INVOKABLE virtual QPointF mapToView(QWaylandView *view, const QPointF &surfacePosition) const;
-
Q_INVOKABLE QPointF mapToOutputSpace(const QPointF &point);
Q_SIGNALS:
diff --git a/src/compositor/compositor_api/qwaylandoutputspace.cpp b/src/compositor/compositor_api/qwaylandoutputspace.cpp
index b5a45cb1e..d17bc7bbf 100644
--- a/src/compositor/compositor_api/qwaylandoutputspace.cpp
+++ b/src/compositor/compositor_api/qwaylandoutputspace.cpp
@@ -132,26 +132,4 @@ QList<QWaylandOutput *>QWaylandOutputSpace::outputs(const QPoint &point) const
return retOutputs;
}
-QWaylandView *QWaylandOutputSpace::pickView(const QPointF &globalPosition) const
-{
- Q_D(const QWaylandOutputSpace);
- foreach (QWaylandOutput *output, d->outputs) {
- if (!QRectF(output->geometry()).contains(globalPosition))
- continue;
- output->pickView(globalPosition);
- }
-
- return 0;
-}
-
-QPointF QWaylandOutputSpace::mapToView(QWaylandView *view, const QPointF &globalPosition) const
-{
- return globalPosition - (view->requestedPosition() + view->output()->geometry().topLeft());
-}
-
-QPointF QWaylandOutputSpace::mapToSpace(QWaylandView *view, const QPointF &local) const
-{
- return local + view->requestedPosition() + view->output()->geometry().topLeft();
-}
-
QT_END_NAMESPACE
diff --git a/src/compositor/compositor_api/qwaylandoutputspace.h b/src/compositor/compositor_api/qwaylandoutputspace.h
index 8531c2290..5400febb8 100644
--- a/src/compositor/compositor_api/qwaylandoutputspace.h
+++ b/src/compositor/compositor_api/qwaylandoutputspace.h
@@ -80,10 +80,6 @@ public:
Q_INVOKABLE QList<QWaylandOutput *>outputs() const;
Q_INVOKABLE QList<QWaylandOutput *>outputs(const QPoint &point) const;
- Q_INVOKABLE QWaylandView *pickView(const QPointF &globalPosition) const;
- Q_INVOKABLE QPointF mapToView(QWaylandView *view, const QPointF &spacePoint) const;
- Q_INVOKABLE QPointF mapToSpace(QWaylandView *view, const QPointF &local) const;
-
Q_SIGNALS:
void geometryConstraintChanged();
void geometryChanged();
diff --git a/src/compositor/compositor_api/qwaylandquickitem.cpp b/src/compositor/compositor_api/qwaylandquickitem.cpp
index f0a592927..21d17e77b 100644
--- a/src/compositor/compositor_api/qwaylandquickitem.cpp
+++ b/src/compositor/compositor_api/qwaylandquickitem.cpp
@@ -194,6 +194,8 @@ QSGTextureProvider *QWaylandQuickItem::textureProvider() const
void QWaylandQuickItem::mousePressEvent(QMouseEvent *event)
{
+ m_mousePressPosition = event->windowPos();
+
if (!shouldSendInputEvents()) {
event->ignore();
return;
@@ -218,16 +220,19 @@ void QWaylandQuickItem::mouseMoveEvent(QMouseEvent *event)
QWaylandInputDevice *inputDevice = compositor()->inputDeviceFor(event);
inputDevice->sendMouseMoveEvent(m_view.data(), event->localPos(), event->windowPos());
} else {
+ emit mouseMove(event->windowPos());
event->ignore();
}
}
void QWaylandQuickItem::mouseReleaseEvent(QMouseEvent *event)
{
+ m_mousePressPosition = QPointF();
if (shouldSendInputEvents()) {
QWaylandInputDevice *inputDevice = compositor()->inputDeviceFor(event);
inputDevice->sendMouseReleaseEvent(event->button());
} else {
+ emit mouseRelease();
event->ignore();
}
}
@@ -434,6 +439,11 @@ void QWaylandQuickItem::setFocusOnClick(bool focus)
emit focusOnClickChanged();
}
+QPointF QWaylandQuickItem::mousePressPosition() const
+{
+ return m_mousePressPosition;
+}
+
/*!
\qmlproperty bool QtWayland::QWaylandSurfaceItem::paintEnabled
diff --git a/src/compositor/compositor_api/qwaylandquickitem.h b/src/compositor/compositor_api/qwaylandquickitem.h
index 10355df2d..57dd91f0a 100644
--- a/src/compositor/compositor_api/qwaylandquickitem.h
+++ b/src/compositor/compositor_api/qwaylandquickitem.h
@@ -67,6 +67,7 @@ class Q_COMPOSITOR_EXPORT QWaylandQuickItem : public QQuickItem
Q_PROPERTY(bool resizeSurfaceToItem READ resizeSurfaceToItem WRITE setResizeSurfaceToItem NOTIFY resizeSurfaceToItemChanged)
Q_PROPERTY(bool inputEventsEnabled READ inputEventsEnabled WRITE setInputEventsEnabled NOTIFY inputEventsEnabledChanged)
Q_PROPERTY(bool focusOnClick READ focusOnClick WRITE setFocusOnClick NOTIFY focusOnClickChanged)
+ Q_PROPERTY(QPointF mousePressPosition READ mousePressPosition)
public:
QWaylandQuickItem(QQuickItem *parent = 0);
@@ -98,6 +99,8 @@ public:
bool focusOnClick() const;
void setFocusOnClick(bool focus);
+ QPointF mousePressPosition() const;
+
protected:
void mousePressEvent(QMouseEvent *event);
void mouseMoveEvent(QMouseEvent *event);
@@ -134,6 +137,8 @@ Q_SIGNALS:
void surfaceDestroyed();
void inputEventsEnabledChanged();
void focusOnClickChanged();
+ void mouseMove(const QPointF &windowPosition);
+ void mouseRelease();
protected:
QSGNode *updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData *);
@@ -157,6 +162,7 @@ private:
QQuickWindow *m_connectedWindow;
QWaylandSurface::Origin m_origin;
+ QPointF m_mousePressPosition;
};
QT_END_NAMESPACE
diff --git a/src/compositor/compositor_api/qwaylandtouch.cpp b/src/compositor/compositor_api/qwaylandtouch.cpp
index 61a018b03..e417ab8ea 100644
--- a/src/compositor/compositor_api/qwaylandtouch.cpp
+++ b/src/compositor/compositor_api/qwaylandtouch.cpp
@@ -200,12 +200,10 @@ void QWaylandTouch::sendFullTouchEvent(QTouchEvent *event)
return;
const int pointCount = points.count();
- QPointF pos = d->seat->mouseFocus()->requestedPosition();
for (int i = 0; i < pointCount; ++i) {
const QTouchEvent::TouchPoint &tp(points.at(i));
// Convert the local pos in the compositor window to surface-relative.
- QPointF p = tp.pos() - pos;
- sendTouchPointEvent(tp.id(), p, tp.state());
+ sendTouchPointEvent(tp.id(), tp.pos(), tp.state());
}
sendFrameEvent();
}
diff --git a/src/compositor/compositor_api/qwaylandview.cpp b/src/compositor/compositor_api/qwaylandview.cpp
index ecc337bb4..7f1d3b93d 100644
--- a/src/compositor/compositor_api/qwaylandview.cpp
+++ b/src/compositor/compositor_api/qwaylandview.cpp
@@ -144,51 +144,6 @@ void QWaylandView::setOutput(QWaylandOutput *newOutput)
emit outputChanged();
}
-void QWaylandView::setRequestedPosition(const QPointF &pos)
-{
- Q_D(QWaylandView);
- bool xChanged = !qFuzzyCompare(pos.x(), d->requestedPos.x());
- bool yChanged = !qFuzzyCompare(pos.y(), d->requestedPos.y());
- if (xChanged || yChanged) {
- d->requestedPos = pos;
- emit requestedPositionChanged();
- }
- if (xChanged)
- emit requestedXPositionChanged();
- if (yChanged)
- emit requestedYPositionChanged();
-}
-
-QPointF QWaylandView::requestedPosition() const
-{
- Q_D(const QWaylandView);
- return d->requestedPos;
-}
-
-qreal QWaylandView::requestedXPosition() const
-{
- Q_D(const QWaylandView);
- return d->requestedPos.x();
-}
-
-void QWaylandView::setRequestedXPosition(qreal xPos)
-{
- Q_D(QWaylandView);
- setRequestedPosition(QPointF(xPos, d->requestedPos.y()));
-}
-
-qreal QWaylandView::requestedYPosition() const
-{
- Q_D(const QWaylandView);
- return d->requestedPos.y();
-}
-
-void QWaylandView::setRequestedYPosition(qreal yPos)
-{
- Q_D(QWaylandView);
- setRequestedPosition(QPointF(d->requestedPos.x(), yPos));
-}
-
void QWaylandView::attach(const QWaylandBufferRef &ref, const QRegion &damage)
{
Q_D(QWaylandView);
diff --git a/src/compositor/compositor_api/qwaylandview.h b/src/compositor/compositor_api/qwaylandview.h
index 47d1f9112..7eba0c809 100644
--- a/src/compositor/compositor_api/qwaylandview.h
+++ b/src/compositor/compositor_api/qwaylandview.h
@@ -56,9 +56,6 @@ class Q_COMPOSITOR_EXPORT QWaylandView : public QObject
Q_PROPERTY(QObject *renderObject READ renderObject CONSTANT)
Q_PROPERTY(QWaylandSurface *surface READ surface WRITE setSurface NOTIFY surfaceChanged)
Q_PROPERTY(QWaylandOutput *output READ output WRITE setOutput NOTIFY outputChanged)
- Q_PROPERTY(QPointF requestedPosition READ requestedPosition WRITE setRequestedPosition NOTIFY requestedPositionChanged)
- Q_PROPERTY(qreal requestedXPosition READ requestedXPosition WRITE setRequestedXPosition NOTIFY requestedXPositionChanged)
- Q_PROPERTY(qreal requestedYPosition READ requestedYPosition WRITE setRequestedYPosition NOTIFY requestedYPositionChanged)
Q_PROPERTY(bool bufferLock READ isBufferLocked WRITE setBufferLock NOTIFY bufferLockChanged)
public:
QWaylandView(QObject *renderObject = 0, QObject *parent = 0);
@@ -72,13 +69,6 @@ public:
QWaylandOutput *output() const;
void setOutput(QWaylandOutput *output);
- QPointF requestedPosition() const;
- void setRequestedPosition(const QPointF &pos);
- qreal requestedXPosition() const;
- void setRequestedXPosition(qreal xPos);
- qreal requestedYPosition() const;
- void setRequestedYPosition(qreal yPos);
-
virtual void attach(const QWaylandBufferRef &ref, const QRegion &damage);
virtual bool advance();
virtual void discardCurrentBuffer();
@@ -94,9 +84,6 @@ Q_SIGNALS:
void surfaceChanged();
void surfaceDestroyed();
void outputChanged();
- void requestedPositionChanged();
- void requestedXPositionChanged();
- void requestedYPositionChanged();
void bufferLockChanged();
};
diff --git a/src/compositor/extensions/qwaylandshell.cpp b/src/compositor/extensions/qwaylandshell.cpp
index 25e5e4ec8..cb8ccf778 100644
--- a/src/compositor/extensions/qwaylandshell.cpp
+++ b/src/compositor/extensions/qwaylandshell.cpp
@@ -55,14 +55,6 @@ QWaylandShellPrivate::QWaylandShellPrivate()
{
}
-QWaylandShellSurfacePopupGrabber *QWaylandShellPrivate::getPopupGrabber(QWaylandInputDevice *input)
-{
- if (!m_popupGrabber.contains(input))
- m_popupGrabber.insert(input, new QWaylandShellSurfacePopupGrabber(input));
-
- return m_popupGrabber.value(input);
-}
-
void QWaylandShellPrivate::shell_get_shell_surface(Resource *resource, uint32_t id, struct ::wl_resource *surface_res)
{
Q_Q(QWaylandShell);
@@ -76,24 +68,12 @@ QWaylandShellSurfacePrivate::QWaylandShellSurfacePrivate()
, wl_shell_surface()
, m_shell(Q_NULLPTR)
, m_surface(Q_NULLPTR)
- , m_view(0)
- , m_resizeGrabber(0)
- , m_moveGrabber(0)
- , m_popupGrabber(0)
- , m_popupSerial()
- , m_surfaceType(QWaylandShellSurface::None)
- , m_transientInactive(false)
- , m_transientParent(0)
- , m_transientOffset()
+ , m_focusPolicy(QWaylandShellSurface::DefaultFocus)
{
}
QWaylandShellSurfacePrivate::~QWaylandShellSurfacePrivate()
{
- QPointer<QObject> view(m_view);
- if (m_view->renderObject())
- delete m_view->renderObject();
- delete view.data();
}
void QWaylandShellSurfacePrivate::ping()
@@ -108,89 +88,44 @@ void QWaylandShellSurfacePrivate::ping(uint32_t serial)
send_ping(serial);
}
-void QWaylandShellSurfacePrivate::setSurfaceType(QWaylandShellSurface::SurfaceType type)
-{
- Q_Q(QWaylandShellSurface);
- if (m_surfaceType == type)
- return;
-
- m_surfaceType = type;
- emit q->surfaceTypeChanged();
-}
-
-void QWaylandShellSurfacePrivate::resetResizeGrabber()
-{
- m_resizeGrabber = 0;
-}
-
-void QWaylandShellSurfacePrivate::resetMoveGrabber()
-{
- m_moveGrabber = 0;
-}
-
void QWaylandShellSurfacePrivate::shell_surface_destroy_resource(Resource *)
{
Q_Q(QWaylandShellSurface);
- if (m_popupGrabber)
- m_popupGrabber->removePopup(q);
delete q;
}
void QWaylandShellSurfacePrivate::shell_surface_move(Resource *resource,
struct wl_resource *input_device_super,
- uint32_t time)
+ uint32_t serial)
{
Q_UNUSED(resource);
- Q_UNUSED(time);
+ Q_UNUSED(serial);
Q_Q(QWaylandShellSurface);
- if (!m_view)
- return;
- if (m_resizeGrabber || m_moveGrabber) {
- return;
- }
-
QWaylandInputDevice *input_device = QWaylandInputDevice::fromSeatResource(input_device_super);
- QWaylandPointer *pointer = input_device->pointer();
-
- m_moveGrabber = new QWaylandShellSurfaceMoveGrabber(q, pointer->currentSpacePosition() - m_view->requestedPosition());
-
- pointer->startGrab(m_moveGrabber);
+ emit q->startMove(input_device);
}
void QWaylandShellSurfacePrivate::shell_surface_resize(Resource *resource,
struct wl_resource *input_device_super,
- uint32_t time,
+ uint32_t serial,
uint32_t edges)
{
Q_UNUSED(resource);
- Q_UNUSED(time);
+ Q_UNUSED(serial);
Q_Q(QWaylandShellSurface);
- if (m_moveGrabber || m_resizeGrabber) {
- return;
- }
-
- m_resizeGrabber = new QWaylandShellSurfaceResizeGrabber(q);
-
QWaylandInputDevice *input_device = QWaylandInputDevice::fromSeatResource(input_device_super);
- QWaylandPointer *pointer = input_device->pointer();
-
- m_resizeGrabber->point = pointer->currentSpacePosition();
- m_resizeGrabber->resize_edges = static_cast<wl_shell_surface_resize>(edges);
- m_resizeGrabber->width = m_surface->size().width();
- m_resizeGrabber->height = m_surface->size().height();
-
- pointer->startGrab(m_resizeGrabber);
+ emit q->startResize(input_device, QWaylandShellSurface::ResizeEdge(edges));
}
void QWaylandShellSurfacePrivate::shell_surface_set_toplevel(Resource *resource)
{
Q_UNUSED(resource);
- m_transientParent = 0;
- m_transientOffset = QPointF();
- setSurfaceType(QWaylandShellSurface::Toplevel);
+ Q_Q(QWaylandShellSurface);
+ setFocusPolicy(QWaylandShellSurface::DefaultFocus);
+ emit q->setDefaultToplevel();
}
void QWaylandShellSurfacePrivate::shell_surface_set_transient(Resource *resource,
@@ -201,16 +136,13 @@ void QWaylandShellSurfacePrivate::shell_surface_set_transient(Resource *resource
{
Q_UNUSED(resource);
- Q_UNUSED(flags);
+ Q_Q(QWaylandShellSurface);
QWaylandSurface *parent_surface = QWaylandSurface::fromResource(parent_surface_resource);
- m_transientParent = parent_surface;
- m_transientOffset= QPointF(x, y);
- if (flags & WL_SHELL_SURFACE_TRANSIENT_INACTIVE)
- m_transientInactive = true;
- else
- m_transientInactive = false;
-
- setSurfaceType(QWaylandShellSurface::Transient);
+ QWaylandShellSurface::FocusPolicy focusPolicy =
+ flags & WL_SHELL_SURFACE_TRANSIENT_INACTIVE ? QWaylandShellSurface::NoKeyboardFocus
+ : QWaylandShellSurface::DefaultFocus;
+ setFocusPolicy(focusPolicy);
+ emit q->setTransient(parent_surface, QPoint(x,y), focusPolicy);
}
void QWaylandShellSurfacePrivate::shell_surface_set_fullscreen(Resource *resource,
@@ -221,45 +153,24 @@ void QWaylandShellSurfacePrivate::shell_surface_set_fullscreen(Resource *resourc
Q_UNUSED(resource);
Q_UNUSED(method);
Q_UNUSED(framerate);
+ Q_Q(QWaylandShellSurface);
+ setFocusPolicy(QWaylandShellSurface::DefaultFocus);
QWaylandOutput *output = output_resource
? QWaylandOutput::fromResource(output_resource)
: Q_NULLPTR;
- if (!output) {
- // Look for an output that can contain this surface
- Q_FOREACH (QWaylandOutput *curOutput, m_surface->compositor()->defaultOutputSpace()->outputs()) {
- if (curOutput->geometry().size().width() >= m_surface->size().width() &&
- curOutput->geometry().size().height() >= m_surface->size().height()) {
- output = curOutput;
- break;
- }
- }
- }
- if (!output) {
- qWarning() << "Unable to resize surface full screen, cannot determine output";
- return;
- }
- QSize outputSize = output->geometry().size();
-
- if (m_view)
- m_view->setRequestedPosition(output->geometry().topLeft());
- send_configure(resize_bottom_right, outputSize.width(), outputSize.height());
-
+ emit q->setFullScreen(QWaylandShellSurface::FullScreenMethod(method), framerate, output);
}
void QWaylandShellSurfacePrivate::shell_surface_set_popup(Resource *resource, wl_resource *input_device, uint32_t serial, wl_resource *parent, int32_t x, int32_t y, uint32_t flags)
{
Q_UNUSED(resource);
- Q_UNUSED(input_device);
+ Q_UNUSED(serial);
Q_UNUSED(flags);
-
+ Q_Q(QWaylandShellSurface);
+ setFocusPolicy(QWaylandShellSurface::DefaultFocus);
QWaylandInputDevice *input = QWaylandInputDevice::fromSeatResource(input_device);
- m_popupGrabber = QWaylandShellPrivate::get(m_shell)->getPopupGrabber(input);
-
- m_popupSerial = serial;
- m_transientParent = QWaylandSurface::fromResource(parent);
- m_transientOffset = m_transientParent ? QPointF(x,y) : QPointF();
-
- setSurfaceType(QWaylandShellSurface::Popup);
+ QWaylandSurface *parentSurface = QWaylandSurface::fromResource(parent);
+ emit q->setPopup(input, parentSurface, QPoint(x,y));
}
@@ -267,30 +178,12 @@ void QWaylandShellSurfacePrivate::shell_surface_set_maximized(Resource *resource
struct wl_resource *output_resource)
{
Q_UNUSED(resource);
-
+ Q_Q(QWaylandShellSurface);
+ setFocusPolicy(QWaylandShellSurface::DefaultFocus);
QWaylandOutput *output = output_resource
? QWaylandOutput::fromResource(output_resource)
: Q_NULLPTR;
- if (!output) {
- // Look for an output that can contain this surface
- Q_FOREACH (QWaylandOutput *curOutput, m_surface->compositor()->defaultOutputSpace()->outputs()) {
- if (curOutput->geometry().size().width() >= m_surface->size().width() &&
- curOutput->geometry().size().height() >= m_surface->size().height()) {
- output = curOutput;
- break;
- }
- }
- }
- if (!output) {
- qWarning() << "Unable to maximize surface, cannot determine output";
- return;
- }
- QSize outputSize = output->availableGeometry().size();
-
- if (m_view)
- m_view->setRequestedPosition(output->availableGeometry().topLeft());
- send_configure(resize_bottom_right, outputSize.width(), outputSize.height());
-
+ emit q->setMaximized(output);
}
void QWaylandShellSurfacePrivate::shell_surface_pong(Resource *resource,
@@ -308,6 +201,8 @@ void QWaylandShellSurfacePrivate::shell_surface_set_title(Resource *resource,
const QString &title)
{
Q_UNUSED(resource);
+ if (title == m_title)
+ return;
Q_Q(QWaylandShellSurface);
m_title = title;
emit q->titleChanged();
@@ -317,151 +212,13 @@ void QWaylandShellSurfacePrivate::shell_surface_set_class(Resource *resource,
const QString &className)
{
Q_UNUSED(resource);
+ if (className == m_className)
+ return;
Q_Q(QWaylandShellSurface);
m_className = className;
emit q->classNameChanged();
}
-QWaylandShellSurfaceGrabber::QWaylandShellSurfaceGrabber(QWaylandShellSurface *shellSurface)
- : QWaylandPointerGrabber()
- , shell_surface(shellSurface)
-{
-}
-
-QWaylandShellSurfaceGrabber::~QWaylandShellSurfaceGrabber()
-{
-}
-
-QWaylandShellSurfaceResizeGrabber::QWaylandShellSurfaceResizeGrabber(QWaylandShellSurface *shellSurface)
- : QWaylandShellSurfaceGrabber(shellSurface)
-{
-}
-
-void QWaylandShellSurfaceResizeGrabber::focus()
-{
-}
-
-void QWaylandShellSurfaceResizeGrabber::motion(uint32_t time)
-{
- Q_UNUSED(time);
-
- int width_delta = point.x() - pointer->currentSpacePosition().x();
- int height_delta = point.y() - pointer->currentSpacePosition().y();
-
- int new_height = height;
- if (resize_edges & WL_SHELL_SURFACE_RESIZE_TOP)
- new_height = qMax(new_height + height_delta, 1);
- else if (resize_edges & WL_SHELL_SURFACE_RESIZE_BOTTOM)
- new_height = qMax(new_height - height_delta, 1);
-
- int new_width = width;
- if (resize_edges & WL_SHELL_SURFACE_RESIZE_LEFT)
- new_width = qMax(new_width + width_delta, 1);
- else if (resize_edges & WL_SHELL_SURFACE_RESIZE_RIGHT)
- new_width = qMax(new_width - width_delta, 1);
-
- QWaylandShellSurfacePrivate::get(shell_surface)->send_configure(resize_edges, new_width, new_height);
-}
-
-void QWaylandShellSurfaceResizeGrabber::button(uint32_t time, Qt::MouseButton button, uint32_t state)
-{
- Q_UNUSED(time)
-
- if (button == Qt::LeftButton && !state) {
- pointer->endGrab();
- QWaylandShellSurfacePrivate::get(shell_surface)->resetResizeGrabber();
- delete this;
- }
-}
-
-QWaylandShellSurfaceMoveGrabber::QWaylandShellSurfaceMoveGrabber(QWaylandShellSurface *shellSurface, const QPointF &offset)
- : QWaylandShellSurfaceGrabber(shellSurface)
- , m_offset(offset)
-{
-}
-
-void QWaylandShellSurfaceMoveGrabber::focus()
-{
-}
-
-void QWaylandShellSurfaceMoveGrabber::motion(uint32_t time)
-{
- Q_UNUSED(time);
-
- QPointF pos(pointer->currentSpacePosition() - m_offset);
- if (shell_surface->view())
- shell_surface->view()->setRequestedPosition(pos);
- if (shell_surface->transientParent()) {
- QWaylandView *view = shell_surface->transientParent()->views().first();
- if (view)
- QWaylandShellSurfacePrivate::get(shell_surface)->setOffset(pos - view->requestedPosition());
- }
-
-}
-
-void QWaylandShellSurfaceMoveGrabber::button(uint32_t time, Qt::MouseButton button, uint32_t state)
-{
- Q_UNUSED(time)
-
- if (button == Qt::LeftButton && !state) {
- pointer->endGrab();
- QWaylandShellSurfacePrivate::get(shell_surface)->resetMoveGrabber();
- delete this;
- }
-}
-
-QWaylandShellSurfacePopupGrabber::QWaylandShellSurfacePopupGrabber(QWaylandInputDevice *inputDevice)
- : QWaylandDefaultPointerGrabber()
- , m_inputDevice(inputDevice)
- , m_client(0)
- , m_surfaces()
- , m_initialUp(false)
-{
-}
-
-void QWaylandShellSurfacePopupGrabber::addPopup(QWaylandShellSurface *surface)
-{
- if (m_surfaces.isEmpty()) {
- m_client = surface->surface()->client()->client();
-
- if (m_inputDevice->pointer()->isButtonPressed())
- m_initialUp = false;
-
- m_surfaces.append(surface);
- m_inputDevice->pointer()->startGrab(this);
- } else {
- m_surfaces.append(surface);
- }
-}
-
-void QWaylandShellSurfacePopupGrabber::removePopup(QWaylandShellSurface *surface)
-{
- if (m_surfaces.isEmpty())
- return;
-
- m_surfaces.removeOne(surface);
- if (m_surfaces.isEmpty())
- m_inputDevice->pointer()->endGrab();
-}
-
-void QWaylandShellSurfacePopupGrabber::button(uint32_t time, Qt::MouseButton button, uint32_t state)
-{
- if (pointer->focusResource()) {
- pointer->sendButton(pointer->focusResource(), time, button, state);
- } else if (state == QtWaylandServer::wl_pointer::button_state_pressed &&
- (m_initialUp || time - pointer->grabTime() > 500) &&
- pointer->currentGrab() == this) {
- pointer->endGrab();
- Q_FOREACH (QWaylandShellSurface *surface, m_surfaces) {
- QWaylandShellSurfacePrivate::get(surface)->send_popup_done();
- }
- m_surfaces.clear();
- }
-
- if (state == QtWaylandServer::wl_pointer::button_state_released)
- m_initialUp = true;
-}
-
QWaylandShell::QWaylandShell()
: QWaylandExtensionTemplate<QWaylandShell>(*new QWaylandShellPrivate())
{ }
@@ -497,21 +254,18 @@ QWaylandShellSurface::QWaylandShellSurface()
{
}
-QWaylandShellSurface::QWaylandShellSurface(QWaylandShell *shell, QWaylandSurface *surface, QWaylandView *view, QWaylandClient *client, uint id)
+QWaylandShellSurface::QWaylandShellSurface(QWaylandShell *shell, QWaylandSurface *surface, QWaylandClient *client, uint id)
: QWaylandExtensionTemplate<QWaylandShellSurface>(*new QWaylandShellSurfacePrivate)
{
- initialize(shell, surface, view, client, id);
+ initialize(shell, surface, client, id);
}
-void QWaylandShellSurface::initialize(QWaylandShell *shell, QWaylandSurface *surface, QWaylandView *view, QWaylandClient *client, uint id)
+void QWaylandShellSurface::initialize(QWaylandShell *shell, QWaylandSurface *surface, QWaylandClient *client, uint id)
{
Q_D(QWaylandShellSurface);
d->m_shell = shell;
d->m_surface = surface;
- d->m_view = view;
d->init(client->client(), id, 1);
- connect(surface, &QWaylandSurface::mappedChanged, this, &QWaylandShellSurface::mappedChanged);
- connect(surface, &QWaylandSurface::offsetForNextFrame, this, &QWaylandShellSurface::adjustOffset);
setExtensionContainer(surface);
QWaylandExtension::initialize();
}
@@ -530,50 +284,16 @@ QByteArray QWaylandShellSurface::interfaceName()
return QWaylandShellSurfacePrivate::interfaceName();
}
-QWaylandShellSurface::SurfaceType QWaylandShellSurface::surfaceType() const
-{
- Q_D(const QWaylandShellSurface);
- return d->m_surfaceType;
-}
-
-QWaylandView *QWaylandShellSurface::view() const
-{
- Q_D(const QWaylandShellSurface);
-
- return d->m_view;
-}
-
-void QWaylandShellSurface::setView(QWaylandView *view)
-{
- Q_D(QWaylandShellSurface);
- if (d->m_view == view)
- return;
- d->m_view = view;
- emit viewChanged();
-}
-
QWaylandSurface *QWaylandShellSurface::surface() const
{
Q_D(const QWaylandShellSurface);
return d->m_surface;
}
-QWaylandSurface *QWaylandShellSurface::transientParent() const
-{
- Q_D(const QWaylandShellSurface);
- return d->m_transientParent;
-}
-
-QPointF QWaylandShellSurface::transientOffset() const
-{
- Q_D(const QWaylandShellSurface);
- return d->m_transientOffset;
-}
-
-bool QWaylandShellSurface::isTransientInactive() const
+QWaylandShellSurface::FocusPolicy QWaylandShellSurface::focusPolicy() const
{
Q_D(const QWaylandShellSurface);
- return d->m_transientInactive;
+ return d->m_focusPolicy;
}
QString QWaylandShellSurface::title() const
@@ -588,31 +308,4 @@ QString QWaylandShellSurface::className() const
return d->m_className;
}
-void QWaylandShellSurface::mappedChanged()
-{
- Q_D(QWaylandShellSurface);
- if (!d->m_surface->isMapped())
- return;
-
- if (d->m_surfaceType == Popup) {
- if (d->m_surface->isMapped() && d->m_popupGrabber->grabSerial() == d->m_popupSerial) {
- d->m_popupGrabber->addPopup(this);
- } else {
- d->send_popup_done();
- d->m_popupGrabber->setClient(0);
- }
- }
-}
-
-void QWaylandShellSurface::adjustOffset(const QPoint &p)
-{
- Q_D(QWaylandShellSurface);
- if (!d->m_view)
- return;
-
- QPointF offset(p);
- QPointF pos = d->m_view->requestedPosition();
- d->m_view->setRequestedPosition(pos + offset);
-}
-
QT_END_NAMESPACE
diff --git a/src/compositor/extensions/qwaylandshell.h b/src/compositor/extensions/qwaylandshell.h
index 5af9d5425..07a504855 100644
--- a/src/compositor/extensions/qwaylandshell.h
+++ b/src/compositor/extensions/qwaylandshell.h
@@ -41,12 +41,12 @@
QT_BEGIN_NAMESPACE
-class QWaylandShellSurface;
+class QWaylandShellPrivate;
class QWaylandShellSurfacePrivate;
class QWaylandSurface;
-class QWaylandView;
-class QWaylandShellPrivate;
class QWaylandClient;
+class QWaylandInputDevice;
+class QWaylandOutput;
class Q_COMPOSITOR_EXPORT QWaylandShell : public QWaylandExtensionTemplate<QWaylandShell>
{
@@ -69,54 +69,66 @@ class Q_COMPOSITOR_EXPORT QWaylandShellSurface : public QWaylandExtensionTemplat
{
Q_OBJECT
Q_DECLARE_PRIVATE(QWaylandShellSurface)
- Q_PROPERTY(SurfaceType surfaceType READ surfaceType NOTIFY surfaceTypeChanged)
Q_PROPERTY(QString title READ title NOTIFY titleChanged)
Q_PROPERTY(QString className READ className NOTIFY classNameChanged)
- Q_PROPERTY(QWaylandView *view READ view WRITE setView NOTIFY viewChanged)
- Q_PROPERTY(QWaylandSurface *transientParent READ transientParent NOTIFY transientParentChanged)
- Q_PROPERTY(QWaylandSurface *surface READ surface CONSTANT)
+ Q_PROPERTY(FocusPolicy focusPolicy READ focusPolicy NOTIFY focusPolicyChanged)
public:
- enum SurfaceType {
- None,
- Toplevel,
- Transient,
- Popup
+ enum FullScreenMethod {
+ DefaultFullScreen,
+ ScaleFullScreen,
+ DriverFullScreen,
+ FillFullScreen
};
+ Q_ENUM(FullScreenMethod);
+
+ enum ResizeEdge {
+ DefaultEdge = 0x00,
+ TopEdge = 0x01,
+ BottomEdge = 0x02,
+ LeftEdge = 0x04,
+ TopLeftEdge = 0x05,
+ BottomLeftEdge = 0x06,
+ RightEdge = 0x08,
+ TopRightEdge = 0x09,
+ BottomRightEdge = 0x10
+ };
+ Q_ENUM(ResizeEdge);
- QWaylandShellSurface();
- QWaylandShellSurface(QWaylandShell *shell, QWaylandSurface *surface, QWaylandView *view, QWaylandClient *client, uint id);
-
- Q_INVOKABLE void initialize(QWaylandShell *shell, QWaylandSurface *surface, QWaylandView *view, QWaylandClient *client, uint id);
+ enum FocusPolicy{
+ DefaultFocus,
+ NoKeyboardFocus
+ };
+ Q_ENUM(FocusPolicy)
- SurfaceType surfaceType() const;
+ QWaylandShellSurface();
+ QWaylandShellSurface(QWaylandShell *shell, QWaylandSurface *surface, QWaylandClient *client, uint id);
- QWaylandView *view() const;
- void setView(QWaylandView *view);
+ Q_INVOKABLE void initialize(QWaylandShell *shell, QWaylandSurface *surface, QWaylandClient *client, uint id);
QString title() const;
QString className() const;
QWaylandSurface *surface() const;
- QWaylandSurface *transientParent() const;
- QPointF transientOffset() const;
-
- bool isTransientInactive() const;
+ FocusPolicy focusPolicy() const;
static const struct wl_interface *interface();
static QByteArray interfaceName();
Q_SIGNALS:
- void surfaceTypeChanged();
- void viewChanged();
void titleChanged();
void classNameChanged();
- void transientParentChanged();
+ void focusPolicyChanged();
void pong();
+ void startMove(QWaylandInputDevice *inputDevice);
+ void startResize(QWaylandInputDevice *inputDevice, ResizeEdge edge);
+
+ void setDefaultToplevel();
+ void setTransient(QWaylandSurface *parentSurface, const QPoint &relativeToParent, FocusPolicy focusPolicy);
+ void setFullScreen(FullScreenMethod method, uint framerate, QWaylandOutput *output);
+ void setPopup(QWaylandInputDevice *inputDevice, QWaylandSurface *parent, const QPoint &relativeToParent);
+ void setMaximized(QWaylandOutput *output);
-private Q_SLOTS:
- void mappedChanged();
- void adjustOffset(const QPoint &p);
private:
void initialize();
};
diff --git a/src/compositor/extensions/qwaylandshell_p.h b/src/compositor/extensions/qwaylandshell_p.h
index e87a27562..28e8b6f4a 100644
--- a/src/compositor/extensions/qwaylandshell_p.h
+++ b/src/compositor/extensions/qwaylandshell_p.h
@@ -53,12 +53,6 @@
QT_BEGIN_NAMESPACE
-class QWaylandView;
-
-class QWaylandShellSurfaceResizeGrabber;
-class QWaylandShellSurfaceMoveGrabber;
-class QWaylandShellSurfacePopupGrabber;
-
class Q_COMPOSITOR_EXPORT QWaylandShellPrivate
: public QWaylandExtensionTemplatePrivate
, public QtWaylandServer::wl_shell
@@ -68,11 +62,8 @@ public:
QWaylandShellPrivate();
static QWaylandShellPrivate *get(QWaylandShell *shell) { return shell->d_func(); }
- QWaylandShellSurfacePopupGrabber* getPopupGrabber(QWaylandInputDevice *input);
protected:
void shell_get_shell_surface(Resource *resource, uint32_t id, struct ::wl_resource *surface) Q_DECL_OVERRIDE;
-
- QHash<QWaylandInputDevice *, QWaylandShellSurfacePopupGrabber*> m_popupGrabber;
};
class Q_COMPOSITOR_EXPORT QWaylandShellSurfacePrivate
@@ -86,39 +77,26 @@ public:
static QWaylandShellSurfacePrivate *get(QWaylandShellSurface *surface) { return surface->d_func(); }
- void resetResizeGrabber();
- void resetMoveGrabber();
-
- void setSurfaceType(QWaylandShellSurface::SurfaceType type);
-
- void setOffset(const QPointF &offset) { m_transientOffset = offset; }
-
- void requestSize(const QSize &size);
-
void ping();
void ping(uint32_t serial);
+ void setFocusPolicy(QWaylandShellSurface::FocusPolicy focusPolicy)
+ {
+ if (focusPolicy == m_focusPolicy)
+ return;
+ Q_Q(QWaylandShellSurface);
+ m_focusPolicy = focusPolicy;
+ emit q->focusPolicyChanged();
+ }
private:
QWaylandShell *m_shell;
QWaylandSurface *m_surface;
- QWaylandView *m_view;
-
- QWaylandShellSurfaceResizeGrabber *m_resizeGrabber;
- QWaylandShellSurfaceMoveGrabber *m_moveGrabber;
- QWaylandShellSurfacePopupGrabber *m_popupGrabber;
-
- uint32_t m_popupSerial;
QSet<uint32_t> m_pings;
- QWaylandShellSurface::SurfaceType m_surfaceType;
- bool m_transientInactive;
-
- QWaylandSurface *m_transientParent;
- QPointF m_transientOffset;
-
QString m_title;
QString m_className;
+ QWaylandShellSurface::FocusPolicy m_focusPolicy;
void shell_surface_destroy_resource(Resource *resource) Q_DECL_OVERRIDE;
@@ -157,65 +135,6 @@ private:
};
-class QWaylandShellSurfaceGrabber : public QWaylandPointerGrabber
-{
-public:
- QWaylandShellSurfaceGrabber(QWaylandShellSurface *shellSurface);
- ~QWaylandShellSurfaceGrabber();
-
- QWaylandShellSurface *shell_surface;
-};
-
-class QWaylandShellSurfaceResizeGrabber : public QWaylandShellSurfaceGrabber
-{
-public:
- QWaylandShellSurfaceResizeGrabber(QWaylandShellSurface *shellSurface);
-
- QPointF point;
- enum wl_shell_surface_resize resize_edges;
- int32_t width;
- int32_t height;
-
- 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;
-};
-
-class QWaylandShellSurfaceMoveGrabber : public QWaylandShellSurfaceGrabber
-{
-public:
- QWaylandShellSurfaceMoveGrabber(QWaylandShellSurface *shellSurface, const QPointF &offset);
-
- 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;
-
-private:
- QPointF m_offset;
-};
-
-class QWaylandShellSurfacePopupGrabber : public QWaylandDefaultPointerGrabber
-{
-public:
- QWaylandShellSurfacePopupGrabber(QWaylandInputDevice *inputDevice);
-
- uint32_t grabSerial() const { return m_inputDevice->pointer()->grabSerial(); }
-
- struct ::wl_client *client() const { return m_client; }
- void setClient(struct ::wl_client *client) { m_client = client; }
-
- void addPopup(QWaylandShellSurface *surface);
- void removePopup(QWaylandShellSurface *surface);
-
- void button(uint32_t time, Qt::MouseButton button, uint32_t state) Q_DECL_OVERRIDE;
-
-private:
- QWaylandInputDevice *m_inputDevice;
- struct ::wl_client *m_client;
- QList<QWaylandShellSurface *> m_surfaces;
- bool m_initialUp;
-};
-
QT_END_NAMESPACE
#endif // QWAYLANDSHELL_P_H
diff --git a/src/compositor/extensions/qwlqttouch.cpp b/src/compositor/extensions/qwlqttouch.cpp
index 5f0c60b9c..70738ce20 100644
--- a/src/compositor/extensions/qwlqttouch.cpp
+++ b/src/compositor/extensions/qwlqttouch.cpp
@@ -71,7 +71,6 @@ bool TouchExtensionGlobal::postTouchEvent(QTouchEvent *event, QWaylandView *view
if (!pointCount)
return false;
- QPointF surfacePos = view->requestedPosition();
wl_client *surfaceClient = view->surface()->client()->client();
uint32_t time = m_compositor->currentTimeMsecs();
const int rescount = m_resources.count();
@@ -100,9 +99,8 @@ bool TouchExtensionGlobal::postTouchEvent(QTouchEvent *event, QWaylandView *view
uint32_t state = (tp.state() & 0xFFFF) | (sentPointCount << 16);
uint32_t flags = (tp.flags() & 0xFFFF) | (int(event->device()->capabilities()) << 16);
- QPointF p = tp.pos() - surfacePos; // surface-relative
- int x = toFixed(p.x());
- int y = toFixed(p.y());
+ int x = toFixed(tp.pos().x());
+ int y = toFixed(tp.pos().y());
int nx = toFixed(tp.normalizedPos().x());
int ny = toFixed(tp.normalizedPos().y());
int w = toFixed(tp.rect().width());
diff --git a/src/compositor/wayland_wrapper/qwldatadevice.cpp b/src/compositor/wayland_wrapper/qwldatadevice.cpp
index 4c32538e6..85895ae9c 100644
--- a/src/compositor/wayland_wrapper/qwldatadevice.cpp
+++ b/src/compositor/wayland_wrapper/qwldatadevice.cpp
@@ -145,13 +145,16 @@ void DataDevice::focus()
void DataDevice::motion(uint32_t time)
{
Q_EMIT m_inputDevice->drag()->positionChanged();
- 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()));
- }
+ 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)
diff --git a/src/imports/compositor/qwaylandquickcompositorplugin.cpp b/src/imports/compositor/qwaylandquickcompositorplugin.cpp
index 8581b0a7b..e83468e5c 100644
--- a/src/imports/compositor/qwaylandquickcompositorplugin.cpp
+++ b/src/imports/compositor/qwaylandquickcompositorplugin.cpp
@@ -56,8 +56,9 @@
QT_BEGIN_NAMESPACE
-Q_COMPOSITOR_DECLARE_QUICK_DATA_CLASS(QWaylandShell)
Q_COMPOSITOR_DECLARE_QUICK_EXTENSION_CLASS(QWaylandQuickCompositor)
+Q_COMPOSITOR_DECLARE_QUICK_DATA_CLASS(QWaylandShell)
+Q_COMPOSITOR_DECLARE_QUICK_DATA_CLASS(QWaylandShellSurface)
class QmlUrlResolver
{
@@ -137,7 +138,7 @@ public:
//This should probably be somewhere else
qmlRegisterType<QWaylandShellQuickData>(uri, 1, 0, "DefaultShell");
- qmlRegisterType<QWaylandShellSurface>(uri, 1, 0, "DefaultShellSurface");
+ qmlRegisterType<QWaylandShellSurfaceQuickData>(uri, 1, 0, "DefaultShellSurface");
}
};
//![class decl]