diff --git a/QtScrcpy/device/controller/controller.cpp b/QtScrcpy/device/controller/controller.cpp index 953a11d03..7b171a056 100644 --- a/QtScrcpy/device/controller/controller.cpp +++ b/QtScrcpy/device/controller/controller.cpp @@ -109,6 +109,16 @@ void Controller::onPostVolumeDown() postKeyCodeClick(AKEYCODE_VOLUME_DOWN); } +void Controller::onCopy() +{ + postKeyCodeClick(AKEYCODE_COPY); +} + +void Controller::onCut() +{ + postKeyCodeClick(AKEYCODE_CUT); +} + void Controller::onExpandNotificationPanel() { ControlMsg *controlMsg = new ControlMsg(ControlMsg::CMT_EXPAND_NOTIFICATION_PANEL); @@ -136,7 +146,7 @@ void Controller::onRequestDeviceClipboard() postControlMsg(controlMsg); } -void Controller::onSetDeviceClipboard() +void Controller::onSetDeviceClipboard(bool pause) { QClipboard *board = QApplication::clipboard(); QString text = board->text(); @@ -144,7 +154,7 @@ void Controller::onSetDeviceClipboard() if (!controlMsg) { return; } - controlMsg->setSetClipboardMsgData(text, true); + controlMsg->setSetClipboardMsgData(text, pause); postControlMsg(controlMsg); } @@ -226,13 +236,13 @@ void Controller::postKeyCodeClick(AndroidKeycode keycode) if (!controlEventDown) { return; } - controlEventDown->setInjectKeycodeMsgData(AKEY_EVENT_ACTION_DOWN, keycode, AMETA_NONE); + controlEventDown->setInjectKeycodeMsgData(AKEY_EVENT_ACTION_DOWN, keycode, 0, AMETA_NONE); postControlMsg(controlEventDown); ControlMsg *controlEventUp = new ControlMsg(ControlMsg::CMT_INJECT_KEYCODE); if (!controlEventUp) { return; } - controlEventUp->setInjectKeycodeMsgData(AKEY_EVENT_ACTION_UP, keycode, AMETA_NONE); + controlEventUp->setInjectKeycodeMsgData(AKEY_EVENT_ACTION_UP, keycode, 0, AMETA_NONE); postControlMsg(controlEventUp); } diff --git a/QtScrcpy/device/controller/controller.h b/QtScrcpy/device/controller/controller.h index 3a7ef0614..29f77f1cd 100644 --- a/QtScrcpy/device/controller/controller.h +++ b/QtScrcpy/device/controller/controller.h @@ -31,6 +31,8 @@ public slots: void onPostPower(); void onPostVolumeUp(); void onPostVolumeDown(); + void onCopy(); + void onCut(); void onExpandNotificationPanel(); void onCollapseNotificationPanel(); void onSetScreenPowerMode(ControlMsg::ScreenPowerMode mode); @@ -43,7 +45,7 @@ public slots: // turn the screen on if it was off, press BACK otherwise void onPostBackOrScreenOn(); void onRequestDeviceClipboard(); - void onSetDeviceClipboard(); + void onSetDeviceClipboard(bool pause = true); void onClipboardPaste(); void onPostTextInput(QString &text); diff --git a/QtScrcpy/device/controller/inputconvert/controlmsg.cpp b/QtScrcpy/device/controller/inputconvert/controlmsg.cpp index 27e56eb73..6a21634b2 100644 --- a/QtScrcpy/device/controller/inputconvert/controlmsg.cpp +++ b/QtScrcpy/device/controller/inputconvert/controlmsg.cpp @@ -19,10 +19,11 @@ ControlMsg::~ControlMsg() } } -void ControlMsg::setInjectKeycodeMsgData(AndroidKeyeventAction action, AndroidKeycode keycode, AndroidMetastate metastate) +void ControlMsg::setInjectKeycodeMsgData(AndroidKeyeventAction action, AndroidKeycode keycode, quint32 repeat, AndroidMetastate metastate) { m_data.injectKeycode.action = action; m_data.injectKeycode.keycode = keycode; + m_data.injectKeycode.repeat = repeat; m_data.injectKeycode.metastate = metastate; } @@ -105,10 +106,11 @@ QByteArray ControlMsg::serializeData() case CMT_INJECT_KEYCODE: buffer.putChar(m_data.injectKeycode.action); BufferUtil::write32(buffer, m_data.injectKeycode.keycode); + BufferUtil::write32(buffer, m_data.injectKeycode.repeat); BufferUtil::write32(buffer, m_data.injectKeycode.metastate); break; case CMT_INJECT_TEXT: - BufferUtil::write16(buffer, static_cast(strlen(m_data.injectText.text))); + BufferUtil::write32(buffer, static_cast(strlen(m_data.injectText.text))); buffer.write(m_data.injectText.text, strlen(m_data.injectText.text)); break; case CMT_INJECT_TOUCH: { @@ -126,7 +128,7 @@ QByteArray ControlMsg::serializeData() break; case CMT_SET_CLIPBOARD: buffer.putChar(!!m_data.setClipboard.paste); - BufferUtil::write16(buffer, static_cast(strlen(m_data.setClipboard.text))); + BufferUtil::write32(buffer, static_cast(strlen(m_data.setClipboard.text))); buffer.write(m_data.setClipboard.text, strlen(m_data.setClipboard.text)); break; case CMT_SET_SCREEN_POWER_MODE: diff --git a/QtScrcpy/device/controller/inputconvert/controlmsg.h b/QtScrcpy/device/controller/inputconvert/controlmsg.h index 380247d76..e45506020 100644 --- a/QtScrcpy/device/controller/inputconvert/controlmsg.h +++ b/QtScrcpy/device/controller/inputconvert/controlmsg.h @@ -9,9 +9,15 @@ #include "keycodes.h" #include "qscrcpyevent.h" +#define CONTROL_MSG_MAX_SIZE (1 << 18) // 256k + #define CONTROL_MSG_INJECT_TEXT_MAX_LENGTH 300 -#define CONTROL_MSG_CLIPBOARD_TEXT_MAX_LENGTH 4092 +// type: 1 byte; paste flag: 1 byte; length: 4 bytes +#define CONTROL_MSG_CLIPBOARD_TEXT_MAX_LENGTH \ + (CONTROL_MSG_MAX_SIZE - 6) + #define POINTER_ID_MOUSE static_cast(-1) + // ControlMsg class ControlMsg : public QScrcpyEvent { @@ -41,7 +47,7 @@ class ControlMsg : public QScrcpyEvent ControlMsg(ControlMsgType controlMsgType); virtual ~ControlMsg(); - void setInjectKeycodeMsgData(AndroidKeyeventAction action, AndroidKeycode keycode, AndroidMetastate metastate); + void setInjectKeycodeMsgData(AndroidKeyeventAction action, AndroidKeycode keycode, quint32 repeat, AndroidMetastate metastate); void setInjectTextMsgData(QString &text); // id 代表一个触摸点,最多支持10个触摸点[0,9] // action 只能是AMOTION_EVENT_ACTION_DOWN,AMOTION_EVENT_ACTION_UP,AMOTION_EVENT_ACTION_MOVE @@ -67,6 +73,7 @@ class ControlMsg : public QScrcpyEvent { AndroidKeyeventAction action; AndroidKeycode keycode; + quint32 repeat; AndroidMetastate metastate; } injectKeycode; struct diff --git a/QtScrcpy/device/controller/inputconvert/inputconvertbase.h b/QtScrcpy/device/controller/inputconvert/inputconvertbase.h index f16c631b2..d9f8dc5f3 100644 --- a/QtScrcpy/device/controller/inputconvert/inputconvertbase.h +++ b/QtScrcpy/device/controller/inputconvert/inputconvertbase.h @@ -32,8 +32,10 @@ class InputConvertBase : public QObject protected: void sendControlMsg(ControlMsg *msg); -private: QPointer m_controller; + // Qt reports repeated events as a boolean, but Android expects the actual + // number of repetitions. This variable keeps track of the count. + unsigned m_repeat = 0; }; #endif // INPUTCONVERTBASE_H diff --git a/QtScrcpy/device/controller/inputconvert/inputconvertgame.cpp b/QtScrcpy/device/controller/inputconvert/inputconvertgame.cpp index 5278cfb74..d5687591b 100644 --- a/QtScrcpy/device/controller/inputconvert/inputconvertgame.cpp +++ b/QtScrcpy/device/controller/inputconvert/inputconvertgame.cpp @@ -176,11 +176,15 @@ void InputConvertGame::sendTouchEvent(int id, QPointF pos, AndroidMotioneventAct QPoint absolutePos = calcFrameAbsolutePos(pos).toPoint(); static QPoint lastAbsolutePos = absolutePos; if (AMOTION_EVENT_ACTION_MOVE == action && lastAbsolutePos == absolutePos) { + delete controlMsg; return; } lastAbsolutePos = absolutePos; - controlMsg->setInjectTouchMsgData(static_cast(id), action, static_cast(0), QRect(absolutePos, m_frameSize), 1.0f); + controlMsg->setInjectTouchMsgData(static_cast(id), action, + static_cast(0), + QRect(absolutePos, m_frameSize), + AMOTION_EVENT_ACTION_DOWN == action? 1.0f : 0.0f); sendControlMsg(controlMsg); } diff --git a/QtScrcpy/device/controller/inputconvert/inputconvertnormal.cpp b/QtScrcpy/device/controller/inputconvert/inputconvertnormal.cpp index 63924e172..260604ee5 100644 --- a/QtScrcpy/device/controller/inputconvert/inputconvertnormal.cpp +++ b/QtScrcpy/device/controller/inputconvert/inputconvertnormal.cpp @@ -1,6 +1,8 @@ #include +#include #include "inputconvertnormal.h" +#include "controller.h" InputConvertNormal::InputConvertNormal(Controller *controller) : InputConvertBase(controller) {} @@ -44,7 +46,10 @@ void InputConvertNormal::mouseEvent(const QMouseEvent *from, const QSize &frameS return; } controlMsg->setInjectTouchMsgData( - static_cast(POINTER_ID_MOUSE), action, convertMouseButtons(from->buttons()), QRect(pos.toPoint(), frameSize), 1.0f); + static_cast(POINTER_ID_MOUSE), action, + convertMouseButtons(from->buttons()), + QRect(pos.toPoint(), frameSize), + AMOTION_EVENT_ACTION_DOWN == action? 1.0f : 0.0f); sendControlMsg(controlMsg); } @@ -81,6 +86,8 @@ void InputConvertNormal::keyEvent(const QKeyEvent *from, const QSize &frameSize, return; } + bool repeat = from->isAutoRepeat(); + // action AndroidKeyeventAction action; switch (from->type()) { @@ -105,7 +112,14 @@ void InputConvertNormal::keyEvent(const QKeyEvent *from, const QSize &frameSize, if (!controlMsg) { return; } - controlMsg->setInjectKeycodeMsgData(action, keyCode, convertMetastate(from->modifiers())); + + if (repeat) { + m_repeat++; + } else { + m_repeat = 0; + } + + controlMsg->setInjectKeycodeMsgData(action, keyCode, m_repeat, convertMetastate(from->modifiers())); sendControlMsg(controlMsg); } diff --git a/QtScrcpy/device/controller/receiver/devicemsg.cpp b/QtScrcpy/device/controller/receiver/devicemsg.cpp index e2bb28d44..24673ab0a 100644 --- a/QtScrcpy/device/controller/receiver/devicemsg.cpp +++ b/QtScrcpy/device/controller/receiver/devicemsg.cpp @@ -32,7 +32,7 @@ qint32 DeviceMsg::deserialize(QByteArray &byteArray) char c = 0; qint32 ret = 0; - if (len < 3) { + if (len < 5) { // at least type + empty string length return 0; // not available } @@ -42,8 +42,8 @@ qint32 DeviceMsg::deserialize(QByteArray &byteArray) switch (m_data.type) { case DMT_GET_CLIPBOARD: { m_data.clipboardMsg.text = Q_NULLPTR; - quint16 clipboardLen = BufferUtil::read16(buf); - if (clipboardLen > len - 3) { + quint16 clipboardLen = BufferUtil::read32(buf); + if (clipboardLen > len - 5) { ret = 0; // not available break; } @@ -53,7 +53,7 @@ qint32 DeviceMsg::deserialize(QByteArray &byteArray) memcpy(m_data.clipboardMsg.text, text.data(), text.length()); m_data.clipboardMsg.text[text.length()] = '\0'; - ret = 3 + clipboardLen; + ret = 5 + clipboardLen; break; } default: diff --git a/QtScrcpy/device/controller/receiver/devicemsg.h b/QtScrcpy/device/controller/receiver/devicemsg.h index 1ed0f22dc..1bcb40b2b 100644 --- a/QtScrcpy/device/controller/receiver/devicemsg.h +++ b/QtScrcpy/device/controller/receiver/devicemsg.h @@ -3,9 +3,9 @@ #include -#define DEVICE_MSG_QUEUE_SIZE 64 -#define DEVICE_MSG_TEXT_MAX_LENGTH 4093 -#define DEVICE_MSG_SERIALIZED_MAX_SIZE (3 + DEVICE_MSG_TEXT_MAX_LENGTH) +#define DEVICE_MSG_MAX_SIZE (1 << 18) // 256k +// type: 1 byte; length: 4 bytes +#define DEVICE_MSG_TEXT_MAX_LENGTH (DEVICE_MSG_MAX_SIZE - 5) class DeviceMsg : public QObject { diff --git a/QtScrcpy/device/controller/receiver/receiver.cpp b/QtScrcpy/device/controller/receiver/receiver.cpp index 5e282ef69..32d819d3d 100644 --- a/QtScrcpy/device/controller/receiver/receiver.cpp +++ b/QtScrcpy/device/controller/receiver/receiver.cpp @@ -44,6 +44,11 @@ void Receiver::processMsg(DeviceMsg *deviceMsg) QClipboard *board = QApplication::clipboard(); QString text; deviceMsg->getClipboardMsgData(text); + + if (board->text() == text) { + qDebug("Computer clipboard unchanged"); + break; + } board->setText(text); break; } diff --git a/QtScrcpy/device/device.cpp b/QtScrcpy/device/device.cpp index 55ca712ee..78c516491 100644 --- a/QtScrcpy/device/device.cpp +++ b/QtScrcpy/device/device.cpp @@ -151,6 +151,8 @@ void Device::initSignals() connect(this, &Device::postPower, m_controller, &Controller::onPostPower); connect(this, &Device::postVolumeUp, m_controller, &Controller::onPostVolumeUp); connect(this, &Device::postVolumeDown, m_controller, &Controller::onPostVolumeDown); + connect(this, &Device::postCopy, m_controller, &Controller::onCopy); + connect(this, &Device::postCut, m_controller, &Controller::onCut); connect(this, &Device::setScreenPowerMode, m_controller, &Controller::onSetScreenPowerMode); connect(this, &Device::expandNotificationPanel, m_controller, &Controller::onExpandNotificationPanel); connect(this, &Device::collapseNotificationPanel, m_controller, &Controller::onCollapseNotificationPanel); @@ -159,7 +161,6 @@ void Device::initSignals() connect(this, &Device::keyEvent, m_controller, &Controller::onKeyEvent); connect(this, &Device::postBackOrScreenOn, m_controller, &Controller::onPostBackOrScreenOn); - connect(this, &Device::requestDeviceClipboard, m_controller, &Controller::onRequestDeviceClipboard); connect(this, &Device::setDeviceClipboard, m_controller, &Controller::onSetDeviceClipboard); connect(this, &Device::clipboardPaste, m_controller, &Controller::onClipboardPaste); connect(this, &Device::postTextInput, m_controller, &Controller::onPostTextInput); diff --git a/QtScrcpy/device/device.h b/QtScrcpy/device/device.h index 38bc16463..bbbf693c2 100644 --- a/QtScrcpy/device/device.h +++ b/QtScrcpy/device/device.h @@ -70,13 +70,15 @@ class Device : public QObject void postPower(); void postVolumeUp(); void postVolumeDown(); + void postCopy(); + void postCut(); void setScreenPowerMode(ControlMsg::ScreenPowerMode mode); void expandNotificationPanel(); void collapseNotificationPanel(); void postBackOrScreenOn(); void postTextInput(QString &text); void requestDeviceClipboard(); - void setDeviceClipboard(); + void setDeviceClipboard(bool pause = true); void clipboardPaste(); void pushFileRequest(const QString &file, const QString &devicePath = ""); void installApkRequest(const QString &apkFile); diff --git a/QtScrcpy/device/server/server.cpp b/QtScrcpy/device/server/server.cpp index 1ff8c026d..5616622ed 100644 --- a/QtScrcpy/device/server/server.cpp +++ b/QtScrcpy/device/server/server.cpp @@ -162,6 +162,7 @@ bool Server::execute() // https://github.com/Genymobile/scrcpy/commit/080a4ee3654a9b7e96c8ffe37474b5c21c02852a // args << Config::getInstance().getCodecOptions(); + args << Config::getInstance().getCodecName(); #ifdef SERVER_DEBUGGER qInfo("Server debugger waiting for a client on device port " SERVER_DEBUGGER_PORT "..."); diff --git a/QtScrcpy/device/ui/videoform.cpp b/QtScrcpy/device/ui/videoform.cpp index 36a6ef43b..2d75c9adc 100644 --- a/QtScrcpy/device/ui/videoform.cpp +++ b/QtScrcpy/device/ui/videoform.cpp @@ -189,6 +189,7 @@ void VideoForm::installShortcut() // switchFullScreen shortcut = new QShortcut(QKeySequence("Ctrl+f"), this); + shortcut->setAutoRepeat(false); connect(shortcut, &QShortcut::activated, this, [this]() { if (!m_device) { return; @@ -198,14 +199,17 @@ void VideoForm::installShortcut() // resizeSquare shortcut = new QShortcut(QKeySequence("Ctrl+g"), this); + shortcut->setAutoRepeat(false); connect(shortcut, &QShortcut::activated, this, [this]() { resizeSquare(); }); // removeBlackRect - shortcut = new QShortcut(QKeySequence("Ctrl+x"), this); + shortcut = new QShortcut(QKeySequence("Ctrl+w"), this); + shortcut->setAutoRepeat(false); connect(shortcut, &QShortcut::activated, this, [this]() { removeBlackRect(); }); // postGoHome shortcut = new QShortcut(QKeySequence("Ctrl+h"), this); + shortcut->setAutoRepeat(false); connect(shortcut, &QShortcut::activated, this, [this]() { if (!m_device) { return; @@ -215,6 +219,7 @@ void VideoForm::installShortcut() // postGoBack shortcut = new QShortcut(QKeySequence("Ctrl+b"), this); + shortcut->setAutoRepeat(false); connect(shortcut, &QShortcut::activated, this, [this]() { if (!m_device) { return; @@ -224,6 +229,7 @@ void VideoForm::installShortcut() // postAppSwitch shortcut = new QShortcut(QKeySequence("Ctrl+s"), this); + shortcut->setAutoRepeat(false); connect(shortcut, &QShortcut::activated, this, [this]() { if (!m_device) { return; @@ -233,6 +239,7 @@ void VideoForm::installShortcut() // postGoMenu shortcut = new QShortcut(QKeySequence("Ctrl+m"), this); + shortcut->setAutoRepeat(false); connect(shortcut, &QShortcut::activated, this, [this]() { if (!m_device) { return; @@ -260,6 +267,7 @@ void VideoForm::installShortcut() // postPower shortcut = new QShortcut(QKeySequence("Ctrl+p"), this); + shortcut->setAutoRepeat(false); connect(shortcut, &QShortcut::activated, this, [this]() { if (!m_device) { return; @@ -269,6 +277,7 @@ void VideoForm::installShortcut() // setScreenPowerMode(ControlMsg::SPM_OFF) shortcut = new QShortcut(QKeySequence("Ctrl+o"), this); + shortcut->setAutoRepeat(false); connect(shortcut, &QShortcut::activated, this, [this]() { if (!m_device) { return; @@ -278,6 +287,7 @@ void VideoForm::installShortcut() // expandNotificationPanel shortcut = new QShortcut(QKeySequence("Ctrl+n"), this); + shortcut->setAutoRepeat(false); connect(shortcut, &QShortcut::activated, this, [this]() { if (!m_device) { return; @@ -287,6 +297,7 @@ void VideoForm::installShortcut() // collapseNotificationPanel shortcut = new QShortcut(QKeySequence("Ctrl+Shift+n"), this); + shortcut->setAutoRepeat(false); connect(shortcut, &QShortcut::activated, this, [this]() { if (!m_device) { return; @@ -294,31 +305,44 @@ void VideoForm::installShortcut() emit m_device->collapseNotificationPanel(); }); - // requestDeviceClipboard + // copy shortcut = new QShortcut(QKeySequence("Ctrl+c"), this); + shortcut->setAutoRepeat(false); + connect(shortcut, &QShortcut::activated, this, [this]() { + if (!m_device) { + return; + } + emit m_device->postCopy(); + }); + + // cut + shortcut = new QShortcut(QKeySequence("Ctrl+x"), this); + shortcut->setAutoRepeat(false); connect(shortcut, &QShortcut::activated, this, [this]() { if (!m_device) { return; } - emit m_device->requestDeviceClipboard(); + emit m_device->postCut(); }); // clipboardPaste shortcut = new QShortcut(QKeySequence("Ctrl+v"), this); + shortcut->setAutoRepeat(false); connect(shortcut, &QShortcut::activated, this, [this]() { if (!m_device) { return; } - emit m_device->clipboardPaste(); + emit m_device->setDeviceClipboard(); }); // setDeviceClipboard shortcut = new QShortcut(QKeySequence("Ctrl+Shift+v"), this); + shortcut->setAutoRepeat(false); connect(shortcut, &QShortcut::activated, this, [this]() { if (!m_device) { return; } - emit m_device->setDeviceClipboard(); + emit m_device->clipboardPaste(); }); } diff --git a/QtScrcpy/devicemanage/devicemanage.cpp b/QtScrcpy/devicemanage/devicemanage.cpp index 6df58781d..fd2421d2a 100644 --- a/QtScrcpy/devicemanage/devicemanage.cpp +++ b/QtScrcpy/devicemanage/devicemanage.cpp @@ -139,8 +139,6 @@ void DeviceManage::setGroupControlSignals(Device *host, Device *client, bool ins connect(host, &Device::installApkRequest, client, &Device::installApkRequest); connect(host, &Device::screenshot, client, &Device::screenshot); connect(host, &Device::showTouch, client, &Device::showTouch); - // dont connect requestDeviceClipboard - //connect(host, &Device::requestDeviceClipboard, client, &Device::requestDeviceClipboard); } else { disconnect(host, &Device::postGoBack, client, &Device::postGoBack); disconnect(host, &Device::postGoHome, client, &Device::postGoHome); diff --git a/QtScrcpy/util/config.cpp b/QtScrcpy/util/config.cpp index b06794139..8966a7db4 100644 --- a/QtScrcpy/util/config.cpp +++ b/QtScrcpy/util/config.cpp @@ -14,7 +14,7 @@ #define COMMON_PUSHFILE_DEF "/sdcard/" #define COMMON_SERVER_VERSION_KEY "ServerVersion" -#define COMMON_SERVER_VERSION_DEF "1.14" +#define COMMON_SERVER_VERSION_DEF "1.17" #define COMMON_SERVER_PATH_KEY "ServerPath" #define COMMON_SERVER_PATH_DEF "/data/local/tmp/scrcpy-server.jar" @@ -40,6 +40,9 @@ #define COMMON_CODEC_OPTIONS_KEY "CodecOptions" #define COMMON_CODEC_OPTIONS_DEF "-" +#define COMMON_CODEC_NAME_KEY "CodecName" +#define COMMON_CODEC_NAME_DEF "-" + // user data #define COMMON_RECORD_KEY "RecordPath" #define COMMON_RECORD_DEF "" @@ -289,6 +292,15 @@ QString Config::getCodecOptions() return codecOptions; } +QString Config::getCodecName() +{ + QString codecName; + m_settings->beginGroup(GROUP_COMMON); + codecName = m_settings->value(COMMON_CODEC_NAME_KEY, COMMON_CODEC_NAME_DEF).toString(); + m_settings->endGroup(); + return codecName; +} + QString Config::getTitle() { QString title; diff --git a/QtScrcpy/util/config.h b/QtScrcpy/util/config.h index 681b422b6..e0e7f5178 100644 --- a/QtScrcpy/util/config.h +++ b/QtScrcpy/util/config.h @@ -23,6 +23,7 @@ class Config : public QObject QString getAdbPath(); QString getLogLevel(); QString getCodecOptions(); + QString getCodecName(); // user data QString getRecordPath(); diff --git a/README.md b/README.md index 6427b5d28..9a3327b1e 100644 --- a/README.md +++ b/README.md @@ -194,7 +194,7 @@ Note: it is not necessary to keep you Android device connected via USB after you | -------------------------------------- |:----------------------------- |:----------------------------- | Switch fullscreen mode | `Ctrl`+`f` | `Cmd`+`f` | Resize window to 1:1 (pixel-perfect) | `Ctrl`+`g` | `Cmd`+`g` - | Resize window to remove black borders | `Ctrl`+`x` \| _Double-click¹_ | `Cmd`+`x` \| _Double-click¹_ + | Resize window to remove black borders | `Ctrl`+`w` \| _Double-click¹_ | `Cmd`+`w` \| _Double-click¹_ | Click on `HOME` | `Ctrl`+`h` \| _Middle-click_ | `Ctrl`+`h` \| _Middle-click_ | Click on `BACK` | `Ctrl`+`b` \| _Right-click²_ | `Cmd`+`b` \| _Right-click²_ | Click on `APP_SWITCH` | `Ctrl`+`s` | `Cmd`+`s` @@ -206,14 +206,17 @@ Note: it is not necessary to keep you Android device connected via USB after you | Turn device screen off (keep mirroring)| `Ctrl`+`o` | `Cmd`+`o` | Expand notification panel | `Ctrl`+`n` | `Cmd`+`n` | Collapse notification panel | `Ctrl`+`Shift`+`n` | `Cmd`+`Shift`+`n` - | Copy device clipboard to computer | `Ctrl`+`c` | `Cmd`+`c` - | Paste computer clipboard to device | `Ctrl`+`v` | `Cmd`+`v` - | Copy computer clipboard to device | `Ctrl`+`Shift`+`v` | `Cmd`+`Shift`+`v` + | Copy to clipboard³ | `Ctrl`+`c` | `Cmd`+`c` + | Cut to clipboard³ | `Ctrl`+`x` | `Cmd`+`x` + | Synchronize clipboards and paste³ | `Ctrl`+`v` | `Cmd`+`v` + | Inject computer clipboard text | `Ctrl`+`Shift`+`v` | `Cmd`+`Shift`+`v` _¹Double-click on black borders to remove them._ _²Right-click turns the screen on if it was off, presses BACK otherwise._ +_³Only on Android >= 7._ + ## TODO [TODO](docs/TODO.md) @@ -241,7 +244,7 @@ There are several reasons listed as below according to importance (high to low). All the dependencies are provided and it is easy to compile. ### PC client -1. Set up the Qt development environment on the target platform (Qt == 5.15.0, vs == 2017 (mingw not supported)) +1. Set up the Qt development environment on the target platform (Qt == 5.15.2, vs == 2019 (mingw not supported)) 2. Clone the project 3. Open the project root directory all.pro with QtCreator 4. Compile and run diff --git a/README_zh.md b/README_zh.md index 1973cb95e..b16147a74 100644 --- a/README_zh.md +++ b/README_zh.md @@ -193,7 +193,7 @@ Mac OS平台,你可以直接使用我编译好的可执行程序: | -------------------------------------- |:----------------------------- |:----------------------------- | 切换全屏 | `Ctrl`+`f` | `Cmd`+`f` | 调整窗口大小为 1:1 | `Ctrl`+`g` | `Cmd`+`g` - | 调整窗口大小去除黑边 | `Ctrl`+`x` \| _左键双击_ | `Cmd`+`x` \| _左键双击_ + | 调整窗口大小去除黑边 | `Ctrl`+`w` \| _左键双击_ | `Cmd`+`w` \| _左键双击_ | 点击 `主页` | `Ctrl`+`h` \| _点击鼠标中键_ | `Ctrl`+`h` \| _点击鼠标中键_ | 点击 `BACK` | `Ctrl`+`b` \| _右键双击_ | `Cmd`+`b` \| _右键双击_ | 点击 `APP_SWITCH` | `Ctrl`+`s` | `Cmd`+`s` @@ -205,9 +205,10 @@ Mac OS平台,你可以直接使用我编译好的可执行程序: | 关闭屏幕 (保持投屏) | `Ctrl`+`o` | `Cmd`+`o` | 打开下拉菜单 | `Ctrl`+`n` | `Cmd`+`n` | 关闭下拉菜单 | `Ctrl`+`Shift`+`n` | `Cmd`+`Shift`+`n` - | 复制设备剪切板到电脑 | `Ctrl`+`c` | `Cmd`+`c` - | 粘贴电脑剪切板到设备 | `Ctrl`+`v` | `Cmd`+`v` - | 复制电脑剪切板到设备 | `Ctrl`+`Shift`+`v` | `Cmd`+`Shift`+`v` + | 复制到剪切板 | `Ctrl`+`c` | `Cmd`+`c` + | 剪切到剪切板 | `Ctrl`+`x` | `Cmd`+`x` + | 同步剪切板并粘贴 | `Ctrl`+`v` | `Cmd`+`v` + | 注入电脑剪切板文本 | `Ctrl`+`Shift`+`v` | `Cmd`+`Shift`+`v` 鼠标左键双击黑色区域可以去除黑色区域 @@ -240,7 +241,7 @@ Mac OS平台,你可以直接使用我编译好的可执行程序: 尽量提供了所有依赖资源,方便傻瓜式编译。 ### PC端 -1. 目标平台上搭建Qt开发环境(Qt == 5.15, vs == 2017 (**不支持mingw**)) +1. 目标平台上搭建Qt开发环境(Qt == 5.15.2, vs == 2019 (**不支持mingw**)) 2. 克隆该项目 3. 使用QtCreator打开项目根目录all.pro 4. 编译,运行即可 diff --git a/config/config.ini b/config/config.ini index ba116547b..6b85845f6 100644 --- a/config/config.ini +++ b/config/config.ini @@ -10,7 +10,7 @@ RenderExpiredFrames=0 # 视频解码方式:-1 自动,0 软解,1 dx硬解,2 opengl硬解 UseDesktopOpenGL=-1 # scrcpy-server的版本号(不要修改) -ServerVersion=1.14 +ServerVersion=1.17 # scrcpy-server推送到安卓设备的路径 ServerPath=/data/local/tmp/scrcpy-server.jar # 自定义adb路径,例如D:/android/tools/adb.exe @@ -19,6 +19,9 @@ AdbPath= # 例如 CodecOptions="profile=1,level=2" # 更多编码选项参考 https://d.android.com/reference/android/media/MediaFormat CodecOptions="-" +# 指定编码器名称,必须是H.264编码器 +# 例如 CodecName="OMX.qcom.video.encoder.avc" +CodecName="-" # Set the log level (debug, info, warn, error) LogLevel=info diff --git a/docs/KeyMapDes_zh.md b/docs/KeyMapDes_zh.md index 1ea0ce072..07669a0f1 100644 --- a/docs/KeyMapDes_zh.md +++ b/docs/KeyMapDes_zh.md @@ -25,7 +25,9 @@ - mouseMoveMap:鼠标移动映射,鼠标的移动将被映射为以startPos为起点,以鼠标移动方向为移动方向的手指拖动操作(开启鼠标移动映射以后会隐藏鼠标,限制鼠标移动范围)。 一般在FPS手游中用来调整人物视野。 - startPos 手指拖动起始点 - - speedRatio 鼠标移动映射为手指拖动的比例,可以控制鼠标灵敏度,数值要大于0.00,数值越大,灵敏度越低 + - speedRatio 鼠标移动映射为手指拖动的比例,可以控制鼠标灵敏度,数值要大于0.00225,数值越大,灵敏度越低,Y轴以2.25的比率平移。如果这不适合您的手机屏幕,请使用以下两种设置来设置单个灵敏度值。 + - speedRatioX 鼠标X轴的速度比灵敏度。此值必须至少为0.001。 + - speedRatioY 鼠标Y轴的速度比灵敏度。此值必须至少为0.001。 - smallEyes 触发小眼睛的按键,按下此按键以后,鼠标的移动将被映射为以smallEyes.pos为起点,以鼠标移动方向为移动方向的手指拖动操作 - keyMapNodes 一般按键的映射,json数组,所有一般按键映射都放在这个数组中,将键盘的按键映射为普通的手指点击。 diff --git a/docs/TODO.md b/docs/TODO.md index 4d3ca811c..8447d77c9 100644 --- a/docs/TODO.md +++ b/docs/TODO.md @@ -1,4 +1,4 @@ -最后同步scrcpy 3c0fc8f54f42bf6e7eca35b352a7d343749b65c4 +最后同步scrcpy 08baaf4b575aef7ee56d14683be3f4e3a86d39aa # TODO ## 低优先级 @@ -12,6 +12,8 @@ - opengles 3.0 兼容性参考[这里](https://github.com/libretro/glsl-shaders/blob/master/nnedi3/shaders/yuv-to-rgb-2x.glsl) - 通过host:track-devices实现自动连接 https://www.jianshu.com/p/2cb86c6de76c - 旋转 https://github.com/Genymobile/scrcpy/commit/d48b375a1dbc8bed92e3424b5967e59c2d8f6ca1 +- 禁用屏幕保护 https://github.com/Genymobile/scrcpy/commit/dc7b60e6199b90a45ea26751988f6f30f8b2efdf +- 自定义快捷键 https://github.com/Genymobile/scrcpy/commit/1b76d9fd78c3a88a8503a72d4cd2f65bdb836aa4 ## 高优先级 - linux打包以及版本号 diff --git a/third_party/scrcpy-server b/third_party/scrcpy-server index 73d292aa8..ab38830e6 100644 Binary files a/third_party/scrcpy-server and b/third_party/scrcpy-server differ