summaryrefslogtreecommitdiffstats
path: root/src/compositor
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@qt.io>2017-04-21 11:10:27 +0200
committerLiang Qi <liang.qi@qt.io>2017-04-21 11:10:27 +0200
commitbf2dec1e32fbd92ba431bf88dc989f209a15aa01 (patch)
tree724b6e0f6cd5e6718a80a7135304f191f76726f8 /src/compositor
parentf4a29f068e77e8d1a5a08046e47904ff0b6f2d2e (diff)
parenta5dd3692697fcf905749b5686d5d7bfbf47969e1 (diff)
Merge remote-tracking branch 'origin/5.9' into dev
Diffstat (limited to 'src/compositor')
-rw-r--r--src/compositor/compositor_api/qwaylandcompositor.cpp8
-rw-r--r--src/compositor/compositor_api/qwaylandcompositor_p.h6
-rw-r--r--src/compositor/compositor_api/qwaylanddrag.cpp6
-rw-r--r--src/compositor/compositor_api/qwaylanddrag.h2
-rw-r--r--src/compositor/compositor_api/qwaylandkeyboard.cpp8
-rw-r--r--src/compositor/compositor_api/qwaylandquickitem.cpp25
-rw-r--r--src/compositor/compositor_api/qwaylandquickitem.h2
-rw-r--r--src/compositor/compositor_api/qwaylandseat.cpp17
-rw-r--r--src/compositor/compositor_api/qwaylandseat.h4
-rw-r--r--src/compositor/compositor_api/qwaylandseat_p.h8
-rw-r--r--src/compositor/compositor_api/qwaylandsurface.cpp9
-rw-r--r--src/compositor/compositor_api/qwaylandsurface.h2
-rw-r--r--src/compositor/configure.json6
-rw-r--r--src/compositor/extensions/qwaylandivisurface.h2
-rw-r--r--src/compositor/extensions/qwaylandivisurfaceintegration.cpp5
-rw-r--r--src/compositor/extensions/qwaylandivisurfaceintegration_p.h1
-rw-r--r--src/compositor/extensions/qwaylandquickshellsurfaceitem.cpp9
-rw-r--r--src/compositor/extensions/qwaylandquickshellsurfaceitem_p.h2
-rw-r--r--src/compositor/extensions/qwaylandwlshellintegration.cpp5
-rw-r--r--src/compositor/extensions/qwaylandwlshellintegration_p.h1
-rw-r--r--src/compositor/extensions/qwaylandxdgshellv5.cpp7
-rw-r--r--src/compositor/extensions/qwaylandxdgshellv5.h3
-rw-r--r--src/compositor/extensions/qwaylandxdgshellv5integration.cpp11
-rw-r--r--src/compositor/extensions/qwaylandxdgshellv5integration_p.h3
-rw-r--r--src/compositor/wayland_wrapper/qwlclientbuffer_p.h2
-rw-r--r--src/compositor/wayland_wrapper/qwldatadevice.cpp33
-rw-r--r--src/compositor/wayland_wrapper/qwldatadevice_p.h14
-rw-r--r--src/compositor/wayland_wrapper/qwldatadevicemanager_p.h3
-rw-r--r--src/compositor/wayland_wrapper/qwldataoffer_p.h3
-rw-r--r--src/compositor/wayland_wrapper/qwldatasource_p.h3
-rw-r--r--src/compositor/wayland_wrapper/wayland_wrapper.pri24
31 files changed, 192 insertions, 42 deletions
diff --git a/src/compositor/compositor_api/qwaylandcompositor.cpp b/src/compositor/compositor_api/qwaylandcompositor.cpp
index 499d81b3f..277fa0abe 100644
--- a/src/compositor/compositor_api/qwaylandcompositor.cpp
+++ b/src/compositor/compositor_api/qwaylandcompositor.cpp
@@ -52,8 +52,10 @@
#include <QtWaylandCompositor/private/qwaylandkeyboard_p.h>
#include <QtWaylandCompositor/private/qwaylandsurface_p.h>
+#if QT_CONFIG(wayland_datadevice)
#include "wayland_wrapper/qwldatadevice_p.h"
#include "wayland_wrapper/qwldatadevicemanager_p.h"
+#endif
#include "wayland_wrapper/qwlbuffermanager_p.h"
#include "hardware_integration/qwlclientbufferintegration_p.h"
@@ -176,7 +178,9 @@ void QWaylandCompositorPrivate::init()
wl_compositor::init(display, 3);
wl_subcompositor::init(display, 1);
+#if QT_CONFIG(wayland_datadevice)
data_device_manager = new QtWayland::DataDeviceManager(q);
+#endif
buffer_manager = new QtWayland::BufferManager(q);
wl_display_init_shm(display);
@@ -225,7 +229,9 @@ QWaylandCompositorPrivate::~QWaylandCompositorPrivate()
qDeleteAll(outputs);
+#if QT_CONFIG(wayland_datadevice)
delete data_device_manager;
+#endif
wl_display_destroy(display);
}
@@ -790,7 +796,9 @@ void QWaylandCompositor::retainedSelectionReceived(QMimeData *)
void QWaylandCompositor::overrideSelection(const QMimeData *data)
{
Q_D(QWaylandCompositor);
+#if QT_CONFIG(wayland_datadevice)
d->data_device_manager->overrideSelection(*data);
+#endif
}
/*!
diff --git a/src/compositor/compositor_api/qwaylandcompositor_p.h b/src/compositor/compositor_api/qwaylandcompositor_p.h
index f85fd8cc5..c43962f92 100644
--- a/src/compositor/compositor_api/qwaylandcompositor_p.h
+++ b/src/compositor/compositor_api/qwaylandcompositor_p.h
@@ -49,7 +49,7 @@
// We mean it.
//
-#include <QtWaylandCompositor/qtwaylandcompositorglobal.h>
+#include <QtWaylandCompositor/private/qtwaylandcompositorglobal_p.h>
#include <QtWaylandCompositor/QWaylandCompositor>
#include <QtCore/private/qobject_p.h>
#include <QtCore/QSet>
@@ -89,7 +89,9 @@ public:
inline QtWayland::ClientBufferIntegration *clientBufferIntegration() const;
inline QtWayland::ServerBufferIntegration *serverBufferIntegration() const;
+#if QT_CONFIG(wayland_datadevice)
QtWayland::DataDeviceManager *dataDeviceManager() const { return data_device_manager; }
+#endif
QtWayland::BufferManager *bufferManager() const { return buffer_manager; }
void feedRetainedSelectionData(QMimeData *data);
@@ -130,7 +132,9 @@ protected:
QList<QWaylandSurface *> all_surfaces;
+#if QT_CONFIG(wayland_datadevice)
QtWayland::DataDeviceManager *data_device_manager;
+#endif
QtWayland::BufferManager *buffer_manager;
QElapsedTimer timer;
diff --git a/src/compositor/compositor_api/qwaylanddrag.cpp b/src/compositor/compositor_api/qwaylanddrag.cpp
index 3c3d9ce52..cd7cef843 100644
--- a/src/compositor/compositor_api/qwaylanddrag.cpp
+++ b/src/compositor/compositor_api/qwaylanddrag.cpp
@@ -38,9 +38,13 @@
#include <private/qobject_p.h>
-#include "qwldatadevice_p.h"
#include "qwaylandview.h"
#include <QtWaylandCompositor/private/qwaylandseat_p.h>
+#include <QtWaylandCompositor/private/qtwaylandcompositorglobal_p.h>
+
+#if QT_CONFIG(wayland_datadevice)
+#include "qwldatadevice_p.h"
+#endif
QT_BEGIN_NAMESPACE
diff --git a/src/compositor/compositor_api/qwaylanddrag.h b/src/compositor/compositor_api/qwaylanddrag.h
index df1924740..e4fd2c932 100644
--- a/src/compositor/compositor_api/qwaylanddrag.h
+++ b/src/compositor/compositor_api/qwaylanddrag.h
@@ -42,6 +42,8 @@
#include <QtCore/QObject>
#include <QtCore/QPointF>
+QT_REQUIRE_CONFIG(draganddrop);
+
QT_BEGIN_NAMESPACE
class QWaylandDragPrivate;
diff --git a/src/compositor/compositor_api/qwaylandkeyboard.cpp b/src/compositor/compositor_api/qwaylandkeyboard.cpp
index 55381b450..986f819ff 100644
--- a/src/compositor/compositor_api/qwaylandkeyboard.cpp
+++ b/src/compositor/compositor_api/qwaylandkeyboard.cpp
@@ -175,7 +175,11 @@ void QWaylandKeyboardPrivate::keyboard_release(wl_keyboard::Resource *resource)
void QWaylandKeyboardPrivate::keyEvent(uint code, uint32_t state)
{
+#if QT_CONFIG(xkbcommon_evdev)
uint key = toWaylandXkbV1Key(code);
+#else
+ uint key = code;
+#endif
if (state == WL_KEYBOARD_KEY_STATE_PRESSED) {
keys << key;
} else {
@@ -187,7 +191,11 @@ void QWaylandKeyboardPrivate::sendKeyEvent(uint code, uint32_t state)
{
uint32_t time = compositor()->currentTimeMsecs();
uint32_t serial = compositor()->nextSerial();
+#if QT_CONFIG(xkbcommon_evdev)
uint key = toWaylandXkbV1Key(code);
+#else
+ uint key = code;
+#endif
if (focusResource)
send_key(focusResource->handle, serial, time, key, state);
}
diff --git a/src/compositor/compositor_api/qwaylandquickitem.cpp b/src/compositor/compositor_api/qwaylandquickitem.cpp
index ee9fa5427..d3c096a85 100644
--- a/src/compositor/compositor_api/qwaylandquickitem.cpp
+++ b/src/compositor/compositor_api/qwaylandquickitem.cpp
@@ -43,7 +43,9 @@
#include <QtWaylandCompositor/qwaylandcompositor.h>
#include <QtWaylandCompositor/qwaylandseat.h>
#include <QtWaylandCompositor/qwaylandbufferref.h>
+#if QT_CONFIG(draganddrop)
#include <QtWaylandCompositor/QWaylandDrag>
+#endif
#include <QtWaylandCompositor/private/qwlclientbufferintegration_p.h>
#include <QtGui/QKeyEvent>
@@ -492,6 +494,7 @@ void QWaylandQuickItem::mouseMoveEvent(QMouseEvent *event)
Q_D(QWaylandQuickItem);
if (d->shouldSendInputEvents()) {
QWaylandSeat *seat = compositor()->seatFor(event);
+#if QT_CONFIG(draganddrop)
if (d->isDragging) {
QWaylandQuickOutput *currentOutput = qobject_cast<QWaylandQuickOutput *>(view()->output());
//TODO: also check if dragging onto other outputs
@@ -502,7 +505,9 @@ void QWaylandQuickItem::mouseMoveEvent(QMouseEvent *event)
QPointF surfacePosition = targetItem->mapToSurface(position);
seat->drag()->dragMove(targetSurface, surfacePosition);
}
- } else {
+ } else
+#endif // QT_CONFIG(draganddrop)
+ {
seat->sendMouseMoveEvent(d->view.data(), mapToSurface(event->localPos()), event->windowPos());
d->hoverPos = event->pos();
}
@@ -520,10 +525,13 @@ void QWaylandQuickItem::mouseReleaseEvent(QMouseEvent *event)
Q_D(QWaylandQuickItem);
if (d->shouldSendInputEvents()) {
QWaylandSeat *seat = compositor()->seatFor(event);
+#if QT_CONFIG(draganddrop)
if (d->isDragging) {
d->isDragging = false;
seat->drag()->drop();
- } else {
+ } else
+#endif
+ {
seat->sendMouseReleaseEvent(event->button());
}
} else {
@@ -678,8 +686,11 @@ void QWaylandQuickItem::touchEvent(QTouchEvent *event)
void QWaylandQuickItem::touchUngrabEvent()
{
Q_D(QWaylandQuickItem);
- for (auto seat : d->touchingSeats)
- seat->sendTouchCancelEvent(surface()->client());
+
+ if (d->shouldSendInputEvents())
+ for (auto seat : d->touchingSeats)
+ seat->sendTouchCancelEvent(surface()->client());
+
d->touchingSeats.clear();
}
@@ -851,7 +862,9 @@ void QWaylandQuickItem::handleSurfaceChanged()
disconnect(d->oldSurface, &QWaylandSurface::configure, this, &QWaylandQuickItem::updateBuffer);
disconnect(d->oldSurface, &QWaylandSurface::redraw, this, &QQuickItem::update);
disconnect(d->oldSurface, &QWaylandSurface::childAdded, this, &QWaylandQuickItem::handleSubsurfaceAdded);
+#if QT_CONFIG(draganddrop)
disconnect(d->oldSurface, &QWaylandSurface::dragStarted, this, &QWaylandQuickItem::handleDragStarted);
+#endif
#if QT_CONFIG(im)
disconnect(d->oldSurface->inputMethodControl(), &QWaylandInputMethodControl::updateInputMethod, this, &QWaylandQuickItem::updateInputMethod);
#endif
@@ -864,7 +877,9 @@ void QWaylandQuickItem::handleSurfaceChanged()
connect(newSurface, &QWaylandSurface::configure, this, &QWaylandQuickItem::updateBuffer);
connect(newSurface, &QWaylandSurface::redraw, this, &QQuickItem::update);
connect(newSurface, &QWaylandSurface::childAdded, this, &QWaylandQuickItem::handleSubsurfaceAdded);
+#if QT_CONFIG(draganddrop)
connect(newSurface, &QWaylandSurface::dragStarted, this, &QWaylandQuickItem::handleDragStarted);
+#endif
#if QT_CONFIG(im)
connect(newSurface->inputMethodControl(), &QWaylandInputMethodControl::updateInputMethod, this, &QWaylandQuickItem::updateInputMethod);
#endif
@@ -1274,6 +1289,7 @@ void QWaylandQuickItem::handleSubsurfacePosition(const QPoint &pos)
QQuickItem::setPosition(pos * d->scaleFactor());
}
+#if QT_CONFIG(draganddrop)
void QWaylandQuickItem::handleDragStarted(QWaylandDrag *drag)
{
Q_D(QWaylandQuickItem);
@@ -1281,6 +1297,7 @@ void QWaylandQuickItem::handleDragStarted(QWaylandDrag *drag)
drag->seat()->setMouseFocus(nullptr);
d->isDragging = true;
}
+#endif
qreal QWaylandQuickItemPrivate::scaleFactor() const
{
diff --git a/src/compositor/compositor_api/qwaylandquickitem.h b/src/compositor/compositor_api/qwaylandquickitem.h
index eb014a20c..ed8842052 100644
--- a/src/compositor/compositor_api/qwaylandquickitem.h
+++ b/src/compositor/compositor_api/qwaylandquickitem.h
@@ -159,7 +159,9 @@ private Q_SLOTS:
void beforeSync();
void handleSubsurfaceAdded(QWaylandSurface *childSurface);
void handleSubsurfacePosition(const QPoint &pos);
+#if QT_CONFIG(draganddrop)
void handleDragStarted(QWaylandDrag *drag);
+#endif
#if QT_CONFIG(im)
void updateInputMethod(Qt::InputMethodQueries queries);
#endif
diff --git a/src/compositor/compositor_api/qwaylandseat.cpp b/src/compositor/compositor_api/qwaylandseat.cpp
index 7e4c83192..10d29d6c3 100644
--- a/src/compositor/compositor_api/qwaylandseat.cpp
+++ b/src/compositor/compositor_api/qwaylandseat.cpp
@@ -40,13 +40,17 @@
#include "qwaylandcompositor.h"
#include "qwaylandinputmethodcontrol.h"
#include "qwaylandview.h"
+#if QT_CONFIG(draganddrop)
#include <QtWaylandCompositor/QWaylandDrag>
+#endif
#include <QtWaylandCompositor/QWaylandTouch>
#include <QtWaylandCompositor/QWaylandPointer>
#include <QtWaylandCompositor/QWaylandKeymap>
#include <QtWaylandCompositor/private/qwaylandseat_p.h>
#include <QtWaylandCompositor/private/qwaylandcompositor_p.h>
+#if QT_CONFIG(wayland_datadevice)
#include <QtWaylandCompositor/private/qwldatadevice_p.h>
+#endif
#include "extensions/qwlqtkey_p.h"
#include "extensions/qwaylandtextinput.h"
@@ -61,8 +65,12 @@ QWaylandSeatPrivate::QWaylandSeatPrivate(QWaylandSeat *seat)
, mouseFocus(Q_NULLPTR)
, keyboardFocus(nullptr)
, capabilities()
+#if QT_CONFIG(wayland_datadevice)
, data_device()
+#endif
+#if QT_CONFIG(draganddrop)
, drag_handle(new QWaylandDrag(seat))
+#endif
, keymap(new QWaylandKeymap())
{
}
@@ -100,6 +108,7 @@ void QWaylandSeatPrivate::setCapabilities(QWaylandSeat::CapabilityFlags caps)
}
}
+#if QT_CONFIG(wayland_datadevice)
void QWaylandSeatPrivate::clientRequestedDataDevice(QtWayland::DataDeviceManager *, struct wl_client *client, uint32_t id)
{
Q_Q(QWaylandSeat);
@@ -107,6 +116,7 @@ void QWaylandSeatPrivate::clientRequestedDataDevice(QtWayland::DataDeviceManager
data_device.reset(new QtWayland::DataDevice(q));
data_device->add(client, id, 1);
}
+#endif
void QWaylandSeatPrivate::seat_destroy_resource(wl_seat::Resource *)
{
@@ -158,6 +168,7 @@ void QWaylandSeatPrivate::seat_get_touch(wl_seat::Resource *resource, uint32_t i
* \value Pointer The QWaylandSeat supports pointer input.
* \value Keyboard The QWaylandSeat supports keyboard input.
* \value Touch The QWaylandSeat supports touch input.
+ * \value DefaultCapabilities The QWaylandSeat has the default capabilities.
*/
/*!
@@ -363,6 +374,8 @@ QWaylandSurface *QWaylandSeat::keyboardFocus() const
/*!
* Sets the current keyboard focus to \a surface.
+ * Returns a boolean indicating if the operation
+ * was successful.
*/
bool QWaylandSeat::setKeyboardFocus(QWaylandSurface *surface)
{
@@ -377,8 +390,10 @@ bool QWaylandSeat::setKeyboardFocus(QWaylandSurface *surface)
d->keyboardFocus = surface;
if (!d->keyboard.isNull())
d->keyboard->setFocus(surface);
+#if QT_CONFIG(wayland_datadevice)
if (d->data_device)
d->data_device->setFocus(surface->client());
+#endif
emit keyboardFocusChanged(surface, oldSurface);
return true;
}
@@ -442,11 +457,13 @@ QWaylandCompositor *QWaylandSeat::compositor() const
/*!
* Returns the drag object for this QWaylandSeat.
*/
+#if QT_CONFIG(draganddrop)
QWaylandDrag *QWaylandSeat::drag() const
{
Q_D(const QWaylandSeat);
return d->drag_handle.data();
}
+#endif
/*!
* Returns the capability flags for this QWaylandSeat.
diff --git a/src/compositor/compositor_api/qwaylandseat.h b/src/compositor/compositor_api/qwaylandseat.h
index 49c63260e..63386f275 100644
--- a/src/compositor/compositor_api/qwaylandseat.h
+++ b/src/compositor/compositor_api/qwaylandseat.h
@@ -64,7 +64,9 @@ class Q_WAYLAND_COMPOSITOR_EXPORT QWaylandSeat : public QWaylandObject
Q_OBJECT
Q_DECLARE_PRIVATE(QWaylandSeat)
+#if QT_CONFIG(draganddrop)
Q_PROPERTY(QWaylandDrag *drag READ drag CONSTANT)
+#endif
Q_PROPERTY(QWaylandKeymap *keymap READ keymap CONSTANT)
public:
enum CapabilityFlag {
@@ -115,7 +117,9 @@ public:
QWaylandCompositor *compositor() const;
+#if QT_CONFIG(draganddrop)
QWaylandDrag *drag() const;
+#endif
QWaylandSeat::CapabilityFlags capabilities() const;
diff --git a/src/compositor/compositor_api/qwaylandseat_p.h b/src/compositor/compositor_api/qwaylandseat_p.h
index 4e0b61ba5..689c1b160 100644
--- a/src/compositor/compositor_api/qwaylandseat_p.h
+++ b/src/compositor/compositor_api/qwaylandseat_p.h
@@ -89,12 +89,14 @@ public:
QWaylandSeatPrivate(QWaylandSeat *seat);
~QWaylandSeatPrivate();
- void clientRequestedDataDevice(QtWayland::DataDeviceManager *dndSelection, struct wl_client *client, uint32_t id);
void setCapabilities(QWaylandSeat::CapabilityFlags caps);
static QWaylandSeatPrivate *get(QWaylandSeat *device) { return device->d_func(); }
+#if QT_CONFIG(wayland_datadevice)
+ void clientRequestedDataDevice(QtWayland::DataDeviceManager *dndSelection, struct wl_client *client, uint32_t id);
QtWayland::DataDevice *dataDevice() const { return data_device.data(); }
+#endif
protected:
void seat_bind_resource(wl_seat::Resource *resource) override;
@@ -118,8 +120,12 @@ private:
QScopedPointer<QWaylandPointer> pointer;
QScopedPointer<QWaylandKeyboard> keyboard;
QScopedPointer<QWaylandTouch> touch;
+#if QT_CONFIG(wayland_datadevice)
QScopedPointer<QtWayland::DataDevice> data_device;
+# if QT_CONFIG(draganddrop)
QScopedPointer<QWaylandDrag> drag_handle;
+# endif
+#endif
QScopedPointer<QWaylandKeymap> keymap;
};
diff --git a/src/compositor/compositor_api/qwaylandsurface.cpp b/src/compositor/compositor_api/qwaylandsurface.cpp
index a576e0d6c..d6115e363 100644
--- a/src/compositor/compositor_api/qwaylandsurface.cpp
+++ b/src/compositor/compositor_api/qwaylandsurface.cpp
@@ -38,10 +38,13 @@
#include "qwaylandsurface.h"
#include "qwaylandsurface_p.h"
-#include "wayland_wrapper/qwldatadevice_p.h"
-#include "wayland_wrapper/qwldatadevicemanager_p.h"
#include "wayland_wrapper/qwlbuffermanager_p.h"
#include "wayland_wrapper/qwlregion_p.h"
+#include <QtWaylandCompositor/private/qtwaylandcompositorglobal_p.h>
+#if QT_CONFIG(wayland_datadevice)
+#include "wayland_wrapper/qwldatadevice_p.h"
+#include "wayland_wrapper/qwldatadevicemanager_p.h"
+#endif
#include "extensions/qwlextendedsurface_p.h"
#include "qwaylandinputmethodcontrol_p.h"
@@ -682,6 +685,7 @@ QWaylandInputMethodControl *QWaylandSurface::inputMethodControl() const
* this is done automatically when the surface receives keyboard focus, this
* function is useful for updating clients which do not have keyboard focus.
*/
+#if QT_CONFIG(clipboard)
void QWaylandSurface::updateSelection()
{
Q_D(QWaylandSurface);
@@ -694,6 +698,7 @@ void QWaylandSurface::updateSelection()
}
}
}
+#endif
/*!
* Returns this QWaylandSurface's primary view.
diff --git a/src/compositor/compositor_api/qwaylandsurface.h b/src/compositor/compositor_api/qwaylandsurface.h
index e6a16ffe1..961d200b9 100644
--- a/src/compositor/compositor_api/qwaylandsurface.h
+++ b/src/compositor/compositor_api/qwaylandsurface.h
@@ -140,7 +140,9 @@ public:
#endif
public Q_SLOTS:
+#if QT_CONFIG(clipboard)
void updateSelection();
+#endif
protected:
QWaylandSurface(QWaylandSurfacePrivate &dptr);
diff --git a/src/compositor/configure.json b/src/compositor/configure.json
index 2ddccd98d..733ccfc03 100644
--- a/src/compositor/configure.json
+++ b/src/compositor/configure.json
@@ -61,13 +61,17 @@
"condition": "!config.win32 && libs.wayland-server && tests.wayland-scanner",
"output": [ "privateFeature" ]
},
+ "wayland-datadevice": {
+ "condition": "features.draganddrop || features.clipboard",
+ "output": [ "privateFeature" ]
+ },
"wayland-egl": {
"label": "EGL",
"condition": "features.wayland-server && features.opengl && features.egl && libs.wayland-egl",
"output": [ "privateFeature" ]
},
"wayland-brcm": {
- "label": "Rasberry Pi",
+ "label": "Raspberry Pi",
"condition": "features.wayland-server && features.eglfs_brcm",
"output": [ "privateFeature" ]
},
diff --git a/src/compositor/extensions/qwaylandivisurface.h b/src/compositor/extensions/qwaylandivisurface.h
index e362eecb9..3fd0ede93 100644
--- a/src/compositor/extensions/qwaylandivisurface.h
+++ b/src/compositor/extensions/qwaylandivisurface.h
@@ -39,7 +39,7 @@
#include <QtWaylandCompositor/QWaylandShellSurface>
-class wl_resource;
+struct wl_resource;
QT_BEGIN_NAMESPACE
diff --git a/src/compositor/extensions/qwaylandivisurfaceintegration.cpp b/src/compositor/extensions/qwaylandivisurfaceintegration.cpp
index 3a3d9c1c9..88b727df4 100644
--- a/src/compositor/extensions/qwaylandivisurfaceintegration.cpp
+++ b/src/compositor/extensions/qwaylandivisurfaceintegration.cpp
@@ -54,6 +54,11 @@ IviSurfaceIntegration::IviSurfaceIntegration(QWaylandQuickShellSurfaceItem *item
connect(m_shellSurface, &QWaylandIviSurface::destroyed, this, &IviSurfaceIntegration::handleIviSurfaceDestroyed);
}
+IviSurfaceIntegration::~IviSurfaceIntegration()
+{
+ m_item->setSurface(nullptr);
+}
+
void IviSurfaceIntegration::handleIviSurfaceDestroyed()
{
m_shellSurface = nullptr;
diff --git a/src/compositor/extensions/qwaylandivisurfaceintegration_p.h b/src/compositor/extensions/qwaylandivisurfaceintegration_p.h
index 534caf642..eaccd9591 100644
--- a/src/compositor/extensions/qwaylandivisurfaceintegration_p.h
+++ b/src/compositor/extensions/qwaylandivisurfaceintegration_p.h
@@ -61,6 +61,7 @@ class IviSurfaceIntegration : public QWaylandQuickShellIntegration
Q_OBJECT
public:
IviSurfaceIntegration(QWaylandQuickShellSurfaceItem *item);
+ ~IviSurfaceIntegration();
private Q_SLOTS:
void handleIviSurfaceDestroyed();
diff --git a/src/compositor/extensions/qwaylandquickshellsurfaceitem.cpp b/src/compositor/extensions/qwaylandquickshellsurfaceitem.cpp
index 25e9906f0..22a82ff13 100644
--- a/src/compositor/extensions/qwaylandquickshellsurfaceitem.cpp
+++ b/src/compositor/extensions/qwaylandquickshellsurfaceitem.cpp
@@ -118,7 +118,14 @@ void QWaylandQuickShellSurfaceItem::setShellSurface(QWaylandShellSurface *shellS
d->m_shellSurface = shellSurface;
- d->m_shellIntegration = shellSurface->createIntegration(this);
+ if (d->m_shellIntegration) {
+ delete d->m_shellIntegration;
+ d->m_shellIntegration = nullptr;
+ }
+
+ if (shellSurface)
+ d->m_shellIntegration = shellSurface->createIntegration(this);
+
emit shellSurfaceChanged();
}
diff --git a/src/compositor/extensions/qwaylandquickshellsurfaceitem_p.h b/src/compositor/extensions/qwaylandquickshellsurfaceitem_p.h
index b9eb5ad62..4cd1ebb77 100644
--- a/src/compositor/extensions/qwaylandquickshellsurfaceitem_p.h
+++ b/src/compositor/extensions/qwaylandquickshellsurfaceitem_p.h
@@ -72,7 +72,7 @@ public:
QQuickItem *m_moveItem;
};
-class QWaylandQuickShellIntegration : public QObject
+class Q_WAYLAND_COMPOSITOR_EXPORT QWaylandQuickShellIntegration : public QObject
{
Q_OBJECT
public:
diff --git a/src/compositor/extensions/qwaylandwlshellintegration.cpp b/src/compositor/extensions/qwaylandwlshellintegration.cpp
index b32416764..c3d278a52 100644
--- a/src/compositor/extensions/qwaylandwlshellintegration.cpp
+++ b/src/compositor/extensions/qwaylandwlshellintegration.cpp
@@ -68,6 +68,11 @@ WlShellIntegration::WlShellIntegration(QWaylandQuickShellSurfaceItem *item)
connect(m_shellSurface.data(), &QWaylandWlShellSurface::destroyed, this, &WlShellIntegration::handleShellSurfaceDestroyed);
}
+WlShellIntegration::~WlShellIntegration()
+{
+ m_item->setSurface(nullptr);
+}
+
void WlShellIntegration::handleStartMove(QWaylandSeat *seat)
{
grabberState = GrabberState::Move;
diff --git a/src/compositor/extensions/qwaylandwlshellintegration_p.h b/src/compositor/extensions/qwaylandwlshellintegration_p.h
index 814f5e12d..15aec01c6 100644
--- a/src/compositor/extensions/qwaylandwlshellintegration_p.h
+++ b/src/compositor/extensions/qwaylandwlshellintegration_p.h
@@ -61,6 +61,7 @@ class WlShellIntegration : public QWaylandQuickShellIntegration
Q_OBJECT
public:
WlShellIntegration(QWaylandQuickShellSurfaceItem *item);
+ ~WlShellIntegration();
bool mouseMoveEvent(QMouseEvent *event) override;
bool mouseReleaseEvent(QMouseEvent *event) override;
diff --git a/src/compositor/extensions/qwaylandxdgshellv5.cpp b/src/compositor/extensions/qwaylandxdgshellv5.cpp
index 80aa52e70..6a09a6c77 100644
--- a/src/compositor/extensions/qwaylandxdgshellv5.cpp
+++ b/src/compositor/extensions/qwaylandxdgshellv5.cpp
@@ -1070,7 +1070,7 @@ QWaylandXdgPopupV5::QWaylandXdgPopupV5()
/*!
* Constructs a QWaylandXdgPopupV5, associating it with \a xdgShell at the specified \a position
- * for \a surface and initializes it with the given \a parentSurface and \a resource.
+ * for \a surface, and initializes it with the given \a parentSurface and \a resource.
*/
QWaylandXdgPopupV5::QWaylandXdgPopupV5(QWaylandXdgShellV5 *xdgShell, QWaylandSurface *surface,
QWaylandSurface *parentSurface, const QPoint &position, const QWaylandResource &resource)
@@ -1087,8 +1087,8 @@ QWaylandXdgPopupV5::QWaylandXdgPopupV5(QWaylandXdgShellV5 *xdgShell, QWaylandSur
*/
/*!
- * Initializes the QWaylandXdgPopupV5, associating it with the given \a shell \a surface,
- * \a parentSurface and \a resource.
+ * Initializes the QWaylandXdgPopupV5, associating it with the given \a shell, \a surface,
+ * \a parentSurface, \a position, and \a resource.
*/
void QWaylandXdgPopupV5::initialize(QWaylandXdgShellV5 *shell, QWaylandSurface *surface, QWaylandSurface *parentSurface,
const QPoint& position, const QWaylandResource &resource)
@@ -1103,6 +1103,7 @@ void QWaylandXdgPopupV5::initialize(QWaylandXdgShellV5 *shell, QWaylandSurface *
emit shellChanged();
emit surfaceChanged();
emit parentSurfaceChanged();
+ emit positionChanged();
QWaylandCompositorExtension::initialize();
}
diff --git a/src/compositor/extensions/qwaylandxdgshellv5.h b/src/compositor/extensions/qwaylandxdgshellv5.h
index 269ea8934..4adf0f9b8 100644
--- a/src/compositor/extensions/qwaylandxdgshellv5.h
+++ b/src/compositor/extensions/qwaylandxdgshellv5.h
@@ -212,7 +212,7 @@ class Q_WAYLAND_COMPOSITOR_EXPORT QWaylandXdgPopupV5 : public QWaylandShellSurfa
Q_PROPERTY(QWaylandXdgShellV5 *shell READ shell NOTIFY shellChanged)
Q_PROPERTY(QWaylandSurface *surface READ surface NOTIFY surfaceChanged)
Q_PROPERTY(QWaylandSurface *parentSurface READ parentSurface NOTIFY parentSurfaceChanged)
- Q_PROPERTY(QPoint position READ position)
+ Q_PROPERTY(QPoint position READ position NOTIFY positionChanged)
public:
QWaylandXdgPopupV5();
@@ -245,6 +245,7 @@ Q_SIGNALS:
void shellChanged();
void surfaceChanged();
void parentSurfaceChanged();
+ void positionChanged();
private:
void initialize() override;
diff --git a/src/compositor/extensions/qwaylandxdgshellv5integration.cpp b/src/compositor/extensions/qwaylandxdgshellv5integration.cpp
index e2aa6b3ea..156d5679b 100644
--- a/src/compositor/extensions/qwaylandxdgshellv5integration.cpp
+++ b/src/compositor/extensions/qwaylandxdgshellv5integration.cpp
@@ -65,6 +65,11 @@ XdgShellV5Integration::XdgShellV5Integration(QWaylandQuickShellSurfaceItem *item
connect(m_xdgSurface->surface(), &QWaylandSurface::sizeChanged, this, &XdgShellV5Integration::handleSurfaceSizeChanged);
}
+XdgShellV5Integration::~XdgShellV5Integration()
+{
+ m_item->setSurface(nullptr);
+}
+
bool XdgShellV5Integration::mouseMoveEvent(QMouseEvent *event)
{
if (grabberState == GrabberState::Resize) {
@@ -190,6 +195,7 @@ void XdgShellV5Integration::handleSurfaceSizeChanged()
XdgPopupV5Integration::XdgPopupV5Integration(QWaylandQuickShellSurfaceItem *item)
: QWaylandQuickShellIntegration (item)
+ , m_item(item)
, m_xdgPopup(qobject_cast<QWaylandXdgPopupV5 *>(item->shellSurface()))
, m_xdgShell(QWaylandXdgPopupV5Private::get(m_xdgPopup)->m_xdgShell)
{
@@ -206,6 +212,11 @@ XdgPopupV5Integration::XdgPopupV5Integration(QWaylandQuickShellSurfaceItem *item
connect(m_xdgPopup, &QWaylandXdgPopupV5::destroyed, this, &XdgPopupV5Integration::handlePopupDestroyed);
}
+XdgPopupV5Integration::~XdgPopupV5Integration()
+{
+ m_item->setSurface(nullptr);
+}
+
void XdgPopupV5Integration::handlePopupDestroyed()
{
QWaylandXdgShellV5Private *shellPrivate = QWaylandXdgShellV5Private::get(m_xdgShell);
diff --git a/src/compositor/extensions/qwaylandxdgshellv5integration_p.h b/src/compositor/extensions/qwaylandxdgshellv5integration_p.h
index 6f02ab399..90c425e6f 100644
--- a/src/compositor/extensions/qwaylandxdgshellv5integration_p.h
+++ b/src/compositor/extensions/qwaylandxdgshellv5integration_p.h
@@ -60,6 +60,7 @@ class XdgShellV5Integration : public QWaylandQuickShellIntegration
Q_OBJECT
public:
XdgShellV5Integration(QWaylandQuickShellSurfaceItem *item);
+ ~XdgShellV5Integration();
bool mouseMoveEvent(QMouseEvent *event) override;
bool mouseReleaseEvent(QMouseEvent *event) override;
@@ -111,11 +112,13 @@ class XdgPopupV5Integration : public QWaylandQuickShellIntegration
Q_OBJECT
public:
XdgPopupV5Integration(QWaylandQuickShellSurfaceItem *item);
+ ~XdgPopupV5Integration();
private Q_SLOTS:
void handlePopupDestroyed();
private:
+ QWaylandQuickShellSurfaceItem *m_item;
QWaylandXdgPopupV5 *m_xdgPopup;
QWaylandXdgShellV5 *m_xdgShell;
};
diff --git a/src/compositor/wayland_wrapper/qwlclientbuffer_p.h b/src/compositor/wayland_wrapper/qwlclientbuffer_p.h
index efb2eb18b..dbc8a0b7c 100644
--- a/src/compositor/wayland_wrapper/qwlclientbuffer_p.h
+++ b/src/compositor/wayland_wrapper/qwlclientbuffer_p.h
@@ -130,7 +130,7 @@ public:
QSize size() const override;
QWaylandSurface::Origin origin() const override;
- QImage image() const;
+ QImage image() const override;
#if QT_CONFIG(opengl)
QOpenGLTexture *toOpenGlTexture(int plane = 0) override;
diff --git a/src/compositor/wayland_wrapper/qwldatadevice.cpp b/src/compositor/wayland_wrapper/qwldatadevice.cpp
index 0d196b82e..3787edf58 100644
--- a/src/compositor/wayland_wrapper/qwldatadevice.cpp
+++ b/src/compositor/wayland_wrapper/qwldatadevice.cpp
@@ -41,7 +41,9 @@
#include "qwaylandsurface_p.h"
#include "qwldatadevicemanager_p.h"
+#if QT_CONFIG(draganddrop)
#include "qwaylanddrag.h"
+#endif
#include "qwaylandview.h"
#include <QtWaylandCompositor/QWaylandClient>
#include <QtWaylandCompositor/private/qwaylandcompositor_p.h>
@@ -60,12 +62,14 @@ DataDevice::DataDevice(QWaylandSeat *seat)
, m_compositor(seat->compositor())
, m_seat(seat)
, m_selectionSource(0)
+#if QT_CONFIG(draganddrop)
, m_dragClient(0)
, m_dragDataSource(0)
, m_dragFocus(0)
, m_dragFocusResource(0)
, m_dragIcon(0)
, m_dragOrigin(nullptr)
+#endif
{
}
@@ -85,6 +89,13 @@ void DataDevice::setFocus(QWaylandClient *focusClient)
}
}
+void DataDevice::sourceDestroyed(DataSource *source)
+{
+ if (m_selectionSource == source)
+ m_selectionSource = 0;
+}
+
+#if QT_CONFIG(draganddrop)
void DataDevice::setDragFocus(QWaylandSurface *focus, const QPointF &localPosition)
{
if (m_dragFocusResource) {
@@ -129,12 +140,6 @@ QWaylandSurface *DataDevice::dragOrigin() const
return m_dragOrigin;
}
-void DataDevice::sourceDestroyed(DataSource *source)
-{
- if (m_selectionSource == source)
- m_selectionSource = 0;
-}
-
void DataDevice::dragMove(QWaylandSurface *target, const QPointF &pos)
{
if (target != m_dragFocus)
@@ -177,6 +182,15 @@ void DataDevice::data_device_start_drag(Resource *resource, struct ::wl_resource
//### need to verify that we have an implicit grab with this serial
}
+void DataDevice::setDragIcon(QWaylandSurface *icon)
+{
+ if (icon == m_dragIcon)
+ return;
+ m_dragIcon = icon;
+ Q_EMIT m_seat->drag()->iconChanged();
+}
+#endif // QT_CONFIG(draganddrop)
+
void DataDevice::data_device_set_selection(Resource *, struct ::wl_resource *source, uint32_t serial)
{
Q_UNUSED(serial);
@@ -202,13 +216,6 @@ void DataDevice::data_device_set_selection(Resource *, struct ::wl_resource *sou
}
}
-void DataDevice::setDragIcon(QWaylandSurface *icon)
-{
- if (icon == m_dragIcon)
- return;
- m_dragIcon = icon;
- Q_EMIT m_seat->drag()->iconChanged();
-}
}
diff --git a/src/compositor/wayland_wrapper/qwldatadevice_p.h b/src/compositor/wayland_wrapper/qwldatadevice_p.h
index 57a9c0a80..5c37058df 100644
--- a/src/compositor/wayland_wrapper/qwldatadevice_p.h
+++ b/src/compositor/wayland_wrapper/qwldatadevice_p.h
@@ -49,8 +49,11 @@
//
#include <QtWaylandCompositor/private/qwayland-server-wayland.h>
+#include <QtWaylandCompositor/private/qtwaylandcompositorglobal_p.h>
#include <QtWaylandCompositor/QWaylandSeat>
+QT_REQUIRE_CONFIG(wayland_datadevice);
+
QT_BEGIN_NAMESPACE
namespace QtWayland {
@@ -66,30 +69,36 @@ public:
DataDevice(QWaylandSeat *seat);
void setFocus(QWaylandClient *client);
+ void sourceDestroyed(DataSource *source);
+#if QT_CONFIG(draganddrop)
void setDragFocus(QWaylandSurface *focus, const QPointF &localPosition);
QWaylandSurface *dragIcon() const;
QWaylandSurface *dragOrigin() const;
- void sourceDestroyed(DataSource *source);
-
void dragMove(QWaylandSurface *target, const QPointF &pos);
void drop();
void cancelDrag();
+#endif
protected:
+#if QT_CONFIG(draganddrop)
void data_device_start_drag(Resource *resource, struct ::wl_resource *source, struct ::wl_resource *origin, struct ::wl_resource *icon, uint32_t serial) override;
+#endif
void data_device_set_selection(Resource *resource, struct ::wl_resource *source, uint32_t serial) override;
private:
+#if QT_CONFIG(draganddrop)
void setDragIcon(QWaylandSurface *icon);
+#endif
QWaylandCompositor *m_compositor;
QWaylandSeat *m_seat;
DataSource *m_selectionSource;
+#if QT_CONFIG(draganddrop)
struct ::wl_client *m_dragClient;
DataSource *m_dragDataSource;
@@ -98,6 +107,7 @@ private:
QWaylandSurface *m_dragIcon;
QWaylandSurface *m_dragOrigin;
+#endif
};
}
diff --git a/src/compositor/wayland_wrapper/qwldatadevicemanager_p.h b/src/compositor/wayland_wrapper/qwldatadevicemanager_p.h
index 483731dfd..39037b7a5 100644
--- a/src/compositor/wayland_wrapper/qwldatadevicemanager_p.h
+++ b/src/compositor/wayland_wrapper/qwldatadevicemanager_p.h
@@ -56,6 +56,9 @@
#include <QtWaylandCompositor/QWaylandCompositor>
#include <QtWaylandCompositor/private/qwayland-server-wayland.h>
+#include <QtWaylandCompositor/private/qtwaylandcompositorglobal_p.h>
+
+QT_REQUIRE_CONFIG(wayland_datadevice);
QT_BEGIN_NAMESPACE
diff --git a/src/compositor/wayland_wrapper/qwldataoffer_p.h b/src/compositor/wayland_wrapper/qwldataoffer_p.h
index dc1c84fe0..bb0990824 100644
--- a/src/compositor/wayland_wrapper/qwldataoffer_p.h
+++ b/src/compositor/wayland_wrapper/qwldataoffer_p.h
@@ -50,6 +50,9 @@
#include <QPointer>
#include <QtWaylandCompositor/private/qwayland-server-wayland.h>
+#include <QtWaylandCompositor/private/qtwaylandcompositorglobal_p.h>
+
+QT_REQUIRE_CONFIG(wayland_datadevice);
QT_BEGIN_NAMESPACE
diff --git a/src/compositor/wayland_wrapper/qwldatasource_p.h b/src/compositor/wayland_wrapper/qwldatasource_p.h
index b548a2411..d59e01e08 100644
--- a/src/compositor/wayland_wrapper/qwldatasource_p.h
+++ b/src/compositor/wayland_wrapper/qwldatasource_p.h
@@ -49,9 +49,12 @@
//
#include <QtWaylandCompositor/private/qwayland-server-wayland.h>
+#include <QtWaylandCompositor/private/qtwaylandcompositorglobal_p.h>
#include <QObject>
#include <QtCore/QList>
+QT_REQUIRE_CONFIG(wayland_datadevice);
+
QT_BEGIN_NAMESPACE
namespace QtWayland {
diff --git a/src/compositor/wayland_wrapper/wayland_wrapper.pri b/src/compositor/wayland_wrapper/wayland_wrapper.pri
index 48e55e513..e19ea253a 100644
--- a/src/compositor/wayland_wrapper/wayland_wrapper.pri
+++ b/src/compositor/wayland_wrapper/wayland_wrapper.pri
@@ -1,27 +1,33 @@
CONFIG += wayland-scanner
-WAYLANDSERVERSOURCES += \
+WAYLANDSERVERSOURCES_SYSTEM += \
../3rdparty/protocol/wayland.xml \
HEADERS += \
wayland_wrapper/qwlbuffermanager_p.h \
wayland_wrapper/qwlclientbuffer_p.h \
- wayland_wrapper/qwldatadevice_p.h \
- wayland_wrapper/qwldatadevicemanager_p.h \
- wayland_wrapper/qwldataoffer_p.h \
- wayland_wrapper/qwldatasource_p.h \
wayland_wrapper/qwlregion_p.h \
../shared/qwaylandxkb_p.h \
SOURCES += \
wayland_wrapper/qwlbuffermanager.cpp \
wayland_wrapper/qwlclientbuffer.cpp \
- wayland_wrapper/qwldatadevice.cpp \
- wayland_wrapper/qwldatadevicemanager.cpp \
- wayland_wrapper/qwldataoffer.cpp \
- wayland_wrapper/qwldatasource.cpp \
wayland_wrapper/qwlregion.cpp \
../shared/qwaylandxkb.cpp \
+qtConfig(wayland-datadevice) {
+ HEADERS += \
+ wayland_wrapper/qwldatadevice_p.h \
+ wayland_wrapper/qwldatadevicemanager_p.h \
+ wayland_wrapper/qwldataoffer_p.h \
+ wayland_wrapper/qwldatasource_p.h
+
+ SOURCES += \
+ wayland_wrapper/qwldatadevice.cpp \
+ wayland_wrapper/qwldatadevicemanager.cpp \
+ wayland_wrapper/qwldataoffer.cpp \
+ wayland_wrapper/qwldatasource.cpp
+}
+
INCLUDEPATH += wayland_wrapper
qtConfig(xkbcommon-evdev): \