summaryrefslogtreecommitdiffstats
path: root/src/compositor
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@qt.io>2016-06-30 13:35:37 +0200
committerLiang Qi <liang.qi@qt.io>2016-06-30 14:28:55 +0200
commitb07e95e408fde45a0ce1a1b6683d432c9657e650 (patch)
tree65a80f556bf54d188d17ff985f37eb138007c9f4 /src/compositor
parent4d4f44a70f663428241c83e26d073f5e5ece8b62 (diff)
parentcddeb1c7c0e9d02c5f5542d7d12b4fa992bfb050 (diff)
Merge remote-tracking branch 'origin/5.7' into dev
Conflicts: src/compositor/extensions/qwaylandxdgshellintegration.cpp Change-Id: I3e8666d0c2fd047f12daeb94b2c967c646576ed9
Diffstat (limited to 'src/compositor')
-rw-r--r--src/compositor/compositor_api/qwaylandcompositor.cpp4
-rw-r--r--src/compositor/compositor_api/qwaylandquickitem.cpp8
-rw-r--r--src/compositor/compositor_api/qwaylandsurface.cpp2
-rw-r--r--src/compositor/compositor_api/qwaylandtouch.cpp9
-rw-r--r--src/compositor/compositor_api/qwaylandtouch_p.h1
-rw-r--r--src/compositor/doc/qtwaylandcompositor.qdocconf2
-rw-r--r--src/compositor/extensions/extensions.pri2
-rw-r--r--src/compositor/extensions/qwaylandquickshellsurfaceitem.cpp34
-rw-r--r--src/compositor/extensions/qwaylandquickshellsurfaceitem_p.h5
-rw-r--r--src/compositor/extensions/qwaylandwlshell.cpp2
-rw-r--r--src/compositor/extensions/qwaylandxdgshellintegration.cpp7
11 files changed, 62 insertions, 14 deletions
diff --git a/src/compositor/compositor_api/qwaylandcompositor.cpp b/src/compositor/compositor_api/qwaylandcompositor.cpp
index 3a499fa74..6964eea06 100644
--- a/src/compositor/compositor_api/qwaylandcompositor.cpp
+++ b/src/compositor/compositor_api/qwaylandcompositor.cpp
@@ -410,7 +410,7 @@ void QWaylandCompositorPrivate::loadServerBufferIntegration()
\brief Type managing the Wayland display server.
The WaylandCompositor manages the connections to the clients, as well as the different
- \l{WaylandOutput}{outputs} and \l{WaylandInput}{input devices}.
+ \l{WaylandOutput}{outputs} and \l{QWaylandInputDevice}{input devices}.
Normally, a compositor application will have a single WaylandCompositor
instance, which can have several outputs as children. When a client
@@ -429,7 +429,7 @@ void QWaylandCompositorPrivate::loadServerBufferIntegration()
\brief Class managing the Wayland display server.
The QWaylandCompositor manages the connections to the clients, as well as the different \l{QWaylandOutput}{outputs}
- and \l{QWaylandInput}{input devices}.
+ and \l{QWaylandInputDevice}{input devices}.
Normally, a compositor application will have a single WaylandCompositor
instance, which can have several outputs as children.
diff --git a/src/compositor/compositor_api/qwaylandquickitem.cpp b/src/compositor/compositor_api/qwaylandquickitem.cpp
index 6022ee26b..15525259c 100644
--- a/src/compositor/compositor_api/qwaylandquickitem.cpp
+++ b/src/compositor/compositor_api/qwaylandquickitem.cpp
@@ -1082,8 +1082,10 @@ QSGNode *QWaylandQuickItem::updatePaintNode(QSGNode *oldNode, UpdatePaintNodeDat
if (ref.isShm() || bufferTypes[ref.bufferFormatEgl()].canProvideTexture) {
QSGSimpleTextureNode *node = static_cast<QSGSimpleTextureNode *>(oldNode);
- if (!node)
+ if (!node) {
node = new QSGSimpleTextureNode();
+ d->newTexture = true;
+ }
if (!d->provider)
d->provider = new QWaylandSurfaceTextureProvider();
@@ -1103,8 +1105,10 @@ QSGNode *QWaylandQuickItem::updatePaintNode(QSGNode *oldNode, UpdatePaintNodeDat
QSGGeometryNode *node = static_cast<QSGGeometryNode *>(oldNode);
- if (!node)
+ if (!node) {
node = new QSGGeometryNode;
+ d->newTexture = true;
+ }
QSGGeometry *geometry = node->geometry();
QWaylandBufferMaterial *material = static_cast<QWaylandBufferMaterial *>(node->material());
diff --git a/src/compositor/compositor_api/qwaylandsurface.cpp b/src/compositor/compositor_api/qwaylandsurface.cpp
index 027105d00..d039fc94f 100644
--- a/src/compositor/compositor_api/qwaylandsurface.cpp
+++ b/src/compositor/compositor_api/qwaylandsurface.cpp
@@ -543,7 +543,7 @@ int QWaylandSurface::bufferScale() const
*
* This property holds the orientation of the WaylandSurface's contents.
*
- * \sa QtWaylandCompositor::WaylandOutput::transform
+ * \sa QWaylandOutput::transform
*/
/*!
diff --git a/src/compositor/compositor_api/qwaylandtouch.cpp b/src/compositor/compositor_api/qwaylandtouch.cpp
index 63b0f84ea..a9b44527e 100644
--- a/src/compositor/compositor_api/qwaylandtouch.cpp
+++ b/src/compositor/compositor_api/qwaylandtouch.cpp
@@ -60,6 +60,11 @@ void QWaylandTouchPrivate::resetFocusState()
focusResource = 0;
}
+void QWaylandTouchPrivate::touch_bind_resource(Resource *resource)
+{
+ focusResource = resource;
+}
+
void QWaylandTouchPrivate::touch_destroy_resource(Resource *resource)
{
if (focusResource == resource) {
@@ -75,7 +80,7 @@ void QWaylandTouchPrivate::touch_release(Resource *resource)
void QWaylandTouchPrivate::sendDown(uint32_t time, int touch_id, const QPointF &position)
{
Q_Q(QWaylandTouch);
- if (focusResource || q->mouseFocus())
+ if (!focusResource || !q->mouseFocus())
return;
uint32_t serial = q->compositor()->nextSerial();
@@ -86,7 +91,7 @@ void QWaylandTouchPrivate::sendDown(uint32_t time, int touch_id, const QPointF &
void QWaylandTouchPrivate::sendUp(uint32_t time, int touch_id)
{
- if (focusResource)
+ if (!focusResource)
return;
uint32_t serial = compositor()->nextSerial();
diff --git a/src/compositor/compositor_api/qwaylandtouch_p.h b/src/compositor/compositor_api/qwaylandtouch_p.h
index 3c9e0ec93..ea334eea1 100644
--- a/src/compositor/compositor_api/qwaylandtouch_p.h
+++ b/src/compositor/compositor_api/qwaylandtouch_p.h
@@ -88,6 +88,7 @@ public:
}
private:
void resetFocusState();
+ void touch_bind_resource(Resource *resource) Q_DECL_OVERRIDE;
void touch_destroy_resource(Resource *resource) Q_DECL_OVERRIDE;
void touch_release(Resource *resource) Q_DECL_OVERRIDE;
diff --git a/src/compositor/doc/qtwaylandcompositor.qdocconf b/src/compositor/doc/qtwaylandcompositor.qdocconf
index 125fb2b31..230978f07 100644
--- a/src/compositor/doc/qtwaylandcompositor.qdocconf
+++ b/src/compositor/doc/qtwaylandcompositor.qdocconf
@@ -29,7 +29,7 @@ qhp.QtWaylandCompositor.subprojects.examples.indexTitle = Qt Wayland Composi
qhp.QtWaylandCompositor.subprojects.examples.selectors = fake:example
qhp.QtWaylandCompositor.subprojects.examples.sortPages = true
-depends += qtqml qtquick qtdoc qtquickcontrols
+depends += qtqml qtquick qtdoc qtquickcontrols qmake qtgui
exampledirs += ../../../examples/wayland/
headerdirs += ../
diff --git a/src/compositor/extensions/extensions.pri b/src/compositor/extensions/extensions.pri
index ab21fe5ab..7aa4a3705 100644
--- a/src/compositor/extensions/extensions.pri
+++ b/src/compositor/extensions/extensions.pri
@@ -1,4 +1,6 @@
CONFIG += wayland-scanner
+CONFIG += generated_privates
+
WAYLANDSERVERSOURCES += \
../extensions/surface-extension.xml \
../extensions/touch-extension.xml \
diff --git a/src/compositor/extensions/qwaylandquickshellsurfaceitem.cpp b/src/compositor/extensions/qwaylandquickshellsurfaceitem.cpp
index d4b16e85f..5fe43e547 100644
--- a/src/compositor/extensions/qwaylandquickshellsurfaceitem.cpp
+++ b/src/compositor/extensions/qwaylandquickshellsurfaceitem.cpp
@@ -192,13 +192,19 @@ QWaylandQuickShellEventFilter::QWaylandQuickShellEventFilter(QObject *parent)
bool QWaylandQuickShellEventFilter::eventFilter(QObject *receiver, QEvent *e)
{
if (e->type() == QEvent::MouseButtonPress || e->type() == QEvent::MouseButtonRelease) {
+ bool press = e->type() == QEvent::MouseButtonPress;
+ if (press && !waitForRelease) {
+ // The user clicked something: we need to close popups unless this press is caught later
+ if (!mousePressTimeout.isActive())
+ mousePressTimeout.start(0, this);
+ }
+
QQuickItem *item = qobject_cast<QQuickItem*>(receiver);
if (!item)
return false;
QMouseEvent *event = static_cast<QMouseEvent*>(e);
QWaylandQuickShellSurfaceItem *shellSurfaceItem = qobject_cast<QWaylandQuickShellSurfaceItem*>(item);
- bool press = event->type() == QEvent::MouseButtonPress;
bool finalRelease = (event->type() == QEvent::MouseButtonRelease) && (event->buttons() == Qt::NoButton);
bool popupClient = shellSurfaceItem && shellSurfaceItem->surface()->client() == client;
@@ -211,6 +217,21 @@ bool QWaylandQuickShellEventFilter::eventFilter(QObject *receiver, QEvent *e)
return true;
}
+ if (finalRelease && mousePressTimeout.isActive()) {
+ // the user somehow managed to press and release the mouse button in 0 milliseconds
+ qWarning("Badly written autotest detected");
+ mousePressTimeout.stop();
+ stopFilter();
+ }
+
+ if (press && !shellSurfaceItem && !QQmlProperty(item, QStringLiteral("qtwayland_blocking_overlay")).isValid()) {
+ // the user clicked on something that's not blocking mouse events
+ e->ignore(); //propagate the event to items below
+ return true; // don't give the event to the item
+ }
+
+ mousePressTimeout.stop(); // we've got this
+
if (press && !popupClient) {
// The user clicked outside the active popup's client. The popups should
// be closed, but the event filter will stay to catch the release-
@@ -224,4 +245,15 @@ bool QWaylandQuickShellEventFilter::eventFilter(QObject *receiver, QEvent *e)
return false;
}
+void QWaylandQuickShellEventFilter::timerEvent(QTimerEvent *event)
+{
+ if (event->timerId() == mousePressTimeout.timerId()) {
+ mousePressTimeout.stop();
+ closePopups();
+ stopFilter();
+ // Don't wait for release: Since the press wasn't accepted,
+ // the release won't be delivered.
+ }
+}
+
QT_END_NAMESPACE
diff --git a/src/compositor/extensions/qwaylandquickshellsurfaceitem_p.h b/src/compositor/extensions/qwaylandquickshellsurfaceitem_p.h
index 53c88c965..3cd9bf228 100644
--- a/src/compositor/extensions/qwaylandquickshellsurfaceitem_p.h
+++ b/src/compositor/extensions/qwaylandquickshellsurfaceitem_p.h
@@ -38,6 +38,7 @@
#define QWAYLANDQUICKSHELLSURFACEITEM_P_H
#include <QtWaylandCompositor/private/qwaylandquickitem_p.h>
+#include <QtCore/QBasicTimer>
#include <functional>
@@ -88,6 +89,9 @@ public:
static void startFilter(QWaylandClient *client, CallbackFunction closePopupCallback);
static void cancelFilter();
+protected:
+ void timerEvent(QTimerEvent *event) Q_DECL_OVERRIDE;
+
private:
void stopFilter();
@@ -97,6 +101,7 @@ private:
bool waitForRelease;
QPointer<QWaylandClient> client;
CallbackFunction closePopups;
+ QBasicTimer mousePressTimeout;
static QWaylandQuickShellEventFilter *self;
};
diff --git a/src/compositor/extensions/qwaylandwlshell.cpp b/src/compositor/extensions/qwaylandwlshell.cpp
index 51c73fc64..d39876cbc 100644
--- a/src/compositor/extensions/qwaylandwlshell.cpp
+++ b/src/compositor/extensions/qwaylandwlshell.cpp
@@ -252,7 +252,7 @@ void QWaylandWlShellSurfacePrivate::shell_surface_set_class(Resource *resource,
* \preliminary
* \brief Extension for desktop-style user interfaces.
*
- * The WlShell extension provides a way to assiociate a \l{ShellSurface}
+ * The WlShell extension provides a way to assiociate a ShellSurface
* with a regular Wayland surface. Using the shell surface interface, the client
* can request that the surface is resized, moved, and so on.
*
diff --git a/src/compositor/extensions/qwaylandxdgshellintegration.cpp b/src/compositor/extensions/qwaylandxdgshellintegration.cpp
index 0b22cc1c3..7e4d68668 100644
--- a/src/compositor/extensions/qwaylandxdgshellintegration.cpp
+++ b/src/compositor/extensions/qwaylandxdgshellintegration.cpp
@@ -93,11 +93,10 @@ bool XdgShellIntegration::mouseMoveEvent(QMouseEvent *event)
bool XdgShellIntegration::mouseReleaseEvent(QMouseEvent *event)
{
+ Q_UNUSED(event);
+
if (grabberState == GrabberState::Resize) {
- float scaleFactor = m_item->view()->output()->scaleFactor();
- QPointF delta = (event->windowPos() - resizeState.initialMousePos) / scaleFactor;
- QSize newSize = m_xdgSurface->sizeForResize(resizeState.initialWindowSize, delta, resizeState.resizeEdges);
- m_xdgSurface->sendUnMaximized(newSize);
+ m_xdgSurface->sendUnMaximized();
grabberState = GrabberState::Default;
return true;
} else if (grabberState == GrabberState::Move) {