diff options
author | Laszlo Agocs <laszlo.p.agocs@nokia.com> | 2011-05-09 10:09:33 (GMT) |
---|---|---|
committer | Jørgen Lind <jorgen.lind@nokia.com> | 2011-05-09 10:09:33 (GMT) |
commit | eb0c2e7229bb3559e6f8754122b298479407c153 (patch) | |
tree | e0ca95ec11b4d1d8d374d4c46cd9741d4f315753 /src | |
parent | a166615d7a0d346e519aa0e53a1e9776e41a4167 (diff) | |
download | Qt-eb0c2e7229bb3559e6f8754122b298479407c153.zip Qt-eb0c2e7229bb3559e6f8754122b298479407c153.tar.gz Qt-eb0c2e7229bb3559e6f8754122b298479407c153.tar.bz2 |
Added Wayland selection support.
Diffstat (limited to 'src')
-rw-r--r-- | src/gui/kernel/qclipboard.h | 1 | ||||
-rw-r--r-- | src/gui/kernel/qplatformclipboard_qpa.cpp | 7 | ||||
-rw-r--r-- | src/gui/kernel/qplatformclipboard_qpa.h | 1 | ||||
-rw-r--r-- | src/plugins/platforms/wayland/qwaylanddisplay.cpp | 7 | ||||
-rw-r--r-- | src/plugins/platforms/wayland/qwaylanddisplay.h | 1 | ||||
-rw-r--r-- | src/plugins/platforms/wayland/qwaylandinputdevice.h | 1 | ||||
-rw-r--r-- | src/plugins/platforms/wayland/qwaylandintegration.cpp | 9 | ||||
-rw-r--r-- | src/plugins/platforms/wayland/qwaylandintegration.h | 3 | ||||
-rw-r--r-- | src/plugins/platforms/wayland/wayland.pro | 6 |
9 files changed, 33 insertions, 3 deletions
diff --git a/src/gui/kernel/qclipboard.h b/src/gui/kernel/qclipboard.h index b55bdc6..019917e 100644 --- a/src/gui/kernel/qclipboard.h +++ b/src/gui/kernel/qclipboard.h @@ -112,6 +112,7 @@ protected: friend class QBaseApplication; friend class QDragManager; friend class QMimeSource; + friend class QPlatformClipboard; private: Q_DISABLE_COPY(QClipboard) diff --git a/src/gui/kernel/qplatformclipboard_qpa.cpp b/src/gui/kernel/qplatformclipboard_qpa.cpp index 957a4df..33d2afc 100644 --- a/src/gui/kernel/qplatformclipboard_qpa.cpp +++ b/src/gui/kernel/qplatformclipboard_qpa.cpp @@ -42,6 +42,8 @@ #ifndef QT_NO_CLIPBOARD +#include <QtGui/private/qapplication_p.h> + QT_BEGIN_NAMESPACE class QClipboardData @@ -100,6 +102,11 @@ bool QPlatformClipboard::supportsMode(QClipboard::Mode mode) const return mode == QClipboard::Clipboard; } +void QPlatformClipboard::emitChanged(QClipboard::Mode mode) +{ + QApplication::clipboard()->emitChanged(mode); +} + QT_END_NAMESPACE #endif //QT_NO_CLIPBOARD diff --git a/src/gui/kernel/qplatformclipboard_qpa.h b/src/gui/kernel/qplatformclipboard_qpa.h index 3381c06..5444a1f 100644 --- a/src/gui/kernel/qplatformclipboard_qpa.h +++ b/src/gui/kernel/qplatformclipboard_qpa.h @@ -62,6 +62,7 @@ public: virtual const QMimeData *mimeData(QClipboard::Mode mode = QClipboard::Clipboard ) const; virtual void setMimeData(QMimeData *data, QClipboard::Mode mode = QClipboard::Clipboard); virtual bool supportsMode(QClipboard::Mode mode) const; + void emitChanged(QClipboard::Mode mode); }; QT_END_NAMESPACE diff --git a/src/plugins/platforms/wayland/qwaylanddisplay.cpp b/src/plugins/platforms/wayland/qwaylanddisplay.cpp index 876b46a..974453d 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay.cpp +++ b/src/plugins/platforms/wayland/qwaylanddisplay.cpp @@ -45,6 +45,7 @@ #include "qwaylandscreen.h" #include "qwaylandcursor.h" #include "qwaylandinputdevice.h" +#include "qwaylandclipboard.h" #ifdef QT_WAYLAND_GL_SUPPORT #include "gl_integration/qwaylandglintegration.h" @@ -52,6 +53,7 @@ #include <QtCore/QAbstractEventDispatcher> #include <QtGui/QApplication> +#include <QtGui/private/qapplication_p.h> #include <unistd.h> #include <fcntl.h> @@ -249,7 +251,6 @@ void QWaylandDisplay::displayHandleGlobal(uint32_t id, uint32_t version) { Q_UNUSED(version); - if (interface == "wl_output") { struct wl_output *output = wl_output_create(mDisplay, id, 1); wl_output_add_listener(output, &outputListener, this); @@ -264,5 +265,9 @@ void QWaylandDisplay::displayHandleGlobal(uint32_t id, QWaylandInputDevice *inputDevice = new QWaylandInputDevice(mDisplay, id); mInputDevices.append(inputDevice); + } else if (interface == "wl_selection_offer") { + QPlatformIntegration *plat = QApplicationPrivate::platformIntegration(); + QWaylandClipboard *clipboard = static_cast<QWaylandClipboard *>(plat->clipboard()); + clipboard->createSelectionOffer(id); } } diff --git a/src/plugins/platforms/wayland/qwaylanddisplay.h b/src/plugins/platforms/wayland/qwaylanddisplay.h index a2cb1b2..0658956 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay.h +++ b/src/plugins/platforms/wayland/qwaylanddisplay.h @@ -80,6 +80,7 @@ public: void frameCallback(wl_display_frame_func_t func, struct wl_surface *surface, void *data); struct wl_display *wl_display() const { return mDisplay; } + struct wl_shell *wl_shell() const { return mShell; } QList<QWaylandInputDevice *> inputDevices() const { return mInputDevices; } diff --git a/src/plugins/platforms/wayland/qwaylandinputdevice.h b/src/plugins/platforms/wayland/qwaylandinputdevice.h index 3c83252..251259b 100644 --- a/src/plugins/platforms/wayland/qwaylandinputdevice.h +++ b/src/plugins/platforms/wayland/qwaylandinputdevice.h @@ -60,6 +60,7 @@ public: QWaylandInputDevice(struct wl_display *display, uint32_t id); void attach(QWaylandBuffer *buffer, int x, int y); void handleWindowDestroyed(QWaylandWindow *window); + struct wl_input_device *wl_input_device() const { return mInputDevice; } private: struct wl_display *mDisplay; diff --git a/src/plugins/platforms/wayland/qwaylandintegration.cpp b/src/plugins/platforms/wayland/qwaylandintegration.cpp index b6401f6..6166c14 100644 --- a/src/plugins/platforms/wayland/qwaylandintegration.cpp +++ b/src/plugins/platforms/wayland/qwaylandintegration.cpp @@ -45,6 +45,7 @@ #include "qwaylandshmsurface.h" #include "qwaylandshmwindow.h" #include "qwaylandnativeinterface.h" +#include "qwaylandclipboard.h" #include "qgenericunixfontdatabase.h" @@ -64,6 +65,7 @@ QWaylandIntegration::QWaylandIntegration(bool useOpenGL) , mDisplay(new QWaylandDisplay()) , mUseOpenGL(useOpenGL) , mNativeInterface(new QWaylandNativeInterface) + , mClipboard(0) { } @@ -132,3 +134,10 @@ bool QWaylandIntegration::hasOpenGL() const return false; #endif } + +QPlatformClipboard *QWaylandIntegration::clipboard() const +{ + if (!mClipboard) + mClipboard = new QWaylandClipboard(mDisplay); + return mClipboard; +} diff --git a/src/plugins/platforms/wayland/qwaylandintegration.h b/src/plugins/platforms/wayland/qwaylandintegration.h index 71f6d9c..fc748b0 100644 --- a/src/plugins/platforms/wayland/qwaylandintegration.h +++ b/src/plugins/platforms/wayland/qwaylandintegration.h @@ -65,6 +65,8 @@ public: QPlatformNativeInterface *nativeInterface() const; + QPlatformClipboard *clipboard() const; + private: bool hasOpenGL() const; @@ -72,6 +74,7 @@ private: QWaylandDisplay *mDisplay; bool mUseOpenGL; QPlatformNativeInterface *mNativeInterface; + mutable QPlatformClipboard *mClipboard; }; QT_END_NAMESPACE diff --git a/src/plugins/platforms/wayland/wayland.pro b/src/plugins/platforms/wayland/wayland.pro index f739fb1..76f8be5 100644 --- a/src/plugins/platforms/wayland/wayland.pro +++ b/src/plugins/platforms/wayland/wayland.pro @@ -15,7 +15,8 @@ SOURCES = main.cpp \ qwaylanddisplay.cpp \ qwaylandwindow.cpp \ qwaylandscreen.cpp \ - qwaylandshmwindow.cpp + qwaylandshmwindow.cpp \ + qwaylandclipboard.cpp HEADERS = qwaylandintegration.h \ qwaylandnativeinterface.h \ @@ -25,7 +26,8 @@ HEADERS = qwaylandintegration.h \ qwaylandscreen.h \ qwaylandshmsurface.h \ qwaylandbuffer.h \ - qwaylandshmwindow.h + qwaylandshmwindow.h \ + qwaylandclipboard.h INCLUDEPATH += $$QMAKE_INCDIR_WAYLAND LIBS += $$QMAKE_LIBS_WAYLAND |