forked from KDE/kdeconnect-kde
-
Notifications
You must be signed in to change notification settings - Fork 0
/
diff.patch
70 lines (67 loc) · 3.55 KB
/
diff.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
diff -rupN kdeconnect-kde-22.04.1-orig/kdeconnect-kde-22.04.1/plugins/remotekeyboard/CMakeLists.txt kdeconnect-kde-22.04.1/plugins/remotekeyboard/CMakeLists.txt
--- kdeconnect-kde-22.04.1-orig/kdeconnect-kde-22.04.1/plugins/remotekeyboard/CMakeLists.txt 2022-05-10 10:50:03.000000000 +0800
+++ kdeconnect-kde-22.04.1/plugins/remotekeyboard/CMakeLists.txt 2022-06-18 22:48:31.077215314 +0800
@@ -8,7 +8,10 @@ ecm_qt_declare_logging_category(
kdeconnect_add_plugin(kdeconnect_remotekeyboard
SOURCES remotekeyboardplugin.cpp ${debug_file_SRCS})
+# find_package(Qt5 ${QT_MIN_VERSION} REQUIRED COMPONENTS X11Extras)
+
target_link_libraries(kdeconnect_remotekeyboard
kdeconnectcore
+ Qt5::Gui
Qt5::DBus
)
diff -rupN kdeconnect-kde-22.04.1-orig/kdeconnect-kde-22.04.1/plugins/remotekeyboard/remotekeyboardplugin.cpp kdeconnect-kde-22.04.1/plugins/remotekeyboard/remotekeyboardplugin.cpp
--- kdeconnect-kde-22.04.1-orig/kdeconnect-kde-22.04.1/plugins/remotekeyboard/remotekeyboardplugin.cpp 2022-05-10 10:50:03.000000000 +0800
+++ kdeconnect-kde-22.04.1/plugins/remotekeyboard/remotekeyboardplugin.cpp 2022-06-19 00:28:01.707730993 +0800
@@ -6,6 +6,8 @@
#include "remotekeyboardplugin.h"
#include <KPluginFactory>
+#include <QGuiApplication>
+#include <QClipboard>
#include <QDebug>
#include <QString>
#include <QVariantMap>
@@ -91,15 +93,34 @@ void RemoteKeyboardPlugin::sendKeyPress(
bool shift, bool ctrl,
bool alt, bool sendAck) const
{
- NetworkPacket np(PACKET_TYPE_MOUSEPAD_REQUEST, {
- {QStringLiteral("key"), key},
- {QStringLiteral("specialKey"), specialKey},
- {QStringLiteral("shift"), shift},
- {QStringLiteral("ctrl"), ctrl},
- {QStringLiteral("alt"), alt},
- {QStringLiteral("sendAck"), sendAck}
- });
- sendPacket(np);
+ if (key==QStringLiteral("v") && ctrl)
+ {
+ QString clipboardText = QGuiApplication::clipboard()->text();
+ qCDebug(KDECONNECT_PLUGIN_REMOTEKEYBOARD) << "clipboard: " << clipboardText.toStdString().data();
+ NetworkPacket np(PACKET_TYPE_MOUSEPAD_REQUEST, {
+ {QStringLiteral("key"), clipboardText},
+ {QStringLiteral("specialKey"), specialKey},
+ {QStringLiteral("shift"), shift},
+ {QStringLiteral("ctrl"), false},
+ {QStringLiteral("alt"), alt},
+ {QStringLiteral("sendAck"), sendAck}
+ });
+ sendPacket(np);
+ } else {
+ if (ctrl)
+ qCDebug(KDECONNECT_PLUGIN_REMOTEKEYBOARD) << "key " << key.toStdString().data() << "ctrl 1";
+ else
+ qCDebug(KDECONNECT_PLUGIN_REMOTEKEYBOARD) << "key " << key.toStdString().data() << "ctrl 0";
+ NetworkPacket np(PACKET_TYPE_MOUSEPAD_REQUEST, {
+ {QStringLiteral("key"), key},
+ {QStringLiteral("specialKey"), specialKey},
+ {QStringLiteral("shift"), shift},
+ {QStringLiteral("ctrl"), ctrl},
+ {QStringLiteral("alt"), alt},
+ {QStringLiteral("sendAck"), sendAck}
+ });
+ sendPacket(np);
+ }
}
void RemoteKeyboardPlugin::sendQKeyEvent(const QVariantMap& keyEvent, bool sendAck) const