Commit 80178b8f authored by Piyush Aggarwal's avatar Piyush Aggarwal 🎮
Browse files

clipboard: make new Wayland implementation build on non-Apple unices only

parent 389a47b0
Pipeline #56745 passed with stage
in 6 minutes and 17 seconds
find_package(QtWaylandScanner REQUIRED)
find_package(Wayland 1.15 COMPONENTS Client)
find_package(Qt5 ${QT_MIN_VERSION} CONFIG REQUIRED COMPONENTS WaylandClient)
if(UNIX AND NOT APPLE)
find_package(QtWaylandScanner REQUIRED)
find_package(Wayland 1.15 COMPONENTS Client)
find_package(Qt5 ${QT_MIN_VERSION} CONFIG REQUIRED COMPONENTS WaylandClient)
endif()
set(debug_file_SRCS)
ecm_qt_declare_logging_category(
......@@ -8,22 +10,27 @@ ecm_qt_declare_logging_category(
IDENTIFIER KDECONNECT_PLUGIN_CLIPBOARD CATEGORY_NAME kdeconnect.plugin.clipboard
DEFAULT_SEVERITY Warning
EXPORT kdeconnect-kde DESCRIPTION "kdeconnect (plugin clipboard)")
set(kdeconnect_clipboard_SRCS
clipboardplugin.cpp
clipboardlistener.cpp
datacontrol.cpp
${debug_file_SRCS}
)
ecm_add_qtwayland_client_protocol(kdeconnect_clipboard_SRCS
PROTOCOL wlr-data-control-unstable-v1.xml
BASENAME wlr-data-control-unstable-v1
)
if(UNIX AND NOT APPLE)
list(APPEND kdeconnect_clipboard_SRCS datacontrol.cpp)
ecm_add_qtwayland_client_protocol(kdeconnect_clipboard_SRCS
PROTOCOL wlr-data-control-unstable-v1.xml
BASENAME wlr-data-control-unstable-v1
)
set(kdeconnect_clipboard_WL_LINK_LIBS Qt5::GuiPrivate # for native interface to get wl_seat
Wayland::Client Qt::WaylandClient)
endif()
kdeconnect_add_plugin(kdeconnect_clipboard JSON kdeconnect_clipboard.json SOURCES ${kdeconnect_clipboard_SRCS})
target_link_libraries(kdeconnect_clipboard kdeconnectcore
Qt5::Gui
Qt5::GuiPrivate # for native interface to get wl_seat
Wayland::Client Qt::WaylandClient
${kdeconnect_clipboard_WL_LINK_LIBS}
)
......@@ -8,7 +8,9 @@
#include <QDebug>
#include <QMimeData>
#if !defined(Q_OS_WIN) && !defined(Q_OS_MAC)
#include "datacontrol.h"
#endif
ClipboardListener::ClipboardListener()
{}
......@@ -27,11 +29,15 @@ ClipboardListener* ClipboardListener::instance()
{
static ClipboardListener* me = nullptr;
if (!me) {
#if !defined(Q_OS_WIN) && !defined(Q_OS_MAC)
if (QGuiApplication::platformName().startsWith(QLatin1String("wayland"), Qt::CaseInsensitive)) {
me = new WaylandClipboardListener();
} else {
#endif
me = new QClipboardListener();
#if !defined(Q_OS_WIN) && !defined(Q_OS_MAC)
}
#endif
}
return me;
}
......@@ -72,6 +78,7 @@ void QClipboardListener::setText(const QString& content)
clipboard->setText(content);
}
#if !defined(Q_OS_WIN) && !defined(Q_OS_MAC)
WaylandClipboardListener::WaylandClipboardListener()
: m_dataControl(new DataControl(this))
{
......@@ -105,3 +112,4 @@ void WaylandClipboardListener::refresh(const QMimeData *mime)
refreshContent(content);
Q_EMIT clipboardChanged(content);
}
#endif
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment