From 2a02fb361117df105b7cbff60b907725b7aa3228 Mon Sep 17 00:00:00 2001 From: Romain Vimont Date: Wed, 28 Mar 2018 11:08:01 +0200 Subject: [PATCH 1/8] Document how to make a portable build on Windows On MSYS2, ./gradlew does not work as expected, so use its absolute path. --- Makefile | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Makefile b/Makefile index 523dccbd..79439f3d 100644 --- a/Makefile +++ b/Makefile @@ -9,6 +9,9 @@ # # "make release-portable" builds a zip containing the client and the server. # +# On Windows with MSYS2/mingw64, execute: +# GRADLE="$PWD/gradlew" mingw32-make release-portable +# # This is a simple Makefile because Meson is not flexible enough to execute some # arbitrary commands. From 6161f7688cc8467efa24ee4bdb170c2fcab6f534 Mon Sep 17 00:00:00 2001 From: Romain Vimont Date: Wed, 28 Mar 2018 14:10:55 +0200 Subject: [PATCH 2/8] Install on macOS via Homebrew in README The application is now packaged for Homebrew: Give instructions to install it from Homebrew for macOS (it's much easier). Thanks to @stek29 for the formula ;-) --- README.md | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 2cfc2301..47461c43 100644 --- a/README.md +++ b/README.md @@ -116,10 +116,17 @@ export PATH="$JAVA_HOME/bin:$PATH" #### Mac OS -Use [Homebrew] to install the packages: +The application is available in [Homebrew]. Just install it: [Homebrew]: https://brew.sh/ +```bash +brew install scrcpy +``` + +Instead, you may want to build it manually. Install the packages: + + ```bash # runtime dependencies brew install sdl2 ffmpeg From 16a3de17967d5673d98b5aeb702fc4d1911c1307 Mon Sep 17 00:00:00 2001 From: Romain Vimont Date: Wed, 28 Mar 2018 22:01:26 +0200 Subject: [PATCH 3/8] Make checkstyle happy Reorder the imports to remove checkstyle warnings. --- .../java/com/genymobile/scrcpy/ControlEventReaderTest.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/server/src/test/java/com/genymobile/scrcpy/ControlEventReaderTest.java b/server/src/test/java/com/genymobile/scrcpy/ControlEventReaderTest.java index d2b10ccb..3e97096f 100644 --- a/server/src/test/java/com/genymobile/scrcpy/ControlEventReaderTest.java +++ b/server/src/test/java/com/genymobile/scrcpy/ControlEventReaderTest.java @@ -3,6 +3,9 @@ package com.genymobile.scrcpy; import android.view.KeyEvent; import android.view.MotionEvent; +import org.junit.Assert; +import org.junit.Test; + import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.DataOutputStream; @@ -10,8 +13,6 @@ import java.io.IOException; import java.nio.charset.StandardCharsets; import java.util.Arrays; -import org.junit.Assert; -import org.junit.Test; public class ControlEventReaderTest { From 6323f3974ffb434940b48ba7f916f5398f1fcaba Mon Sep 17 00:00:00 2001 From: Romain Vimont Date: Sat, 31 Mar 2018 11:07:25 +0200 Subject: [PATCH 4/8] Document 32 bits packages Windows in README To build for Windows 32 bits, use the i686 packages instead. --- README.md | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/README.md b/README.md index 47461c43..0567c899 100644 --- a/README.md +++ b/README.md @@ -107,6 +107,20 @@ pacman -S mingw-w64-x86_64-make \ mingw-w64-x86_64-meson ``` +For a 32 bits version, replace `x86_64` by `i686`: + +```bash +# runtime dependencies +pacman -S mingw-w64-i686-SDL2 \ + mingw-w64-i686-ffmpeg + +# client build dependencies +pacman -S mingw-w64-i686-make \ + mingw-w64-i686-gcc \ + mingw-w64-i686-pkg-config \ + mingw-w64-i686-meson +``` + Java (>= 7) is not available in MSYS2, so if you plan to build the server, install it manually and make it available from the `PATH`: From b2b5404883a139b980707c9fc166a33b88689ffb Mon Sep 17 00:00:00 2001 From: Romain Vimont Date: Wed, 4 Apr 2018 10:42:13 +0200 Subject: [PATCH 5/8] Use const pointers when possible Sending data only require to read the input buffer, so declare it const. --- app/src/net.c | 4 ++-- app/src/net.h | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/src/net.c b/app/src/net.c index 1d68f068..b961c8eb 100644 --- a/app/src/net.c +++ b/app/src/net.c @@ -82,11 +82,11 @@ ssize_t net_recv_all(socket_t socket, void *buf, size_t len) { return recv(socket, buf, len, MSG_WAITALL); } -ssize_t net_send(socket_t socket, void *buf, size_t len) { +ssize_t net_send(socket_t socket, const void *buf, size_t len) { return send(socket, buf, len, 0); } -ssize_t net_send_all(socket_t socket, void *buf, size_t len) { +ssize_t net_send_all(socket_t socket, const void *buf, size_t len) { ssize_t w; while (len > 0) { w = send(socket, buf, len, 0); diff --git a/app/src/net.h b/app/src/net.h index d9a9269a..1be1e815 100644 --- a/app/src/net.h +++ b/app/src/net.h @@ -26,8 +26,8 @@ socket_t net_accept(socket_t server_socket); // the _all versions wait/retry until len bytes have been written/read ssize_t net_recv(socket_t socket, void *buf, size_t len); ssize_t net_recv_all(socket_t socket, void *buf, size_t len); -ssize_t net_send(socket_t socket, void *buf, size_t len); -ssize_t net_send_all(socket_t socket, void *buf, size_t len); +ssize_t net_send(socket_t socket, const void *buf, size_t len); +ssize_t net_send_all(socket_t socket, const void *buf, size_t len); // how is SHUT_RD (read), SHUT_WR (write) or SHUT_RDWR (both) SDL_bool net_shutdown(socket_t socket, int how); SDL_bool net_close(socket_t socket); From 0871bca9c72bf3e26dd7e75f72aa49644d1485b9 Mon Sep 17 00:00:00 2001 From: Romain Vimont Date: Wed, 4 Apr 2018 10:48:14 +0200 Subject: [PATCH 6/8] Avoid pointer arithmetic on "void *" MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fix the following warning (with -Wpedantic enabled): pointer of type ‘void *’ used in arithmetic [-Wpointer-arith] --- app/src/net.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/net.c b/app/src/net.c index b961c8eb..83aa7035 100644 --- a/app/src/net.c +++ b/app/src/net.c @@ -94,7 +94,7 @@ ssize_t net_send_all(socket_t socket, const void *buf, size_t len) { return -1; } len -= w; - buf += w; + buf = (char *) buf + w; } return w; } From f8ad7df3be5acea5ba0df740b4d3110412bddcfe Mon Sep 17 00:00:00 2001 From: Romain Vimont Date: Thu, 5 Apr 2018 02:03:26 +0200 Subject: [PATCH 7/8] Add FAQ section about KWin crash Link to the workaround to keep the compositor enabled while _scrcpy_ is running. --- FAQ.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/FAQ.md b/FAQ.md index 4447dfec..09279a6c 100644 --- a/FAQ.md +++ b/FAQ.md @@ -79,3 +79,12 @@ meson x --buildtype release -Dhidpi_support=false ``` However, the video will be displayed at lower resolution. + + +### KWin compositor crashes + +On Plasma Desktop, compositor is disabled while _scrcpy_ is running. + +As a workaround, [disable "Block compositing"][kwin]. + +[kwin]: https://github.com/Genymobile/scrcpy/issues/114#issuecomment-378778613 From 9aa88b6fc3724851c5728093b11eb8f1464a6e95 Mon Sep 17 00:00:00 2001 From: Romain Vimont Date: Sun, 8 Apr 2018 12:38:06 +0200 Subject: [PATCH 8/8] Map numpad ENTER key Forward numpad ENTER key to the device. Fixes . --- app/src/convert.c | 1 + 1 file changed, 1 insertion(+) diff --git a/app/src/convert.c b/app/src/convert.c index d5e75195..9d947cb3 100644 --- a/app/src/convert.c +++ b/app/src/convert.c @@ -73,6 +73,7 @@ static enum android_metastate convert_meta_state(SDL_Keymod mod) { static SDL_bool convert_keycode(SDL_Keycode from, enum android_keycode *to) { switch (from) { MAP(SDLK_RETURN, AKEYCODE_ENTER); + MAP(SDLK_KP_ENTER, AKEYCODE_NUMPAD_ENTER); MAP(SDLK_ESCAPE, AKEYCODE_ESCAPE); MAP(SDLK_BACKSPACE, AKEYCODE_DEL); MAP(SDLK_TAB, AKEYCODE_TAB);