diff options
author | Liang Qi <liang.qi@qt.io> | 2017-04-21 11:10:27 +0200 |
---|---|---|
committer | Liang Qi <liang.qi@qt.io> | 2017-04-21 11:10:27 +0200 |
commit | bf2dec1e32fbd92ba431bf88dc989f209a15aa01 (patch) | |
tree | 724b6e0f6cd5e6718a80a7135304f191f76726f8 /src | |
parent | f4a29f068e77e8d1a5a08046e47904ff0b6f2d2e (diff) | |
parent | a5dd3692697fcf905749b5686d5d7bfbf47969e1 (diff) |
Merge remote-tracking branch 'origin/5.9' into dev
Change-Id: I7285dfeaac0d7963607930904aa017bedb1e48ab
Diffstat (limited to 'src')
78 files changed, 415 insertions, 173 deletions
diff --git a/src/3rdparty/protocol/qt_attribution.json b/src/3rdparty/protocol/qt_attribution.json index 76fd33d37..f35dec4f3 100644 --- a/src/3rdparty/protocol/qt_attribution.json +++ b/src/3rdparty/protocol/qt_attribution.json @@ -26,9 +26,9 @@ "Files": "ivi-controller.xml ivi-application.xml", "Description": "\"Wayland IVI Extension\" is forked from IVI Layer Management to define a common set of APIs by wayland style protocol and provide reference implementation which can be loaded on Weston.", - "Homepage": "http://projects.genivi.org/wayland-ivi-extension", + "Homepage": "https://at.projects.genivi.org/wiki/display/WIE/Wayland+IVI+Extension+Home", "Version": "1.9.1", - "DownloadLocation": "http://git.projects.genivi.org/?p=wayland-ivi-extension.git;a=commit;h=44598504503eea5ac7f94c88477a5a78bda01f30", + "DownloadLocation": "https://github.com/GENIVI/wayland-ivi-extension/releases/tag/1.9.1", "LicenseId": "MIT", "License": "MIT License", "LicenseFile": "MIT_LICENSE.txt", diff --git a/src/client/client.pro b/src/client/client.pro index 824c715b0..eae7ad52e 100644 --- a/src/client/client.pro +++ b/src/client/client.pro @@ -23,7 +23,6 @@ QMAKE_USE += wayland-client INCLUDEPATH += $$PWD/../shared WAYLANDCLIENTSOURCES += \ - ../3rdparty/protocol/wayland.xml \ ../extensions/surface-extension.xml \ ../extensions/touch-extension.xml \ ../extensions/qtkey-extension.xml \ @@ -32,6 +31,9 @@ WAYLANDCLIENTSOURCES += \ ../3rdparty/protocol/xdg-shell.xml \ ../3rdparty/protocol/xdg-shell-unstable-v6.xml \ +WAYLANDCLIENTSOURCES_SYSTEM += \ + ../3rdparty/protocol/wayland.xml \ + SOURCES += qwaylandintegration.cpp \ qwaylandnativeinterface.cpp \ qwaylandshmbackingstore.cpp \ @@ -40,9 +42,6 @@ SOURCES += qwaylandintegration.cpp \ qwaylandwindow.cpp \ qwaylandscreen.cpp \ qwaylandshmwindow.cpp \ - qwaylanddataoffer.cpp \ - qwaylanddatadevicemanager.cpp \ - qwaylanddatasource.cpp \ qwaylandshellsurface.cpp \ qwaylandwlshellsurface.cpp \ qwaylandwlshellintegration.cpp \ @@ -76,9 +75,6 @@ HEADERS += qwaylandintegration_p.h \ qwaylandinputdevice_p.h \ qwaylandbuffer_p.h \ qwaylandshmwindow_p.h \ - qwaylanddataoffer_p.h \ - qwaylanddatadevicemanager_p.h \ - qwaylanddatasource_p.h \ qwaylandshellsurface_p.h \ qwaylandwlshellsurface_p.h \ qwaylandwlshellintegration_p.h \ @@ -123,13 +119,25 @@ qtConfig(cursor) { SOURCES += \ qwaylandcursor.cpp } + +qtConfig(wayland-datadevice) { + HEADERS += \ + qwaylanddatadevice_p.h \ + qwaylanddatadevicemanager_p.h \ + qwaylanddataoffer_p.h \ + qwaylanddatasource_p.h + SOURCES += \ + qwaylanddatadevice.cpp \ + qwaylanddatadevicemanager.cpp \ + qwaylanddataoffer.cpp \ + qwaylanddatasource.cpp +} + qtConfig(draganddrop) { HEADERS += \ - qwaylanddnd_p.h \ - qwaylanddatadevice_p.h + qwaylanddnd_p.h SOURCES += \ - qwaylanddnd.cpp \ - qwaylanddatadevice.cpp + qwaylanddnd.cpp } CONFIG += generated_privates diff --git a/src/client/configure.json b/src/client/configure.json index b2a8fbc0b..c29a8b609 100644 --- a/src/client/configure.json +++ b/src/client/configure.json @@ -76,13 +76,17 @@ "condition": "!config.win32 && libs.wayland-client && libs.wayland-cursor && tests.wayland-scanner", "output": [ "privateFeature" ] }, + "wayland-datadevice": { + "condition": "features.draganddrop || features.clipboard", + "output": [ "privateFeature" ] + }, "wayland-egl": { "label": "EGL", "condition": "features.wayland-client && features.opengl && features.egl && libs.wayland-egl", "output": [ "privateFeature" ] }, "wayland-brcm": { - "label": "Rasberry Pi", + "label": "Raspberry Pi", "condition": "features.wayland-client && features.eglfs_brcm", "output": [ "privateFeature" ] }, diff --git a/src/client/qwaylandclipboard.cpp b/src/client/qwaylandclipboard.cpp index 68fb737cc..5da120268 100644 --- a/src/client/qwaylandclipboard.cpp +++ b/src/client/qwaylandclipboard.cpp @@ -44,8 +44,6 @@ #include "qwaylanddatasource_p.h" #include "qwaylanddatadevice_p.h" -#if QT_CONFIG(draganddrop) - QT_BEGIN_NAMESPACE namespace QtWaylandClient { @@ -117,5 +115,3 @@ bool QWaylandClipboard::ownsMode(QClipboard::Mode mode) const } QT_END_NAMESPACE - -#endif // draganddrop diff --git a/src/client/qwaylandclipboard_p.h b/src/client/qwaylandclipboard_p.h index 211a96942..283362022 100644 --- a/src/client/qwaylandclipboard_p.h +++ b/src/client/qwaylandclipboard_p.h @@ -57,7 +57,8 @@ #include <QtWaylandClient/qtwaylandclientglobal.h> -#if QT_CONFIG(draganddrop) +QT_REQUIRE_CONFIG(clipboard); + QT_BEGIN_NAMESPACE namespace QtWaylandClient { @@ -85,6 +86,4 @@ private: QT_END_NAMESPACE -#endif // draganddrop - #endif // QWAYLANDCLIPBOARD_H diff --git a/src/client/qwaylandcursor.cpp b/src/client/qwaylandcursor.cpp index e3e3469be..7caa247e5 100644 --- a/src/client/qwaylandcursor.cpp +++ b/src/client/qwaylandcursor.cpp @@ -143,31 +143,6 @@ void QWaylandCursor::changeCursor(QCursor *cursor, QWindow *window) mDisplay->setCursor(buffer, image); } -void QWaylandDisplay::setCursor(struct wl_buffer *buffer, struct wl_cursor_image *image) -{ - /* Qt doesn't tell us which input device we should set the cursor - * for, so set it for all devices. */ - for (int i = 0; i < mInputDevices.count(); i++) { - QWaylandInputDevice *inputDevice = mInputDevices.at(i); - inputDevice->setCursor(buffer, image); - } -} - -void QWaylandDisplay::setCursor(const QSharedPointer<QWaylandBuffer> &buffer, const QPoint &hotSpot) -{ - /* Qt doesn't tell us which input device we should set the cursor - * for, so set it for all devices. */ - for (int i = 0; i < mInputDevices.count(); i++) { - QWaylandInputDevice *inputDevice = mInputDevices.at(i); - inputDevice->setCursor(buffer, hotSpot); - } -} - -QWaylandInputDevice *QWaylandDisplay::defaultInputDevice() const -{ - return mInputDevices.isEmpty() ? 0 : mInputDevices.first(); -} - void QWaylandCursor::pointerEvent(const QMouseEvent &event) { mLastPos = event.globalPos(); diff --git a/src/client/qwaylanddatadevice.cpp b/src/client/qwaylanddatadevice.cpp index ebd3ce1bf..33068c5e9 100644 --- a/src/client/qwaylanddatadevice.cpp +++ b/src/client/qwaylanddatadevice.cpp @@ -58,8 +58,6 @@ #include <qpa/qplatformdrag.h> #include <qpa/qwindowsysteminterface.h> -#if QT_CONFIG(draganddrop) - QT_BEGIN_NAMESPACE namespace QtWaylandClient { @@ -103,6 +101,7 @@ void QWaylandDataDevice::setSelectionSource(QWaylandDataSource *source) m_selectionSource.reset(source); } +#if QT_CONFIG(draganddrop) QWaylandDataOffer *QWaylandDataDevice::dragOffer() const { return m_dragOffer.data(); @@ -124,12 +123,14 @@ void QWaylandDataDevice::cancelDrag() { m_dragSource.reset(); } +#endif void QWaylandDataDevice::data_device_data_offer(struct ::wl_data_offer *id) { new QWaylandDataOffer(m_display, id); } +#if QT_CONFIG(draganddrop) void QWaylandDataDevice::data_device_drop() { QDrag *drag = static_cast<QWaylandDrag *>(QGuiApplicationPrivate::platformIntegration()->drag())->currentDrag(); @@ -229,6 +230,7 @@ void QWaylandDataDevice::data_device_motion(uint32_t time, wl_fixed_t x, wl_fixe wl_data_offer_accept(m_dragOffer->object(), m_enterSerial, 0); } } +#endif // QT_CONFIG(draganddrop) void QWaylandDataDevice::data_device_selection(wl_data_offer *id) { @@ -250,6 +252,7 @@ void QWaylandDataDevice::selectionSourceCancelled() #endif } +#if QT_CONFIG(draganddrop) void QWaylandDataDevice::dragSourceCancelled() { m_dragSource.reset(); @@ -272,9 +275,8 @@ QPoint QWaylandDataDevice::calculateDragPosition(int x, int y, QWindow *wnd) con } return pnt; } +#endif // QT_CONFIG(draganddrop) } QT_END_NAMESPACE - -#endif // draganddrop diff --git a/src/client/qwaylanddatadevice_p.h b/src/client/qwaylanddatadevice_p.h index 1ec8761b9..7fb0003b4 100644 --- a/src/client/qwaylanddatadevice_p.h +++ b/src/client/qwaylanddatadevice_p.h @@ -52,14 +52,14 @@ // We mean it. // -#include <qtwaylandclientglobal.h> +#include <qtwaylandclientglobal_p.h> #include <QObject> #include <QPointer> #include <QPoint> #include <QtWaylandClient/private/qwayland-wayland.h> -#if QT_CONFIG(draganddrop) +QT_REQUIRE_CONFIG(wayland_datadevice); QT_BEGIN_NAMESPACE @@ -87,25 +87,35 @@ public: QWaylandDataSource *selectionSource() const; void setSelectionSource(QWaylandDataSource *source); +#if QT_CONFIG(draganddrop) QWaylandDataOffer *dragOffer() const; void startDrag(QMimeData *mimeData, QWaylandWindow *icon); void cancelDrag(); +#endif protected: void data_device_data_offer(struct ::wl_data_offer *id) override; + +#if QT_CONFIG(draganddrop) void data_device_drop() override; void data_device_enter(uint32_t serial, struct ::wl_surface *surface, wl_fixed_t x, wl_fixed_t y, struct ::wl_data_offer *id) override; void data_device_leave() override; void data_device_motion(uint32_t time, wl_fixed_t x, wl_fixed_t y) override; +#endif void data_device_selection(struct ::wl_data_offer *id) override; private Q_SLOTS: void selectionSourceCancelled(); + +#if QT_CONFIG(draganddrop) void dragSourceCancelled(); void dragSourceTargetChanged(const QString &mimeType); +#endif private: +#if QT_CONFIG(draganddrop) QPoint calculateDragPosition(int x, int y, QWindow *wnd) const; +#endif QWaylandDisplay *m_display; QWaylandInputDevice *m_inputDevice; @@ -123,6 +133,4 @@ private: QT_END_NAMESPACE -#endif // draganddrop - #endif // QWAYLANDDATADEVICE_H diff --git a/src/client/qwaylanddatadevicemanager.cpp b/src/client/qwaylanddatadevicemanager.cpp index c398b86fd..35d67307f 100644 --- a/src/client/qwaylanddatadevicemanager.cpp +++ b/src/client/qwaylanddatadevicemanager.cpp @@ -46,8 +46,6 @@ #include <QtCore/QDebug> -#if QT_CONFIG(draganddrop) - QT_BEGIN_NAMESPACE namespace QtWaylandClient { @@ -82,5 +80,3 @@ QWaylandDisplay *QWaylandDataDeviceManager::display() const } QT_END_NAMESPACE - -#endif // draganddrop diff --git a/src/client/qwaylanddatadevicemanager_p.h b/src/client/qwaylanddatadevicemanager_p.h index e7fc2113a..3daf780aa 100644 --- a/src/client/qwaylanddatadevicemanager_p.h +++ b/src/client/qwaylanddatadevicemanager_p.h @@ -51,10 +51,10 @@ // We mean it. // -#include <QtWaylandClient/qtwaylandclientglobal.h> +#include <QtWaylandClient/private/qtwaylandclientglobal_p.h> #include <QtWaylandClient/private/qwayland-wayland.h> -#if QT_CONFIG(draganddrop) +QT_REQUIRE_CONFIG(wayland_datadevice); QT_BEGIN_NAMESPACE @@ -83,6 +83,4 @@ private: QT_END_NAMESPACE -#endif // draganddrop - #endif // QWAYLANDDATADEVICEMANAGER_H diff --git a/src/client/qwaylanddataoffer.cpp b/src/client/qwaylanddataoffer.cpp index 56a18f007..2491c658b 100644 --- a/src/client/qwaylanddataoffer.cpp +++ b/src/client/qwaylanddataoffer.cpp @@ -47,8 +47,6 @@ #include <QtCore/QDebug> -#if QT_CONFIG(draganddrop) - QT_BEGIN_NAMESPACE namespace QtWaylandClient { @@ -183,5 +181,3 @@ int QWaylandMimeData::readData(int fd, QByteArray &data) const } QT_END_NAMESPACE - -#endif // draganddrop diff --git a/src/client/qwaylanddataoffer_p.h b/src/client/qwaylanddataoffer_p.h index c7520f3e5..c9b9c21f1 100644 --- a/src/client/qwaylanddataoffer_p.h +++ b/src/client/qwaylanddataoffer_p.h @@ -53,10 +53,11 @@ #include <QtGui/private/qdnd_p.h> -#include <QtWaylandClient/qtwaylandclientglobal.h> +#include <QtWaylandClient/private/qtwaylandclientglobal_p.h> #include <QtWaylandClient/private/qwayland-wayland.h> -#if QT_CONFIG(draganddrop) +QT_REQUIRE_CONFIG(wayland_datadevice); + QT_BEGIN_NAMESPACE namespace QtWaylandClient { @@ -106,5 +107,4 @@ private: } QT_END_NAMESPACE -#endif // draganddrop #endif diff --git a/src/client/qwaylanddatasource.cpp b/src/client/qwaylanddatasource.cpp index c61de181b..0c6ad50e4 100644 --- a/src/client/qwaylanddatasource.cpp +++ b/src/client/qwaylanddatasource.cpp @@ -50,8 +50,6 @@ #include <unistd.h> #include <signal.h> -#if QT_CONFIG(draganddrop) - QT_BEGIN_NAMESPACE namespace QtWaylandClient { @@ -108,5 +106,3 @@ void QWaylandDataSource::data_source_target(const QString &mime_type) } QT_END_NAMESPACE - -#endif // draganddrop diff --git a/src/client/qwaylanddatasource_p.h b/src/client/qwaylanddatasource_p.h index 0221304c8..bba003f56 100644 --- a/src/client/qwaylanddatasource_p.h +++ b/src/client/qwaylanddatasource_p.h @@ -54,9 +54,9 @@ #include <QObject> #include <QtWaylandClient/private/qwayland-wayland.h> -#include <QtWaylandClient/qtwaylandclientglobal.h> +#include <QtWaylandClient/private/qtwaylandclientglobal_p.h> -#if QT_CONFIG(draganddrop) +QT_REQUIRE_CONFIG(wayland_datadevice); QT_BEGIN_NAMESPACE @@ -94,6 +94,4 @@ private: QT_END_NAMESPACE -#endif // draganddrop - #endif // QWAYLANDDATASOURCE_H diff --git a/src/client/qwaylanddisplay.cpp b/src/client/qwaylanddisplay.cpp index 851d715b7..86cfe1a0d 100644 --- a/src/client/qwaylanddisplay.cpp +++ b/src/client/qwaylanddisplay.cpp @@ -47,7 +47,9 @@ #if QT_CONFIG(clipboard) #include "qwaylandclipboard_p.h" #endif +#if QT_CONFIG(wayland_datadevice) #include "qwaylanddatadevicemanager_p.h" +#endif #include "qwaylandhardwareintegration_p.h" #include "qwaylandxdgshell_p.h" #include "qwaylandxdgsurface_p.h" @@ -122,7 +124,7 @@ QWaylandWindowManagerIntegration *QWaylandDisplay::windowManagerIntegration() co QWaylandDisplay::QWaylandDisplay(QWaylandIntegration *waylandIntegration) : mWaylandIntegration(waylandIntegration) -#if QT_CONFIG(draganddrop) +#if QT_CONFIG(wayland_datadevice) , mDndSelectionHandler(0) #endif , mWindowExtension(0) @@ -162,7 +164,7 @@ QWaylandDisplay::~QWaylandDisplay(void) mWaylandIntegration->destroyScreen(screen); } mScreens.clear(); -#if QT_CONFIG(draganddrop) +#if QT_CONFIG(wayland_datadevice) delete mDndSelectionHandler.take(); #endif wl_display_disconnect(mDisplay); @@ -257,7 +259,7 @@ 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); -#if QT_CONFIG(draganddrop) +#if QT_CONFIG(wayland_datadevice) } else if (interface == QStringLiteral("wl_data_device_manager")) { mDndSelectionHandler.reset(new QWaylandDataDeviceManager(this, id)); #endif @@ -421,7 +423,14 @@ void QWaylandDisplay::handleKeyboardFocusChanged(QWaylandInputDevice *inputDevic if (mLastKeyboardFocus == keyboardFocus) return; - mWaylandIntegration->mShellIntegration->handleKeyboardFocusChanged(keyboardFocus, mLastKeyboardFocus); + if (mWaylandIntegration->mShellIntegration) { + mWaylandIntegration->mShellIntegration->handleKeyboardFocusChanged(keyboardFocus, mLastKeyboardFocus); + } else { + if (keyboardFocus) + handleWindowActivated(keyboardFocus); + if (mLastKeyboardFocus) + handleWindowDeactivated(mLastKeyboardFocus); + } mLastKeyboardFocus = keyboardFocus; } @@ -461,6 +470,33 @@ void QWaylandDisplay::requestWaylandSync() wl_callback_add_listener(mSyncCallback, &syncCallbackListener, this); } +QWaylandInputDevice *QWaylandDisplay::defaultInputDevice() const +{ + return mInputDevices.isEmpty() ? 0 : mInputDevices.first(); +} + +#if QT_CONFIG(cursor) +void QWaylandDisplay::setCursor(struct wl_buffer *buffer, struct wl_cursor_image *image) +{ + /* Qt doesn't tell us which input device we should set the cursor + * for, so set it for all devices. */ + for (int i = 0; i < mInputDevices.count(); i++) { + QWaylandInputDevice *inputDevice = mInputDevices.at(i); + inputDevice->setCursor(buffer, image); + } +} + +void QWaylandDisplay::setCursor(const QSharedPointer<QWaylandBuffer> &buffer, const QPoint &hotSpot) +{ + /* Qt doesn't tell us which input device we should set the cursor + * for, so set it for all devices. */ + for (int i = 0; i < mInputDevices.count(); i++) { + QWaylandInputDevice *inputDevice = mInputDevices.at(i); + inputDevice->setCursor(buffer, hotSpot); + } +} +#endif // QT_CONFIG(cursor) + } QT_END_NAMESPACE diff --git a/src/client/qwaylanddisplay_p.h b/src/client/qwaylanddisplay_p.h index e96a89176..35d861760 100644 --- a/src/client/qwaylanddisplay_p.h +++ b/src/client/qwaylanddisplay_p.h @@ -61,7 +61,7 @@ #include <wayland-client.h> #include <QtWaylandClient/private/qwayland-wayland.h> -#include <QtWaylandClient/qtwaylandclientglobal.h> +#include <QtWaylandClient/private/qtwaylandclientglobal_p.h> #include <QtWaylandClient/private/qwayland-xdg-shell.h> #include <QtWaylandClient/private/qwaylandshm_p.h> @@ -123,10 +123,10 @@ public: QWaylandClientBufferIntegration *clientBufferIntegration() const; QWaylandWindowManagerIntegration *windowManagerIntegration() const; - +#if QT_CONFIG(cursor) void setCursor(struct wl_buffer *buffer, struct wl_cursor_image *image); void setCursor(const QSharedPointer<QWaylandBuffer> &buffer, const QPoint &hotSpot); - +#endif struct wl_display *wl_display() const { return mDisplay; } struct ::wl_registry *wl_registry() { return object(); } @@ -137,7 +137,7 @@ public: QList<QWaylandInputDevice *> inputDevices() const { return mInputDevices; } QWaylandInputDevice *defaultInputDevice() const; QWaylandInputDevice *currentInputDevice() const { return defaultInputDevice(); } -#if QT_CONFIG(draganddrop) +#if QT_CONFIG(wayland_datadevice) QWaylandDataDeviceManager *dndSelectionHandler() const { return mDndSelectionHandler.data(); } #endif QtWayland::qt_surface_extension *windowExtension() const { return mWindowExtension.data(); } @@ -202,7 +202,7 @@ private: QList<QWaylandInputDevice *> mInputDevices; QList<Listener> mRegistryListeners; QWaylandIntegration *mWaylandIntegration; -#if QT_CONFIG(draganddrop) +#if QT_CONFIG(wayland_datadevice) QScopedPointer<QWaylandDataDeviceManager> mDndSelectionHandler; #endif QScopedPointer<QtWayland::qt_surface_extension> mWindowExtension; diff --git a/src/client/qwaylandinputdevice.cpp b/src/client/qwaylandinputdevice.cpp index fb22c95e6..b0c6394e2 100644 --- a/src/client/qwaylandinputdevice.cpp +++ b/src/client/qwaylandinputdevice.cpp @@ -42,8 +42,10 @@ #include "qwaylandintegration_p.h" #include "qwaylandwindow_p.h" #include "qwaylandbuffer_p.h" +#if QT_CONFIG(wayland_datadevice) #include "qwaylanddatadevice_p.h" #include "qwaylanddatadevicemanager_p.h" +#endif #include "qwaylandtouch_p.h" #include "qwaylandscreen_p.h" #include "qwaylandcursor_p.h" @@ -187,7 +189,9 @@ QWaylandInputDevice::QWaylandInputDevice(QWaylandDisplay *display, int version, , mDisplay(display->wl_display()) , mVersion(qMin(version, 4)) , mCaps(0) +#if QT_CONFIG(wayland_datadevice) , mDataDevice(0) +#endif , mKeyboard(0) , mPointer(0) , mTouch(0) @@ -196,7 +200,7 @@ QWaylandInputDevice::QWaylandInputDevice(QWaylandDisplay *display, int version, , mSerial(0) , mTouchDevice(0) { -#if QT_CONFIG(draganddrop) +#if QT_CONFIG(wayland_datadevice) if (mQDisplay->dndSelectionHandler()) { mDataDevice = mQDisplay->dndSelectionHandler()->getDataDevice(this); } @@ -286,6 +290,7 @@ void QWaylandInputDevice::handleEndDrag() mPointer->releaseButtons(); } +#if QT_CONFIG(wayland_datadevice) void QWaylandInputDevice::setDataDevice(QWaylandDataDevice *device) { mDataDevice = device; @@ -296,6 +301,7 @@ QWaylandDataDevice *QWaylandInputDevice::dataDevice() const Q_ASSERT(mDataDevice); return mDataDevice; } +#endif void QWaylandInputDevice::setTextInput(QWaylandTextInput *textInput) { diff --git a/src/client/qwaylandinputdevice_p.h b/src/client/qwaylandinputdevice_p.h index d8bd0062f..4d0a47597 100644 --- a/src/client/qwaylandinputdevice_p.h +++ b/src/client/qwaylandinputdevice_p.h @@ -111,8 +111,10 @@ public: void handleWindowDestroyed(QWaylandWindow *window); void handleEndDrag(); +#if QT_CONFIG(wayland_datadevice) void setDataDevice(QWaylandDataDevice *device); QWaylandDataDevice *dataDevice() const; +#endif void setTextInput(QWaylandTextInput *textInput); QWaylandTextInput *textInput() const; @@ -143,7 +145,9 @@ private: struct wl_surface *pointerSurface; +#if QT_CONFIG(wayland_datadevice) QWaylandDataDevice *mDataDevice; +#endif Keyboard *mKeyboard; Pointer *mPointer; diff --git a/src/client/qwaylandshmbackingstore_p.h b/src/client/qwaylandshmbackingstore_p.h index 71f98e30c..8564cc9d2 100644 --- a/src/client/qwaylandshmbackingstore_p.h +++ b/src/client/qwaylandshmbackingstore_p.h @@ -90,7 +90,7 @@ public: QWaylandShmBackingStore(QWindow *window); ~QWaylandShmBackingStore(); - QPaintDevice *paintDevice(); + QPaintDevice *paintDevice() override; void flush(QWindow *window, const QRegion ®ion, const QPoint &offset) override; void resize(const QSize &size, const QRegion &staticContents) override; void resize(const QSize &size); diff --git a/src/client/qwaylandwindow.cpp b/src/client/qwaylandwindow.cpp index 540403bce..03cbb4c33 100644 --- a/src/client/qwaylandwindow.cpp +++ b/src/client/qwaylandwindow.cpp @@ -40,7 +40,6 @@ #include "qwaylandwindow_p.h" #include "qwaylandbuffer_p.h" -#include "qwaylanddatadevice_p.h" #include "qwaylanddisplay_p.h" #include "qwaylandinputdevice_p.h" #include "qwaylandscreen_p.h" @@ -54,6 +53,11 @@ #include "qwaylanddecorationfactory_p.h" #include "qwaylandshmbackingstore_p.h" +#if QT_CONFIG(wayland_datadevice) +#include "qwaylanddatadevice_p.h" +#endif + + #include <QtCore/QFileInfo> #include <QtCore/QPointer> #include <QtCore/QRegularExpression> @@ -95,6 +99,7 @@ QWaylandWindow::QWaylandWindow(QWindow *window) { static WId id = 1; mWindowId = id++; + initializeWlSurface(); } QWaylandWindow::~QWaylandWindow() @@ -127,7 +132,7 @@ void QWaylandWindow::initWindow() return; if (!isInitialized()) - init(mDisplay->createSurface(static_cast<QtWayland::wl_surface *>(this))); + initializeWlSurface(); if (shouldCreateSubSurface()) { Q_ASSERT(!mSubSurfaceWindow); @@ -159,7 +164,9 @@ void QWaylandWindow::initWindow() // when available. if (!QGuiApplication::desktopFileName().isEmpty()) { QString name = QGuiApplication::desktopFileName(); - mShellSurface->setAppId(name.replace(QRegularExpression(QLatin1String("\\.desktop$")), QString())); + if (name.endsWith(QLatin1String(".desktop"))) + name.chop(8); + mShellSurface->setAppId(name); } else { QFileInfo fi = QCoreApplication::instance()->applicationFilePath(); QStringList domainName = @@ -200,6 +207,11 @@ void QWaylandWindow::initWindow() mFlags = window()->flags(); } +void QWaylandWindow::initializeWlSurface() +{ + init(mDisplay->createSurface(static_cast<QtWayland::wl_surface *>(this))); +} + bool QWaylandWindow::shouldCreateShellSurface() const { if (shouldCreateSubSurface()) @@ -225,7 +237,8 @@ void QWaylandWindow::reset() mShellSurface = 0; delete mSubSurfaceWindow; mSubSurfaceWindow = 0; - destroy(); + if (isInitialized()) + destroy(); if (mFrameCallback) wl_callback_destroy(mFrameCallback); @@ -360,8 +373,11 @@ void QWaylandWindow::setMask(const QRegion &mask) mMask = mask; + if (!isInitialized()) + return; + if (mMask.isEmpty()) { - set_input_region(0); + set_input_region(nullptr); } else { struct ::wl_region *region = mDisplay->createRegion(mMask); set_input_region(region); @@ -813,7 +829,7 @@ void QWaylandWindow::requestActivateWindow() void QWaylandWindow::unfocus() { -#if QT_CONFIG(draganddrop) +#if QT_CONFIG(clipboard) QWaylandInputDevice *inputDevice = mDisplay->currentInputDevice(); if (inputDevice && inputDevice->dataDevice()) { inputDevice->dataDevice()->invalidateSelectionOffer(); diff --git a/src/client/qwaylandwindow_p.h b/src/client/qwaylandwindow_p.h index 7e8db74bc..dd6a368c2 100644 --- a/src/client/qwaylandwindow_p.h +++ b/src/client/qwaylandwindow_p.h @@ -248,6 +248,7 @@ private: bool setWindowStateInternal(Qt::WindowStates flags); void setGeometry_helper(const QRect &rect); void initWindow(); + void initializeWlSurface(); bool shouldCreateShellSurface() const; bool shouldCreateSubSurface() const; void reset(); diff --git a/src/client/qwaylandxdgshellv6.cpp b/src/client/qwaylandxdgshellv6.cpp index 687973240..b50b6b1cf 100644 --- a/src/client/qwaylandxdgshellv6.cpp +++ b/src/client/qwaylandxdgshellv6.cpp @@ -199,6 +199,7 @@ void QWaylandXdgSurfaceV6::setPopup(QWaylandWindow *parent, QWaylandInputDevice positioner->set_anchor_rect(transientPos.x(), transientPos.y(), 1, 1); positioner->set_anchor(QtWayland::zxdg_positioner_v6::anchor_top | QtWayland::zxdg_positioner_v6::anchor_left); positioner->set_gravity(QtWayland::zxdg_positioner_v6::gravity_bottom | QtWayland::zxdg_positioner_v6::gravity_right); + positioner->set_size(m_window->geometry().width(), m_window->geometry().height()); m_popup = new Popup(this, parentXdgSurface, positioner); positioner->destroy(); delete positioner; 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): \ diff --git a/src/hardwareintegration/client/brcm-egl/brcm-egl.pri b/src/hardwareintegration/client/brcm-egl/brcm-egl.pri index 64cb44677..f9f8d0726 100644 --- a/src/hardwareintegration/client/brcm-egl/brcm-egl.pri +++ b/src/hardwareintegration/client/brcm-egl/brcm-egl.pri @@ -1,6 +1,6 @@ INCLUDEPATH += $$PWD -QMAKE_USE += egl wayland-client +QMAKE_USE += egl wayland-client libdl QT += egl_support-private SOURCES += $$PWD/qwaylandbrcmeglintegration.cpp \ diff --git a/src/hardwareintegration/client/brcm-egl/qwaylandbrcmeglwindow.cpp b/src/hardwareintegration/client/brcm-egl/qwaylandbrcmeglwindow.cpp index 4d56d66e6..9842f61c9 100644 --- a/src/hardwareintegration/client/brcm-egl/qwaylandbrcmeglwindow.cpp +++ b/src/hardwareintegration/client/brcm-egl/qwaylandbrcmeglwindow.cpp @@ -252,9 +252,7 @@ void QWaylandBrcmEglWindow::swapBuffers() return; m_buffers[m_current]->bind(); - attach(m_buffers[m_current], 0, 0); - damage(QRect(QPoint(), geometry().size())); - commit(); + commit(m_buffers[m_current], QRegion(0, 0, geometry().size().width(), geometry().size().height())); m_current = (m_current + 1) % m_count; m_buffers[m_current]->waitForRelease(); diff --git a/src/hardwareintegration/client/brcm-egl/qwaylandbrcmglcontext.cpp b/src/hardwareintegration/client/brcm-egl/qwaylandbrcmglcontext.cpp index f5480b0ed..5c585746c 100644 --- a/src/hardwareintegration/client/brcm-egl/qwaylandbrcmglcontext.cpp +++ b/src/hardwareintegration/client/brcm-egl/qwaylandbrcmglcontext.cpp @@ -48,6 +48,8 @@ #include <qpa/qplatformopenglcontext.h> #include <QtGui/QSurfaceFormat> +#include <dlfcn.h> + QT_BEGIN_NAMESPACE namespace QtWaylandClient { @@ -92,9 +94,12 @@ void QWaylandBrcmGLContext::swapBuffers(QPlatformSurface *surface) static_cast<QWaylandBrcmEglWindow *>(surface)->swapBuffers(); } -void (*QWaylandBrcmGLContext::getProcAddress(const char *procName)) () +QFunctionPointer QWaylandBrcmGLContext::getProcAddress(const char *procName) { - return eglGetProcAddress(procName); + QFunctionPointer proc = (QFunctionPointer) eglGetProcAddress(procName); + if (!proc) + proc = (QFunctionPointer) dlsym(RTLD_DEFAULT, procName); + return proc; } EGLConfig QWaylandBrcmGLContext::eglConfig() const diff --git a/src/hardwareintegration/client/brcm-egl/qwaylandbrcmglcontext.h b/src/hardwareintegration/client/brcm-egl/qwaylandbrcmglcontext.h index ee8bc86fe..d27333576 100644 --- a/src/hardwareintegration/client/brcm-egl/qwaylandbrcmglcontext.h +++ b/src/hardwareintegration/client/brcm-egl/qwaylandbrcmglcontext.h @@ -63,7 +63,7 @@ public: bool makeCurrent(QPlatformSurface *surface) override; void doneCurrent() override; - void (*getProcAddress(const char *procName)) () override; + QFunctionPointer getProcAddress(const char *procName) override; QSurfaceFormat format() const override { return m_format; } diff --git a/src/hardwareintegration/client/wayland-egl/qwaylandglcontext.cpp b/src/hardwareintegration/client/wayland-egl/qwaylandglcontext.cpp index f70c75a33..2a9e39ed6 100644 --- a/src/hardwareintegration/client/wayland-egl/qwaylandglcontext.cpp +++ b/src/hardwareintegration/client/wayland-egl/qwaylandglcontext.cpp @@ -59,6 +59,8 @@ #include <QtCore/qmutex.h> +#include <dlfcn.h> + // Constants from EGL_KHR_create_context #ifndef EGL_CONTEXT_MINOR_VERSION_KHR #define EGL_CONTEXT_MINOR_VERSION_KHR 0x30FB @@ -575,9 +577,12 @@ bool QWaylandGLContext::isValid() const return m_context != EGL_NO_CONTEXT; } -void (*QWaylandGLContext::getProcAddress(const char *procName)) () +QFunctionPointer QWaylandGLContext::getProcAddress(const char *procName) { - return eglGetProcAddress(procName); + QFunctionPointer proc = (QFunctionPointer) eglGetProcAddress(procName); + if (!proc) + proc = (QFunctionPointer) dlsym(RTLD_DEFAULT, procName); + return proc; } EGLConfig QWaylandGLContext::eglConfig() const diff --git a/src/hardwareintegration/client/xcomposite-egl/qwaylandxcompositeeglwindow.cpp b/src/hardwareintegration/client/xcomposite-egl/qwaylandxcompositeeglwindow.cpp index cfc0cda10..431cb14c1 100644 --- a/src/hardwareintegration/client/xcomposite-egl/qwaylandxcompositeeglwindow.cpp +++ b/src/hardwareintegration/client/xcomposite-egl/qwaylandxcompositeeglwindow.cpp @@ -57,12 +57,10 @@ namespace QtWaylandClient { QWaylandXCompositeEGLWindow::QWaylandXCompositeEGLWindow(QWindow *window, QWaylandXCompositeEGLClientBufferIntegration *glxIntegration) : QWaylandWindow(window) , m_glxIntegration(glxIntegration) - , m_context(0) , m_buffer(0) , m_xWindow(0) , m_config(q_configFromGLFormat(glxIntegration->eglDisplay(), window->format(), true, EGL_WINDOW_BIT | EGL_PIXMAP_BIT)) , m_surface(0) - , mBuffer(0) { } diff --git a/src/hardwareintegration/client/xcomposite-egl/qwaylandxcompositeeglwindow.h b/src/hardwareintegration/client/xcomposite-egl/qwaylandxcompositeeglwindow.h index 5b7d492c5..90b4cc73e 100644 --- a/src/hardwareintegration/client/xcomposite-egl/qwaylandxcompositeeglwindow.h +++ b/src/hardwareintegration/client/xcomposite-egl/qwaylandxcompositeeglwindow.h @@ -66,13 +66,11 @@ private: void createEglSurface(); QWaylandXCompositeEGLClientBufferIntegration *m_glxIntegration; - QWaylandXCompositeEGLContext *m_context; QWaylandBuffer *m_buffer; Window m_xWindow; EGLConfig m_config; EGLSurface m_surface; - QWaylandBuffer *mBuffer; }; } diff --git a/src/hardwareintegration/client/xcomposite-glx/qwaylandxcompositeglxcontext.cpp b/src/hardwareintegration/client/xcomposite-glx/qwaylandxcompositeglxcontext.cpp index 439acc00c..33ae2e038 100644 --- a/src/hardwareintegration/client/xcomposite-glx/qwaylandxcompositeglxcontext.cpp +++ b/src/hardwareintegration/client/xcomposite-glx/qwaylandxcompositeglxcontext.cpp @@ -45,6 +45,8 @@ #include <QRegion> +#include <dlfcn.h> + QT_BEGIN_NAMESPACE namespace QtWaylandClient { @@ -94,9 +96,12 @@ void QWaylandXCompositeGLXContext::swapBuffers(QPlatformSurface *surface) w->waitForFrameSync(); } -void (*QWaylandXCompositeGLXContext::getProcAddress(const char *procName)) () +QFunctionPointer QWaylandXCompositeGLXContext::getProcAddress(const char *procName) { - return glXGetProcAddress(reinterpret_cast<const GLubyte *>(procName)); + QFunctionPointer proc = glXGetProcAddress(reinterpret_cast<const GLubyte *>(procName)); + if (!proc) + proc = (QFunctionPointer) dlsym(RTLD_DEFAULT, procName); + return proc; } QSurfaceFormat QWaylandXCompositeGLXContext::format() const diff --git a/src/hardwareintegration/client/xcomposite-glx/xcomposite-glx.pri b/src/hardwareintegration/client/xcomposite-glx/xcomposite-glx.pri index 067378af1..a2f5376a9 100644 --- a/src/hardwareintegration/client/xcomposite-glx/xcomposite-glx.pri +++ b/src/hardwareintegration/client/xcomposite-glx/xcomposite-glx.pri @@ -1,7 +1,7 @@ INCLUDEPATH += $$PWD include ($$PWD/../xcomposite_share/xcomposite_share.pri) -QMAKE_USE += wayland-client glx +QMAKE_USE += wayland-client glx libdl QT += glx_support-private diff --git a/src/hardwareintegration/compositor/drm-egl-server/drmeglserverbufferintegration.h b/src/hardwareintegration/compositor/drm-egl-server/drmeglserverbufferintegration.h index d9072b069..6286f0f20 100644 --- a/src/hardwareintegration/compositor/drm-egl-server/drmeglserverbufferintegration.h +++ b/src/hardwareintegration/compositor/drm-egl-server/drmeglserverbufferintegration.h @@ -96,7 +96,7 @@ public: DrmEglServerBufferIntegration(); ~DrmEglServerBufferIntegration(); - void initializeHardware(QWaylandCompositor *); + void initializeHardware(QWaylandCompositor *) override; bool supportsFormat(QtWayland::ServerBuffer::Format format) const override; QtWayland::ServerBuffer *createServerBuffer(const QSize &size, QtWayland::ServerBuffer::Format format) override; diff --git a/src/hardwareintegration/compositor/wayland-egl/waylandeglclientbufferintegration.cpp b/src/hardwareintegration/compositor/wayland-egl/waylandeglclientbufferintegration.cpp index 1e6723a04..2b68ccec9 100644 --- a/src/hardwareintegration/compositor/wayland-egl/waylandeglclientbufferintegration.cpp +++ b/src/hardwareintegration/compositor/wayland-egl/waylandeglclientbufferintegration.cpp @@ -59,6 +59,10 @@ #define EGL_WAYLAND_BUFFER_WL 0x31D5 #endif +#ifndef EGL_WAYLAND_EGLSTREAM_WL +#define EGL_WAYLAND_EGLSTREAM_WL 0x334B +#endif + #ifndef EGL_WAYLAND_PLANE_WL #define EGL_WAYLAND_PLANE_WL 0x31D6 #endif @@ -168,7 +172,7 @@ public: void initBuffer(WaylandEglClientBuffer *buffer); void init_egl_texture(WaylandEglClientBuffer *buffer, EGLint format); - void init_egl_fd_texture(WaylandEglClientBuffer *buffer, EGLNativeFileDescriptorKHR streamFd); + void init_egl_fd_texture(WaylandEglClientBuffer *buffer, wl_resource *bufferHandle); void register_buffer(struct ::wl_resource *buffer, BufferState state); EGLDisplay egl_display; @@ -281,16 +285,26 @@ void WaylandEglClientBufferIntegrationPrivate::init_egl_texture(WaylandEglClient } } -void WaylandEglClientBufferIntegrationPrivate::init_egl_fd_texture(WaylandEglClientBuffer *buffer, EGLNativeFileDescriptorKHR streamFd) +void WaylandEglClientBufferIntegrationPrivate::init_egl_fd_texture(WaylandEglClientBuffer *buffer, struct ::wl_resource *bufferHandle) { //EglStreams case BufferState &state = *buffer->d; state.egl_format = EGL_TEXTURE_EXTERNAL_WL; state.isYInverted = false; - state.egl_stream = funcs->create_stream_from_file_descriptor(egl_display, streamFd); - close(streamFd); + EGLNativeFileDescriptorKHR streamFd = EGL_NO_FILE_DESCRIPTOR_KHR; + + if (egl_query_wayland_buffer(egl_display, bufferHandle, EGL_WAYLAND_BUFFER_WL, &streamFd)) { + state.egl_stream = funcs->create_stream_from_file_descriptor(egl_display, streamFd); + close(streamFd); + } else { + EGLAttrib stream_attribs[] = { + EGL_WAYLAND_EGLSTREAM_WL, (EGLAttrib)bufferHandle, + EGL_NONE + }; + state.egl_stream = funcs->create_stream_attrib_nv(egl_display, stream_attribs); + } if (state.egl_stream == EGL_NO_STREAM_KHR) { qWarning("%s:%d: eglCreateStreamFromFileDescriptorKHR failed: 0x%x", Q_FUNC_INFO, __LINE__, eglGetError()); @@ -486,10 +500,8 @@ void WaylandEglClientBuffer::setCommitted(QRegion &damage) { ClientBuffer::setCommitted(damage); if (d->eglMode == BufferState::ModeNone) { - EGLNativeFileDescriptorKHR streamFd = EGL_NO_FILE_DESCRIPTOR_KHR; auto *p = WaylandEglClientBufferIntegrationPrivate::get(m_integration); - if (p->egl_query_wayland_buffer(p->egl_display, waylandBufferHandle(), EGL_WAYLAND_BUFFER_WL, &streamFd)) - p->init_egl_fd_texture(this, streamFd); + p->init_egl_fd_texture(this, waylandBufferHandle()); } } diff --git a/src/hardwareintegration/compositor/wayland-egl/waylandeglclientbufferintegration.h b/src/hardwareintegration/compositor/wayland-egl/waylandeglclientbufferintegration.h index e0235d84c..846cbc3a4 100644 --- a/src/hardwareintegration/compositor/wayland-egl/waylandeglclientbufferintegration.h +++ b/src/hardwareintegration/compositor/wayland-egl/waylandeglclientbufferintegration.h @@ -53,7 +53,7 @@ public: void initializeHardware(struct ::wl_display *display) override; - QtWayland::ClientBuffer *createBufferFor(wl_resource *buffer); + QtWayland::ClientBuffer *createBufferFor(wl_resource *buffer) override; private: Q_DISABLE_COPY(WaylandEglClientBufferIntegration) diff --git a/src/hardwareintegration/compositor/xcomposite-egl/xcompositeeglintegration.h b/src/hardwareintegration/compositor/xcomposite-egl/xcompositeeglintegration.h index fb869b2e7..55e02abe7 100644 --- a/src/hardwareintegration/compositor/xcomposite-egl/xcompositeeglintegration.h +++ b/src/hardwareintegration/compositor/xcomposite-egl/xcompositeeglintegration.h @@ -67,8 +67,8 @@ class XCompositeEglClientBuffer : public QtWayland::ClientBuffer public: XCompositeEglClientBuffer(XCompositeEglClientBufferIntegration *integration, wl_resource *bufferResource); - QSize size() const; - QWaylandSurface::Origin origin() const; + QSize size() const override; + QWaylandSurface::Origin origin() const override; QOpenGLTexture *toOpenGlTexture(int plane) override; QWaylandBufferRef::BufferFormatEgl bufferFormatEgl() const override { return QWaylandBufferRef::BufferFormatEgl_RGBA; diff --git a/src/imports/compositor/compositor.pro b/src/imports/compositor/compositor.pro index a97f90f48..26cbe4744 100644 --- a/src/imports/compositor/compositor.pro +++ b/src/imports/compositor/compositor.pro @@ -15,6 +15,8 @@ COMPOSITOR_QML_FILES += \ WaylandCursorItem.qml \ qmldir +DEFINES += QT_WAYLAND_COMPOSITOR_QUICK + # Create the resource file GENERATED_RESOURCE_FILE = $$OUT_PWD/compositor.qrc diff --git a/src/imports/compositor/qwaylandquickcompositorplugin.cpp b/src/imports/compositor/qwaylandquickcompositorplugin.cpp index 4444c953b..9c2066a75 100644 --- a/src/imports/compositor/qwaylandquickcompositorplugin.cpp +++ b/src/imports/compositor/qwaylandquickcompositorplugin.cpp @@ -47,7 +47,9 @@ #include <QtWaylandCompositor/QWaylandCompositorExtension> #include <QtWaylandCompositor/QWaylandQuickExtension> #include <QtWaylandCompositor/QWaylandSeat> +#if QT_CONFIG(draganddrop) #include <QtWaylandCompositor/QWaylandDrag> +#endif #include <QtWaylandCompositor/QWaylandKeymap> #include <QtWaylandCompositor/QWaylandQuickShellSurfaceItem> #include <QtWaylandCompositor/QWaylandResource> @@ -127,7 +129,9 @@ public: qmlRegisterUncreatableType<QWaylandClient>(uri, 1, 0, "WaylandClient", QObject::tr("Cannot create instance of WaylandClient")); qmlRegisterUncreatableType<QWaylandOutput>(uri, 1, 0, "WaylandOutputBase", QObject::tr("Cannot create instance of WaylandOutputBase, use WaylandOutput instead")); qmlRegisterUncreatableType<QWaylandSeat>(uri, 1, 0, "WaylandSeat", QObject::tr("Cannot create instance of WaylandSeat")); +#if QT_CONFIG(draganddrop) qmlRegisterUncreatableType<QWaylandDrag>(uri, 1, 0, "WaylandDrag", QObject::tr("Cannot create instance of WaylandDrag")); +#endif qmlRegisterUncreatableType<QWaylandCompositor>(uri, 1, 0, "WaylandCompositorBase", QObject::tr("Cannot create instance of WaylandCompositorBase, use WaylandCompositor instead")); qmlRegisterUncreatableType<QWaylandSurface>(uri, 1, 0, "WaylandSurfaceBase", QObject::tr("Cannot create instance of WaylandSurfaceBase, use WaylandSurface instead")); qmlRegisterUncreatableType<QWaylandShell>(uri, 1, 0, "Shell", QObject::tr("Cannot create instance of Shell")); @@ -144,6 +148,7 @@ public: qmlRegisterUncreatableType<QWaylandXdgShellV5>(uri, 1, 0, "XdgShellV5Base", QObject::tr("Cannot create instance of XdgShellV5Base")); qmlRegisterType<QWaylandXdgShellV5QuickExtension>(uri, 1, 0, "XdgShellV5"); qmlRegisterType<QWaylandXdgSurfaceV5>(uri, 1, 0, "XdgSurfaceV5"); + qmlRegisterType<QWaylandXdgPopupV5>(uri, 1, 0, "XdgPopupV5"); qmlRegisterType<QWaylandTextInputManagerQuickExtension>(uri, 1, 0, "TextInputManager"); } }; diff --git a/src/imports/imports.pro b/src/imports/imports.pro index 42228475c..c57c95d20 100644 --- a/src/imports/imports.pro +++ b/src/imports/imports.pro @@ -1,3 +1,3 @@ TEMPLATE = subdirs -SUBDIRS += compositor +qtHaveModule(quick): SUBDIRS += compositor diff --git a/src/plugins/decorations/bradient/main.cpp b/src/plugins/decorations/bradient/main.cpp index 074c74522..ceb07c803 100644 --- a/src/plugins/decorations/bradient/main.cpp +++ b/src/plugins/decorations/bradient/main.cpp @@ -211,7 +211,6 @@ void QWaylandBradientDecoration::paint(QPaintDevice *device) p.setRenderHint(QPainter::Antialiasing); // Title bar - QPoint gradCenter(top.center()+ QPoint(30, 60)); QLinearGradient grad(top.topLeft(), top.bottomLeft()); QColor base(m_backgroundColor); grad.setColorAt(0, base.lighter(100)); diff --git a/src/plugins/hardwareintegration/client/xcomposite-egl/main.cpp b/src/plugins/hardwareintegration/client/xcomposite-egl/main.cpp index 07222f237..585285fae 100644 --- a/src/plugins/hardwareintegration/client/xcomposite-egl/main.cpp +++ b/src/plugins/hardwareintegration/client/xcomposite-egl/main.cpp @@ -44,7 +44,7 @@ QT_BEGIN_NAMESPACE namespace QtWaylandClient { -class QWaylandXCompositeEglClientBufferIntegrationPlugin : public QWaylandClientBufferIntegrationPlugin +class QWaylandXCompositeEglClientBufferPlugin : public QWaylandClientBufferIntegrationPlugin { Q_OBJECT Q_PLUGIN_METADATA(IID QWaylandClientBufferIntegrationFactoryInterface_iid FILE "xcomposite-egl.json") @@ -52,7 +52,7 @@ public: QWaylandClientBufferIntegration *create(const QString&, const QStringList&) override; }; -QWaylandClientBufferIntegration *QWaylandXCompositeEglClientBufferIntegrationPlugin::create(const QString& system, const QStringList& paramList) +QWaylandClientBufferIntegration *QWaylandXCompositeEglClientBufferPlugin::create(const QString& system, const QStringList& paramList) { Q_UNUSED(paramList); Q_UNUSED(system); diff --git a/src/plugins/hardwareintegration/client/xcomposite-egl/xcomposite-egl.pro b/src/plugins/hardwareintegration/client/xcomposite-egl/xcomposite-egl.pro index c8734084b..83bd4fe8d 100644 --- a/src/plugins/hardwareintegration/client/xcomposite-egl/xcomposite-egl.pro +++ b/src/plugins/hardwareintegration/client/xcomposite-egl/xcomposite-egl.pro @@ -11,5 +11,5 @@ SOURCES += \ main.cpp PLUGIN_TYPE = wayland-graphics-integration-client -PLUGIN_CLASS_NAME = QWaylandXCompositeEglClientBufferIntegrationPlugin +PLUGIN_CLASS_NAME = QWaylandXCompositeEglClientBufferPlugin load(qt_plugin) diff --git a/src/plugins/hardwareintegration/client/xcomposite-glx/main.cpp b/src/plugins/hardwareintegration/client/xcomposite-glx/main.cpp index 00fa255b5..f7b878d96 100644 --- a/src/plugins/hardwareintegration/client/xcomposite-glx/main.cpp +++ b/src/plugins/hardwareintegration/client/xcomposite-glx/main.cpp @@ -44,7 +44,7 @@ QT_BEGIN_NAMESPACE namespace QtWaylandClient { -class QWaylandXCompositeGlxClientBufferIntegrationPlugin : public QWaylandClientBufferIntegrationPlugin +class QWaylandXCompositeGlxClientBufferPlugin : public QWaylandClientBufferIntegrationPlugin { Q_OBJECT Q_PLUGIN_METADATA(IID QWaylandClientBufferIntegrationFactoryInterface_iid FILE "xcomposite-glx.json") @@ -52,7 +52,7 @@ public: QWaylandClientBufferIntegration *create(const QString&, const QStringList&) override; }; -QWaylandClientBufferIntegration *QWaylandXCompositeGlxClientBufferIntegrationPlugin::create(const QString& system, const QStringList& paramList) +QWaylandClientBufferIntegration *QWaylandXCompositeGlxClientBufferPlugin::create(const QString& system, const QStringList& paramList) { Q_UNUSED(paramList); Q_UNUSED(system); diff --git a/src/plugins/hardwareintegration/client/xcomposite-glx/xcomposite-glx.pro b/src/plugins/hardwareintegration/client/xcomposite-glx/xcomposite-glx.pro index fb5ad15f8..804ca3861 100644 --- a/src/plugins/hardwareintegration/client/xcomposite-glx/xcomposite-glx.pro +++ b/src/plugins/hardwareintegration/client/xcomposite-glx/xcomposite-glx.pro @@ -8,5 +8,5 @@ SOURCES += \ main.cpp PLUGIN_TYPE = wayland-graphics-integration-client -PLUGIN_CLASS_NAME = QWaylandXCompositeGlxClientBufferIntegrationPlugin +PLUGIN_CLASS_NAME = QWaylandXCompositeGlxClientBufferPlugin load(qt_plugin) diff --git a/src/plugins/shellintegration/ivi-shell/qwaylandivishellintegration.cpp b/src/plugins/shellintegration/ivi-shell/qwaylandivishellintegration.cpp index 6103e6bea..612924d5b 100644 --- a/src/plugins/shellintegration/ivi-shell/qwaylandivishellintegration.cpp +++ b/src/plugins/shellintegration/ivi-shell/qwaylandivishellintegration.cpp @@ -91,7 +91,7 @@ bool QWaylandIviShellIntegration::initialize(QWaylandDisplay *display) uint32_t QWaylandIviShellIntegration::getNextUniqueSurfaceId() { const uint32_t PID_MAX_EXPONENTIATION = 22; // 22 bit shift operation - const uint32_t ID_LIMIT = 2 ^ (32 - PID_MAX_EXPONENTIATION); // 10 bit is uniqeu id + const uint32_t ID_LIMIT = 1 << (32 - PID_MAX_EXPONENTIATION); // 10 bit is unique id QMutexLocker locker(&m_mutex); if (m_lastSurfaceId == 0) { diff --git a/src/plugins/shellintegration/ivi-shell/qwaylandivishellintegration.h b/src/plugins/shellintegration/ivi-shell/qwaylandivishellintegration.h index 5a0bfbdc0..cb3b1bec2 100644 --- a/src/plugins/shellintegration/ivi-shell/qwaylandivishellintegration.h +++ b/src/plugins/shellintegration/ivi-shell/qwaylandivishellintegration.h @@ -53,7 +53,7 @@ class Q_WAYLAND_CLIENT_EXPORT QWaylandIviShellIntegration : public QWaylandShell public: QWaylandIviShellIntegration(); ~QWaylandIviShellIntegration(); - bool initialize(QWaylandDisplay *display); + bool initialize(QWaylandDisplay *display) override; virtual QWaylandShellSurface *createShellSurface(QWaylandWindow *window) override; private: diff --git a/src/shared/qwaylandxkb.cpp b/src/shared/qwaylandxkb.cpp index 3e04467de..a0e388a1c 100644 --- a/src/shared/qwaylandxkb.cpp +++ b/src/shared/qwaylandxkb.cpp @@ -43,10 +43,13 @@ #include <QKeyEvent> #include <QString> +#if QT_CONFIG(xkbcommon_evdev) #include <xkbcommon/xkbcommon-keysyms.h> +#endif QT_BEGIN_NAMESPACE +#if QT_CONFIG(xkbcommon_evdev) static const uint32_t KeyTbl[] = { XKB_KEY_Escape, Qt::Key_Escape, XKB_KEY_Tab, Qt::Key_Tab, @@ -290,9 +293,11 @@ static xkb_keysym_t toKeysymFromTable(uint32_t key) return 0; } +#endif std::pair<int, QString> QWaylandXkb::keysymToQtKey(xkb_keysym_t keysym, Qt::KeyboardModifiers &modifiers) { +#if QT_CONFIG(xkbcommon_evdev) QString text; uint utf32 = xkb_keysym_to_utf32(keysym); if (utf32) @@ -326,10 +331,15 @@ std::pair<int, QString> QWaylandXkb::keysymToQtKey(xkb_keysym_t keysym, Qt::Keyb } return { code, text }; +#else + Q_UNUSED(modifiers) + return { keysym, "" }; +#endif } Qt::KeyboardModifiers QWaylandXkb::modifiers(struct xkb_state *state) { +#if QT_CONFIG(xkbcommon_evdev) Qt::KeyboardModifiers modifiers = Qt::NoModifier; xkb_state_component cstate = static_cast<xkb_state_component>(XKB_STATE_DEPRESSED | XKB_STATE_LATCHED | XKB_STATE_LOCKED); @@ -344,6 +354,10 @@ Qt::KeyboardModifiers QWaylandXkb::modifiers(struct xkb_state *state) modifiers |= Qt::MetaModifier; return modifiers; +#else + Q_UNUSED(state) + return Qt::NoModifier; +#endif } QEvent::Type QWaylandXkb::toQtEventType(uint32_t state) @@ -353,6 +367,7 @@ QEvent::Type QWaylandXkb::toQtEventType(uint32_t state) QVector<xkb_keysym_t> QWaylandXkb::toKeysym(QKeyEvent *event) { +#if QT_CONFIG(xkbcommon_evdev) QVector<xkb_keysym_t> keysyms; if (event->key() >= Qt::Key_F1 && event->key() <= Qt::Key_F35) { keysyms.append(XKB_KEY_F1 + (event->key() - Qt::Key_F1)); @@ -372,6 +387,9 @@ QVector<xkb_keysym_t> QWaylandXkb::toKeysym(QKeyEvent *event) keysyms.append(toKeysymFromTable(event->key())); } return keysyms; +#else + return QVector<xkb_keysym_t>() << event->nativeScanCode(); +#endif } QT_END_NAMESPACE diff --git a/src/shared/qwaylandxkb_p.h b/src/shared/qwaylandxkb_p.h index 230159fbb..6fa1ea45b 100644 --- a/src/shared/qwaylandxkb_p.h +++ b/src/shared/qwaylandxkb_p.h @@ -41,9 +41,16 @@ #ifndef QWAYLANDXKB_H #define QWAYLANDXKB_H +#include <QtGui/private/qtguiglobal_p.h> #include <Qt> #include <QEvent> + +#if QT_CONFIG(xkbcommon_evdev) #include <xkbcommon/xkbcommon.h> +#else +typedef quint32 xkb_keysym_t; +struct xkb_state; +#endif #include <utility> |