Merge remote-tracking branch 'qt/5.7' into 5.8
Change-Id: Ibfe6fe6ed983b537d55544883b7dc75e5cc3fc37
This commit is contained in:
commit
2744dfbb87
@ -44,6 +44,8 @@
|
||||
#include "qwaylanddatasource_p.h"
|
||||
#include "qwaylanddatadevice_p.h"
|
||||
|
||||
#ifndef QT_NO_DRAGANDDROP
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
namespace QtWaylandClient {
|
||||
@ -60,11 +62,11 @@ QWaylandClipboard::~QWaylandClipboard()
|
||||
QMimeData *QWaylandClipboard::mimeData(QClipboard::Mode mode)
|
||||
{
|
||||
if (mode != QClipboard::Clipboard)
|
||||
return 0;
|
||||
return &m_emptyData;
|
||||
|
||||
QWaylandInputDevice *inputDevice = mDisplay->currentInputDevice();
|
||||
if (!inputDevice || !inputDevice->dataDevice())
|
||||
return 0;
|
||||
return &m_emptyData;
|
||||
|
||||
QWaylandDataSource *source = inputDevice->dataDevice()->selectionSource();
|
||||
if (source) {
|
||||
@ -74,7 +76,7 @@ QMimeData *QWaylandClipboard::mimeData(QClipboard::Mode mode)
|
||||
if (inputDevice->dataDevice()->selectionOffer())
|
||||
return inputDevice->dataDevice()->selectionOffer()->mimeData();
|
||||
|
||||
return 0;
|
||||
return &m_emptyData;
|
||||
}
|
||||
|
||||
void QWaylandClipboard::setMimeData(QMimeData *data, QClipboard::Mode mode)
|
||||
@ -115,3 +117,5 @@ bool QWaylandClipboard::ownsMode(QClipboard::Mode mode) const
|
||||
}
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
#endif // QT_NO_DRAGANDDROP
|
||||
|
@ -53,9 +53,11 @@
|
||||
|
||||
#include <qpa/qplatformclipboard.h>
|
||||
#include <QtCore/QVariant>
|
||||
#include <QtCore/QMimeData>
|
||||
|
||||
#include <QtWaylandClient/qwaylandclientexport.h>
|
||||
|
||||
#ifndef QT_NO_DRAGANDDROP
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
namespace QtWaylandClient {
|
||||
@ -76,10 +78,13 @@ public:
|
||||
|
||||
private:
|
||||
QWaylandDisplay *mDisplay;
|
||||
QMimeData m_emptyData;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
#endif // QT_NO_DRAGANDDROP
|
||||
|
||||
#endif // QWAYLANDCLIPBOARD_H
|
||||
|
@ -56,6 +56,8 @@
|
||||
#include <qpa/qplatformdrag.h>
|
||||
#include <qpa/qwindowsysteminterface.h>
|
||||
|
||||
#ifndef QT_NO_DRAGANDDROP
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
namespace QtWaylandClient {
|
||||
@ -268,3 +270,5 @@ QPoint QWaylandDataDevice::calculateDragPosition(int x, int y, QWindow *wnd) con
|
||||
}
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
#endif // QT_NO_DRAGANDDROP
|
||||
|
@ -58,6 +58,8 @@
|
||||
|
||||
#include <QtWaylandClient/private/qwayland-wayland.h>
|
||||
|
||||
#ifndef QT_NO_DRAGANDDROP
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
class QMimeData;
|
||||
@ -120,4 +122,6 @@ private:
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
#endif // QT_NO_DRAGANDDROP
|
||||
|
||||
#endif // QWAYLANDDATADEVICE_H
|
||||
|
@ -46,6 +46,8 @@
|
||||
|
||||
#include <QtCore/QDebug>
|
||||
|
||||
#ifndef QT_NO_DRAGANDDROP
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
namespace QtWaylandClient {
|
||||
@ -80,3 +82,5 @@ QWaylandDisplay *QWaylandDataDeviceManager::display() const
|
||||
}
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
#endif // QT_NO_DRAGANDDROP
|
||||
|
@ -54,6 +54,8 @@
|
||||
#include <QtWaylandClient/qwaylandclientexport.h>
|
||||
#include <QtWaylandClient/private/qwayland-wayland.h>
|
||||
|
||||
#ifndef QT_NO_DRAGANDDROP
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
namespace QtWaylandClient {
|
||||
@ -81,4 +83,6 @@ private:
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
#endif // QT_NO_DRAGANDDROP
|
||||
|
||||
#endif // QWAYLANDDATADEVICEMANAGER_H
|
||||
|
@ -47,6 +47,8 @@
|
||||
|
||||
#include <QtCore/QDebug>
|
||||
|
||||
#ifndef QT_NO_DRAGANDDROP
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
namespace QtWaylandClient {
|
||||
@ -181,3 +183,5 @@ int QWaylandMimeData::readData(int fd, QByteArray &data) const
|
||||
}
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
#endif // QT_NO_DRAGANDDROP
|
||||
|
@ -56,6 +56,7 @@
|
||||
#include <QtWaylandClient/qwaylandclientexport.h>
|
||||
#include <QtWaylandClient/private/qwayland-wayland.h>
|
||||
|
||||
#ifndef QT_NO_DRAGANDDROP
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
namespace QtWaylandClient {
|
||||
@ -105,5 +106,5 @@ private:
|
||||
}
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
#endif // QT_NO_DRAGANDDROP
|
||||
#endif
|
||||
|
@ -49,6 +49,8 @@
|
||||
|
||||
#include <unistd.h>
|
||||
|
||||
#ifndef QT_NO_DRAGANDDROP
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
namespace QtWaylandClient {
|
||||
@ -96,3 +98,5 @@ void QWaylandDataSource::data_source_target(const QString &mime_type)
|
||||
}
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
#endif // QT_NO_DRAGANDDROP
|
||||
|
@ -56,6 +56,8 @@
|
||||
#include <QtWaylandClient/private/qwayland-wayland.h>
|
||||
#include <QtWaylandClient/qwaylandclientexport.h>
|
||||
|
||||
#ifndef QT_NO_DRAGANDDROP
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
class QMimeData;
|
||||
@ -92,4 +94,6 @@ private:
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
#endif // QT_NO_DRAGANDDROP
|
||||
|
||||
#endif // QWAYLANDDATASOURCE_H
|
||||
|
@ -120,7 +120,9 @@ QWaylandWindowManagerIntegration *QWaylandDisplay::windowManagerIntegration() co
|
||||
|
||||
QWaylandDisplay::QWaylandDisplay(QWaylandIntegration *waylandIntegration)
|
||||
: mWaylandIntegration(waylandIntegration)
|
||||
#ifndef QT_NO_DRAGANDDROP
|
||||
, mDndSelectionHandler(0)
|
||||
#endif
|
||||
, mWindowExtension(0)
|
||||
, mSubCompositor(0)
|
||||
, mTouchExtension(0)
|
||||
@ -158,7 +160,9 @@ QWaylandDisplay::~QWaylandDisplay(void)
|
||||
mWaylandIntegration->destroyScreen(screen);
|
||||
}
|
||||
mScreens.clear();
|
||||
#ifndef QT_NO_DRAGANDDROP
|
||||
delete mDndSelectionHandler.take();
|
||||
#endif
|
||||
wl_display_disconnect(mDisplay);
|
||||
}
|
||||
|
||||
@ -251,8 +255,10 @@ void QWaylandDisplay::registry_global(uint32_t id, const QString &interface, uin
|
||||
} else if (interface == QStringLiteral("wl_seat")) {
|
||||
QWaylandInputDevice *inputDevice = mWaylandIntegration->createInputDevice(this, version, id);
|
||||
mInputDevices.append(inputDevice);
|
||||
#ifndef QT_NO_DRAGANDDROP
|
||||
} else if (interface == QStringLiteral("wl_data_device_manager")) {
|
||||
mDndSelectionHandler.reset(new QWaylandDataDeviceManager(this, id));
|
||||
#endif
|
||||
} else if (interface == QStringLiteral("qt_surface_extension")) {
|
||||
mWindowExtension.reset(new QtWayland::qt_surface_extension(registry, id, 1));
|
||||
} else if (interface == QStringLiteral("wl_subcompositor")) {
|
||||
|
@ -137,9 +137,9 @@ public:
|
||||
QList<QWaylandInputDevice *> inputDevices() const { return mInputDevices; }
|
||||
QWaylandInputDevice *defaultInputDevice() const;
|
||||
QWaylandInputDevice *currentInputDevice() const { return defaultInputDevice(); }
|
||||
|
||||
#ifndef QT_NO_DRAGANDDROP
|
||||
QWaylandDataDeviceManager *dndSelectionHandler() const { return mDndSelectionHandler.data(); }
|
||||
|
||||
#endif
|
||||
QtWayland::qt_surface_extension *windowExtension() const { return mWindowExtension.data(); }
|
||||
QWaylandTouchExtension *touchExtension() const { return mTouchExtension.data(); }
|
||||
QtWayland::zwp_text_input_manager_v2 *textInputManager() const { return mTextInputManager.data(); }
|
||||
@ -202,7 +202,9 @@ private:
|
||||
QList<QWaylandInputDevice *> mInputDevices;
|
||||
QList<Listener> mRegistryListeners;
|
||||
QWaylandIntegration *mWaylandIntegration;
|
||||
#ifndef QT_NO_DRAGANDDROP
|
||||
QScopedPointer<QWaylandDataDeviceManager> mDndSelectionHandler;
|
||||
#endif
|
||||
QScopedPointer<QtWayland::qt_surface_extension> mWindowExtension;
|
||||
QScopedPointer<QtWayland::wl_subcompositor> mSubCompositor;
|
||||
QScopedPointer<QWaylandTouchExtension> mTouchExtension;
|
||||
|
@ -50,7 +50,7 @@
|
||||
#include <QDebug>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
#ifndef QT_NO_DRAGANDDROP
|
||||
namespace QtWaylandClient {
|
||||
|
||||
QWaylandDrag::QWaylandDrag(QWaylandDisplay *display)
|
||||
@ -98,7 +98,7 @@ void QWaylandDrag::drop(const QPoint &globalPos)
|
||||
|
||||
void QWaylandDrag::endDrag()
|
||||
{
|
||||
// Do nothing
|
||||
m_display->currentInputDevice()->handleEndDrag();
|
||||
}
|
||||
|
||||
void QWaylandDrag::updateTarget(const QString &mimeType)
|
||||
@ -131,5 +131,5 @@ void QWaylandDrag::finishDrag(const QPlatformDropQtResponse &response)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#endif // QT_NO_DRAGANDDROP
|
||||
QT_END_NAMESPACE
|
||||
|
@ -64,7 +64,7 @@ QT_BEGIN_NAMESPACE
|
||||
namespace QtWaylandClient {
|
||||
|
||||
class QWaylandDisplay;
|
||||
|
||||
#ifndef QT_NO_DRAGANDDROP
|
||||
class Q_WAYLAND_CLIENT_EXPORT QWaylandDrag : public QBasicDrag
|
||||
{
|
||||
public:
|
||||
@ -88,7 +88,7 @@ protected:
|
||||
private:
|
||||
QWaylandDisplay *m_display;
|
||||
};
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
@ -188,9 +188,11 @@ QWaylandInputDevice::QWaylandInputDevice(QWaylandDisplay *display, int version,
|
||||
, mSerial(0)
|
||||
, mTouchDevice(0)
|
||||
{
|
||||
#ifndef QT_NO_DRAGANDDROP
|
||||
if (mQDisplay->dndSelectionHandler()) {
|
||||
mDataDevice = mQDisplay->dndSelectionHandler()->getDataDevice(this);
|
||||
}
|
||||
#endif
|
||||
|
||||
if (mQDisplay->textInputManager()) {
|
||||
mTextInput = new QWaylandTextInput(mQDisplay, mQDisplay->textInputManager()->get_text_input(wl_seat()));
|
||||
@ -268,6 +270,14 @@ void QWaylandInputDevice::handleWindowDestroyed(QWaylandWindow *window)
|
||||
mTouch->mFocus = 0;
|
||||
}
|
||||
|
||||
void QWaylandInputDevice::handleEndDrag()
|
||||
{
|
||||
if (mTouch)
|
||||
mTouch->releasePoints();
|
||||
if (mPointer)
|
||||
mPointer->releaseButtons();
|
||||
}
|
||||
|
||||
void QWaylandInputDevice::setDataDevice(QWaylandDataDevice *device)
|
||||
{
|
||||
mDataDevice = device;
|
||||
@ -532,6 +542,14 @@ void QWaylandInputDevice::Pointer::pointer_button(uint32_t serial, uint32_t time
|
||||
}
|
||||
}
|
||||
|
||||
void QWaylandInputDevice::Pointer::releaseButtons()
|
||||
{
|
||||
mButtons = Qt::NoButton;
|
||||
MotionEvent e(mParent->mTime, mSurfacePos, mGlobalPos, mButtons, mParent->modifiers());
|
||||
if (mFocus)
|
||||
mFocus->handleMouse(mParent, e);
|
||||
}
|
||||
|
||||
class WheelEvent : public QWaylandPointerEvent
|
||||
{
|
||||
public:
|
||||
@ -845,6 +863,16 @@ bool QWaylandInputDevice::Touch::allTouchPointsReleased()
|
||||
return true;
|
||||
}
|
||||
|
||||
void QWaylandInputDevice::Touch::releasePoints()
|
||||
{
|
||||
Q_FOREACH (const QWindowSystemInterface::TouchPoint &previousPoint, mPrevTouchPoints) {
|
||||
QWindowSystemInterface::TouchPoint tp = previousPoint;
|
||||
tp.state = Qt::TouchPointReleased;
|
||||
mTouchPoints.append(tp);
|
||||
}
|
||||
touch_frame();
|
||||
}
|
||||
|
||||
void QWaylandInputDevice::Touch::touch_frame()
|
||||
{
|
||||
// Copy all points, that are in the previous but not in the current list, as stationary.
|
||||
|
@ -105,6 +105,7 @@ public:
|
||||
void setCursor(struct wl_buffer *buffer, const QPoint &hotSpot, const QSize &size);
|
||||
void setCursor(const QSharedPointer<QWaylandBuffer> &buffer, const QPoint &hotSpot);
|
||||
void handleWindowDestroyed(QWaylandWindow *window);
|
||||
void handleEndDrag();
|
||||
|
||||
void setDataDevice(QWaylandDataDevice *device);
|
||||
QWaylandDataDevice *dataDevice() const;
|
||||
@ -239,6 +240,8 @@ public:
|
||||
uint32_t axis,
|
||||
wl_fixed_t value) Q_DECL_OVERRIDE;
|
||||
|
||||
void releaseButtons();
|
||||
|
||||
QWaylandInputDevice *mParent;
|
||||
QWaylandWindow *mFocus;
|
||||
uint32_t mEnterSerial;
|
||||
@ -271,6 +274,7 @@ public:
|
||||
void touch_cancel() Q_DECL_OVERRIDE;
|
||||
|
||||
bool allTouchPointsReleased();
|
||||
void releasePoints();
|
||||
|
||||
QWaylandInputDevice *mParent;
|
||||
QWaylandWindow *mFocus;
|
||||
|
@ -131,9 +131,10 @@ QWaylandIntegration::QWaylandIntegration()
|
||||
{
|
||||
initializeInputDeviceIntegration();
|
||||
mDisplay.reset(new QWaylandDisplay(this));
|
||||
#ifndef QT_NO_DRAGANDDROP
|
||||
mClipboard.reset(new QWaylandClipboard(mDisplay.data()));
|
||||
mDrag.reset(new QWaylandDrag(mDisplay.data()));
|
||||
|
||||
#endif
|
||||
QString icStr = QPlatformInputContextFactory::requested();
|
||||
if (!icStr.isNull()) {
|
||||
mInputContext.reset(QPlatformInputContextFactory::create(icStr));
|
||||
@ -222,6 +223,7 @@ QPlatformFontDatabase *QWaylandIntegration::fontDatabase() const
|
||||
return mFontDb.data();
|
||||
}
|
||||
|
||||
#ifndef QT_NO_DRAGANDDROP
|
||||
QPlatformClipboard *QWaylandIntegration::clipboard() const
|
||||
{
|
||||
return mClipboard.data();
|
||||
@ -231,6 +233,7 @@ QPlatformDrag *QWaylandIntegration::drag() const
|
||||
{
|
||||
return mDrag.data();
|
||||
}
|
||||
#endif // QT_NO_DRAGANDDROP
|
||||
|
||||
QPlatformInputContext *QWaylandIntegration::inputContext() const
|
||||
{
|
||||
|
@ -87,11 +87,10 @@ public:
|
||||
QPlatformFontDatabase *fontDatabase() const Q_DECL_OVERRIDE;
|
||||
|
||||
QPlatformNativeInterface *nativeInterface() const Q_DECL_OVERRIDE;
|
||||
|
||||
#ifndef QT_NO_DRAGANDDROP
|
||||
QPlatformClipboard *clipboard() const Q_DECL_OVERRIDE;
|
||||
|
||||
QPlatformDrag *drag() const Q_DECL_OVERRIDE;
|
||||
|
||||
#endif
|
||||
QPlatformInputContext *inputContext() const Q_DECL_OVERRIDE;
|
||||
|
||||
QVariant styleHint(StyleHint hint) const Q_DECL_OVERRIDE;
|
||||
@ -128,8 +127,10 @@ private:
|
||||
QWaylandShellIntegration *createShellIntegration(const QString& interfaceName);
|
||||
|
||||
QScopedPointer<QPlatformFontDatabase> mFontDb;
|
||||
#ifndef QT_NO_DRAGANDDROP
|
||||
QScopedPointer<QPlatformClipboard> mClipboard;
|
||||
QScopedPointer<QPlatformDrag> mDrag;
|
||||
#endif
|
||||
QScopedPointer<QWaylandDisplay> mDisplay;
|
||||
QScopedPointer<QPlatformNativeInterface> mNativeInterface;
|
||||
QScopedPointer<QPlatformInputContext> mInputContext;
|
||||
|
@ -116,6 +116,7 @@ void *QWaylandNativeInterface::nativeResourceForScreen(const QByteArray &resourc
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
#ifndef QT_NO_OPENGL
|
||||
void *QWaylandNativeInterface::nativeResourceForContext(const QByteArray &resource, QOpenGLContext *context)
|
||||
{
|
||||
#ifdef QT_WAYLAND_GL_SUPPORT
|
||||
@ -133,6 +134,7 @@ void *QWaylandNativeInterface::nativeResourceForContext(const QByteArray &resour
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
#endif // QT_NO_OPENGL
|
||||
|
||||
QVariantMap QWaylandNativeInterface::windowProperties(QPlatformWindow *window) const
|
||||
{
|
||||
|
@ -72,8 +72,9 @@ public:
|
||||
QWindow *window) Q_DECL_OVERRIDE;
|
||||
void *nativeResourceForScreen(const QByteArray &resourceString,
|
||||
QScreen *screen) Q_DECL_OVERRIDE;
|
||||
#ifndef QT_NO_OPENGL
|
||||
void *nativeResourceForContext(const QByteArray &resource, QOpenGLContext *context) Q_DECL_OVERRIDE;
|
||||
|
||||
#endif
|
||||
QVariantMap windowProperties(QPlatformWindow *window) const Q_DECL_OVERRIDE;
|
||||
QVariant windowProperty(QPlatformWindow *window, const QString &name) const Q_DECL_OVERRIDE;
|
||||
QVariant windowProperty(QPlatformWindow *window, const QString &name, const QVariant &defaultValue) const Q_DECL_OVERRIDE;
|
||||
|
@ -139,7 +139,7 @@ void QWaylandWindow::initWindow()
|
||||
|
||||
if (mShellSurface) {
|
||||
// Set initial surface title
|
||||
mShellSurface->setTitle(window()->title());
|
||||
setWindowTitle(window()->title());
|
||||
|
||||
// The appId is the desktop entry identifier that should follow the
|
||||
// reverse DNS convention (see http://standards.freedesktop.org/desktop-entry-spec/latest/ar01s02.html).
|
||||
@ -261,7 +261,8 @@ void QWaylandWindow::setParent(const QPlatformWindow *parent)
|
||||
void QWaylandWindow::setWindowTitle(const QString &title)
|
||||
{
|
||||
if (mShellSurface) {
|
||||
mShellSurface->setTitle(title);
|
||||
const QString separator = QString::fromUtf8(" \xe2\x80\x94 "); // unicode character U+2014, EM DASH
|
||||
mShellSurface->setTitle(formatWindowTitle(title, separator));
|
||||
}
|
||||
|
||||
if (mWindowDecoration && window()->isVisible())
|
||||
@ -285,6 +286,7 @@ void QWaylandWindow::setGeometry_helper(const QRect &rect)
|
||||
if (mSubSurfaceWindow) {
|
||||
QMargins m = QPlatformWindow::parent()->frameMargins();
|
||||
mSubSurfaceWindow->set_position(rect.x() + m.left(), rect.y() + m.top());
|
||||
mSubSurfaceWindow->parent()->window()->requestUpdate();
|
||||
} else if (shellSurface() && window()->transientParent() && window()->type() != Qt::Popup)
|
||||
shellSurface()->updateTransientParent(window()->transientParent());
|
||||
}
|
||||
@ -809,10 +811,12 @@ void QWaylandWindow::requestActivateWindow()
|
||||
|
||||
void QWaylandWindow::unfocus()
|
||||
{
|
||||
#ifndef QT_NO_DRAGANDDROP
|
||||
QWaylandInputDevice *inputDevice = mDisplay->currentInputDevice();
|
||||
if (inputDevice && inputDevice->dataDevice()) {
|
||||
inputDevice->dataDevice()->invalidateSelectionOffer();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
bool QWaylandWindow::isExposed() const
|
||||
|
@ -138,7 +138,9 @@ void QWaylandXdgSurface::updateTransientParent(QWindow *parent)
|
||||
QWaylandWindow *parent_wayland_window = static_cast<QWaylandWindow *>(parent->handle());
|
||||
if (!parent_wayland_window)
|
||||
return;
|
||||
set_parent(m_shell->get_xdg_surface(parent_wayland_window->object()));
|
||||
auto parentXdgSurface = qobject_cast<QWaylandXdgSurface *>(parent_wayland_window->shellSurface());
|
||||
Q_ASSERT(parentXdgSurface);
|
||||
set_parent(parentXdgSurface->object());
|
||||
}
|
||||
|
||||
void QWaylandXdgSurface::setTitle(const QString & title)
|
||||
|
Loading…
x
Reference in New Issue
Block a user