From 4bd6672bcbecfdf98c9738f1b116085e676eb67b Mon Sep 17 00:00:00 2001 From: Romain Vimont Date: Thu, 4 Jun 2020 23:23:09 +0200 Subject: [PATCH] Increase clipboard size from 4k to 256k Beyond 256k, SDL_GetClipboardText() returns an empty text on my machine. Fixes #1117 --- app/src/control_msg.h | 2 +- app/src/device_msg.h | 2 +- .../main/java/com/genymobile/scrcpy/ControlMessageReader.java | 2 +- .../main/java/com/genymobile/scrcpy/DeviceMessageWriter.java | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/src/control_msg.h b/app/src/control_msg.h index 0c47952d9a..e4324503bc 100644 --- a/app/src/control_msg.h +++ b/app/src/control_msg.h @@ -10,7 +10,7 @@ #include "android/keycodes.h" #include "common.h" -#define CONTROL_MSG_MAX_SIZE 4096 +#define CONTROL_MSG_MAX_SIZE (1 << 18) // 256k #define CONTROL_MSG_INJECT_TEXT_MAX_LENGTH 300 // type: 1 byte; length: 4 bytes diff --git a/app/src/device_msg.h b/app/src/device_msg.h index 0fc7d87c02..4b681e2c37 100644 --- a/app/src/device_msg.h +++ b/app/src/device_msg.h @@ -7,7 +7,7 @@ #include "config.h" -#define DEVICE_MSG_MAX_SIZE 4096 +#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) diff --git a/server/src/main/java/com/genymobile/scrcpy/ControlMessageReader.java b/server/src/main/java/com/genymobile/scrcpy/ControlMessageReader.java index e8f50dc875..3107ac3176 100644 --- a/server/src/main/java/com/genymobile/scrcpy/ControlMessageReader.java +++ b/server/src/main/java/com/genymobile/scrcpy/ControlMessageReader.java @@ -13,7 +13,7 @@ public class ControlMessageReader { static final int INJECT_SCROLL_EVENT_PAYLOAD_LENGTH = 20; static final int SET_SCREEN_POWER_MODE_PAYLOAD_LENGTH = 1; - private static final int MESSAGE_MAX_SIZE = 4096; + private static final int MESSAGE_MAX_SIZE = 1 << 18; // 256k public static final int CLIPBOARD_TEXT_MAX_LENGTH = MESSAGE_MAX_SIZE - 5; // type: 1 byte; length: 4 bytes public static final int INJECT_TEXT_MAX_LENGTH = 300; diff --git a/server/src/main/java/com/genymobile/scrcpy/DeviceMessageWriter.java b/server/src/main/java/com/genymobile/scrcpy/DeviceMessageWriter.java index 2e12698f8b..15d91a35b7 100644 --- a/server/src/main/java/com/genymobile/scrcpy/DeviceMessageWriter.java +++ b/server/src/main/java/com/genymobile/scrcpy/DeviceMessageWriter.java @@ -7,7 +7,7 @@ public class DeviceMessageWriter { - private static final int MESSAGE_MAX_SIZE = 4096; + private static final int MESSAGE_MAX_SIZE = 1 << 18; // 256k public static final int CLIPBOARD_TEXT_MAX_LENGTH = MESSAGE_MAX_SIZE - 5; // type: 1 byte; length: 4 bytes private final byte[] rawBuffer = new byte[MESSAGE_MAX_SIZE];