diff options
Diffstat (limited to 'src/compositor/wayland_wrapper')
5 files changed, 46 insertions, 23 deletions
diff --git a/src/compositor/wayland_wrapper/qwldatadevice.cpp b/src/compositor/wayland_wrapper/qwldatadevice.cpp index dea72bdcd..0d196b82e 100644 --- a/src/compositor/wayland_wrapper/qwldatadevice.cpp +++ b/src/compositor/wayland_wrapper/qwldatadevice.cpp @@ -45,7 +45,7 @@ #include "qwaylandview.h" #include <QtWaylandCompositor/QWaylandClient> #include <QtWaylandCompositor/private/qwaylandcompositor_p.h> -#include <QtWaylandCompositor/private/qwaylandinput_p.h> +#include <QtWaylandCompositor/private/qwaylandseat_p.h> #include <QtWaylandCompositor/private/qwaylandpointer_p.h> #include <QtCore/QPointF> @@ -55,16 +55,17 @@ QT_BEGIN_NAMESPACE namespace QtWayland { -DataDevice::DataDevice(QWaylandInputDevice *inputDevice) +DataDevice::DataDevice(QWaylandSeat *seat) : wl_data_device() - , m_compositor(inputDevice->compositor()) - , m_inputDevice(inputDevice) + , m_compositor(seat->compositor()) + , m_seat(seat) , m_selectionSource(0) , m_dragClient(0) , m_dragDataSource(0) , m_dragFocus(0) , m_dragFocusResource(0) , m_dragIcon(0) + , m_dragOrigin(nullptr) { } @@ -123,6 +124,11 @@ QWaylandSurface *DataDevice::dragIcon() const return m_dragIcon; } +QWaylandSurface *DataDevice::dragOrigin() const +{ + return m_dragOrigin; +} + void DataDevice::sourceDestroyed(DataSource *source) { if (m_selectionSource == source) @@ -148,6 +154,7 @@ void DataDevice::drop() } else { m_dragDataSource->cancel(); } + m_dragOrigin = nullptr; setDragIcon(nullptr); } @@ -160,11 +167,13 @@ void DataDevice::data_device_start_drag(Resource *resource, struct ::wl_resource { m_dragClient = resource->client(); m_dragDataSource = source ? DataSource::fromResource(source) : 0; + m_dragOrigin = QWaylandSurface::fromResource(origin); + QWaylandDrag *drag = m_seat->drag(); setDragIcon(icon ? QWaylandSurface::fromResource(icon) : nullptr); - Q_EMIT m_inputDevice->drag()->dragStarted(); + Q_EMIT drag->dragStarted(); + Q_EMIT m_dragOrigin->dragStarted(drag); Q_UNUSED(serial); - Q_UNUSED(origin); //### need to verify that we have an implicit grab with this serial } @@ -182,7 +191,7 @@ void DataDevice::data_device_set_selection(Resource *, struct ::wl_resource *sou if (m_selectionSource) m_selectionSource->setDevice(this); - QWaylandClient *focusClient = m_inputDevice->keyboard()->focusClient(); + QWaylandClient *focusClient = m_seat->keyboard()->focusClient(); Resource *resource = focusClient ? resourceMap().value(focusClient->client()) : 0; if (resource && m_selectionSource) { @@ -198,7 +207,7 @@ void DataDevice::setDragIcon(QWaylandSurface *icon) if (icon == m_dragIcon) return; m_dragIcon = icon; - Q_EMIT m_inputDevice->drag()->iconChanged(); + 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 2127603a8..17591ae27 100644 --- a/src/compositor/wayland_wrapper/qwldatadevice_p.h +++ b/src/compositor/wayland_wrapper/qwldatadevice_p.h @@ -49,7 +49,7 @@ // #include <QtWaylandCompositor/private/qwayland-server-wayland.h> -#include <QtWaylandCompositor/QWaylandInputDevice> +#include <QtWaylandCompositor/QWaylandSeat> QT_BEGIN_NAMESPACE @@ -57,19 +57,20 @@ namespace QtWayland { class Compositor; class DataSource; -class InputDevice; +class Seat; class Surface; class DataDevice : public QtWaylandServer::wl_data_device { public: - DataDevice(QWaylandInputDevice *inputDevice); + DataDevice(QWaylandSeat *seat); void setFocus(QWaylandClient *client); void setDragFocus(QWaylandSurface *focus, const QPointF &localPosition); QWaylandSurface *dragIcon() const; + QWaylandSurface *dragOrigin() const; void sourceDestroyed(DataSource *source); @@ -85,7 +86,7 @@ private: void setDragIcon(QWaylandSurface *icon); QWaylandCompositor *m_compositor; - QWaylandInputDevice *m_inputDevice; + QWaylandSeat *m_seat; DataSource *m_selectionSource; @@ -96,6 +97,7 @@ private: Resource *m_dragFocusResource; QWaylandSurface *m_dragIcon; + QWaylandSurface *m_dragOrigin; }; } diff --git a/src/compositor/wayland_wrapper/qwldatadevicemanager.cpp b/src/compositor/wayland_wrapper/qwldatadevicemanager.cpp index 2f40b0e43..5fed6ef18 100644 --- a/src/compositor/wayland_wrapper/qwldatadevicemanager.cpp +++ b/src/compositor/wayland_wrapper/qwldatadevicemanager.cpp @@ -39,7 +39,7 @@ #include <QtWaylandCompositor/QWaylandCompositor> #include <QtWaylandCompositor/private/qwaylandcompositor_p.h> -#include <QtWaylandCompositor/private/qwaylandinput_p.h> +#include <QtWaylandCompositor/private/qwaylandseat_p.h> #include "qwldatadevice_p.h" #include "qwldatasource_p.h" #include "qwldataoffer_p.h" @@ -199,11 +199,11 @@ void DataDeviceManager::overrideSelection(const QMimeData &mimeData) m_compositorOwnsSelection = true; - QWaylandInputDevice *dev = m_compositor->defaultInputDevice(); + QWaylandSeat *dev = m_compositor->defaultSeat(); QWaylandSurface *focusSurface = dev->keyboardFocus(); if (focusSurface) offerFromCompositorToClient( - QWaylandInputDevicePrivate::get(dev)->dataDevice()->resourceMap().value(focusSurface->waylandClient())->handle); + QWaylandSeatPrivate::get(dev)->dataDevice()->resourceMap().value(focusSurface->waylandClient())->handle); } bool DataDeviceManager::offerFromCompositorToClient(wl_resource *clientDataDeviceResource) @@ -243,8 +243,8 @@ void DataDeviceManager::data_device_manager_create_data_source(Resource *resourc void DataDeviceManager::data_device_manager_get_data_device(Resource *resource, uint32_t id, struct ::wl_resource *seat) { - QWaylandInputDevice *input_device = QWaylandInputDevice::fromSeatResource(seat); - QWaylandInputDevicePrivate::get(input_device)->clientRequestedDataDevice(this, resource->client(), id); + QWaylandSeat *input_device = QWaylandSeat::fromSeatResource(seat); + QWaylandSeatPrivate::get(input_device)->clientRequestedDataDevice(this, resource->client(), id); } void DataDeviceManager::comp_accept(wl_client *, wl_resource *, uint32_t, const char *) diff --git a/src/compositor/wayland_wrapper/qwlsurfacebuffer.cpp b/src/compositor/wayland_wrapper/qwlsurfacebuffer.cpp index 240ce01bc..df2dded2f 100644 --- a/src/compositor/wayland_wrapper/qwlsurfacebuffer.cpp +++ b/src/compositor/wayland_wrapper/qwlsurfacebuffer.cpp @@ -36,7 +36,7 @@ #include "qwlsurfacebuffer_p.h" -#ifdef QT_COMPOSITOR_WAYLAND_GL +#ifdef QT_WAYLAND_COMPOSITOR_GL #include "hardware_integration/qwlclientbufferintegration_p.h" #include <qpa/qplatformopenglcontext.h> #endif @@ -44,7 +44,7 @@ #include <QtCore/QDebug> #include <wayland-server-protocol.h> -#include "qwaylandshmformathelper_p.h" +#include "qwaylandsharedmemoryformathelper_p.h" #include <QtWaylandCompositor/private/qwaylandcompositor_p.h> @@ -83,8 +83,10 @@ void SurfaceBuffer::initialize(struct ::wl_resource *buffer) m_destroy_listener.surfaceBuffer = this; m_destroy_listener.listener.notify = destroy_listener_callback; if (buffer) { +#ifdef QT_WAYLAND_COMPOSITOR_GL if (ClientBufferIntegration *integration = QWaylandCompositorPrivate::get(m_compositor)->clientBufferIntegration()) integration->initializeBuffer(buffer); +#endif wl_signal_add(&buffer->destroy_signal, &m_destroy_listener.listener); } } @@ -167,22 +169,26 @@ QSize SurfaceBuffer::size() const int height = wl_shm_buffer_get_height(shmBuffer); return QSize(width, height); } +#ifdef QT_WAYLAND_COMPOSITOR_GL if (ClientBufferIntegration *integration = QWaylandCompositorPrivate::get(m_compositor)->clientBufferIntegration()) { return integration->bufferSize(m_buffer); } +#endif return QSize(); } QWaylandSurface::Origin SurfaceBuffer::origin() const { - if (isShm()) { + if (isSharedMemory()) { return QWaylandSurface::OriginTopLeft; } +#ifdef QT_WAYLAND_COMPOSITOR_GL if (ClientBufferIntegration *integration = QWaylandCompositorPrivate::get(m_compositor)->clientBufferIntegration()) { return integration->origin(m_buffer); } +#endif return QWaylandSurface::OriginTopLeft; } @@ -201,18 +207,21 @@ QImage SurfaceBuffer::image() const QWaylandBufferRef::BufferFormatEgl SurfaceBuffer::bufferFormatEgl() const { - Q_ASSERT(isShm() == false); + Q_ASSERT(isSharedMemory() == false); +#ifdef QT_WAYLAND_COMPOSITOR_GL if (QtWayland::ClientBufferIntegration *clientInt = QWaylandCompositorPrivate::get(m_compositor)->clientBufferIntegration()) return clientInt->bufferFormat(m_buffer); +#endif return QWaylandBufferRef::BufferFormatEgl_Null; } +#ifdef QT_WAYLAND_COMPOSITOR_GL void SurfaceBuffer::bindToTexture() const { Q_ASSERT(m_compositor); - if (isShm()) { + if (isSharedMemory()) { QImage image = this->image(); if (image.hasAlphaChannel()) { if (image.format() != QImage::Format_RGBA8888) { @@ -245,6 +254,7 @@ void SurfaceBuffer::updateTexture() const if (QtWayland::ClientBufferIntegration *clientInt = QWaylandCompositorPrivate::get(m_compositor)->clientBufferIntegration()) clientInt->updateTextureForBuffer(m_buffer); } +#endif } diff --git a/src/compositor/wayland_wrapper/qwlsurfacebuffer_p.h b/src/compositor/wayland_wrapper/qwlsurfacebuffer_p.h index 95e7e8158..e0a7d021f 100644 --- a/src/compositor/wayland_wrapper/qwlsurfacebuffer_p.h +++ b/src/compositor/wayland_wrapper/qwlsurfacebuffer_p.h @@ -101,13 +101,15 @@ public: QSize size() const; QWaylandSurface::Origin origin() const; - bool isShm() const { return wl_shm_buffer_get(m_buffer); } + bool isSharedMemory() const { return wl_shm_buffer_get(m_buffer); } QImage image() const; QWaylandBufferRef::BufferFormatEgl bufferFormatEgl() const; +#ifdef QT_WAYLAND_COMPOSITOR_GL void bindToTexture() const; uint textureForPlane(int plane) const; void updateTexture() const; +#endif static bool hasContent(SurfaceBuffer *buffer) { return buffer && buffer->waylandBufferHandle(); } private: |