Compare commits
2 Commits
v1.4
...
logicalsca
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e3a07c3309 | ||
|
|
2e40285244 |
236
BUILD.md
236
BUILD.md
@@ -1,236 +0,0 @@
|
|||||||
# Build scrcpy
|
|
||||||
|
|
||||||
Here are the instructions to build _scrcpy_ (client and server).
|
|
||||||
|
|
||||||
You may want to build only the client: the server binary, which will be pushed
|
|
||||||
to the Android device, does not depend on your system and architecture. In that
|
|
||||||
case, use the [prebuilt server] (so you will not need Java or the Android SDK).
|
|
||||||
|
|
||||||
[prebuilt server]: #prebuilt-server
|
|
||||||
|
|
||||||
|
|
||||||
## Requirements
|
|
||||||
|
|
||||||
You need [adb]. It is available in the [Android SDK platform
|
|
||||||
tools][platform-tools], or packaged in your distribution (`android-adb-tools`).
|
|
||||||
|
|
||||||
On Windows, download the [platform-tools][platform-tools-windows] and extract
|
|
||||||
the following files to a directory accessible from your `PATH`:
|
|
||||||
- `adb.exe`
|
|
||||||
- `AdbWinApi.dll`
|
|
||||||
- `AdbWinUsbApi.dll`
|
|
||||||
|
|
||||||
The client requires [FFmpeg] and [LibSDL2]. Just follow the instructions.
|
|
||||||
|
|
||||||
[adb]: https://developer.android.com/studio/command-line/adb.html
|
|
||||||
[platform-tools]: https://developer.android.com/studio/releases/platform-tools.html
|
|
||||||
[platform-tools-windows]: https://dl.google.com/android/repository/platform-tools-latest-windows.zip
|
|
||||||
[ffmpeg]: https://en.wikipedia.org/wiki/FFmpeg
|
|
||||||
[LibSDL2]: https://en.wikipedia.org/wiki/Simple_DirectMedia_Layer
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## System-specific steps
|
|
||||||
|
|
||||||
### Linux
|
|
||||||
|
|
||||||
Install the required packages from your package manager.
|
|
||||||
|
|
||||||
#### Debian/Ubuntu
|
|
||||||
|
|
||||||
```bash
|
|
||||||
# runtime dependencies
|
|
||||||
sudo apt install ffmpeg libsdl2-2.0.0
|
|
||||||
|
|
||||||
# client build dependencies
|
|
||||||
sudo apt install make gcc pkg-config meson \
|
|
||||||
libavcodec-dev libavformat-dev libavutil-dev \
|
|
||||||
libsdl2-dev
|
|
||||||
|
|
||||||
# server build dependencies
|
|
||||||
sudo apt install openjdk-8-jdk
|
|
||||||
```
|
|
||||||
|
|
||||||
#### Fedora
|
|
||||||
|
|
||||||
```bash
|
|
||||||
# enable RPM fusion free
|
|
||||||
sudo dnf install https://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-$(rpm -E %fedora).noarch.rpm
|
|
||||||
|
|
||||||
# client build dependencies
|
|
||||||
sudo dnf install SDL2-devel ffms2-devel meson gcc make
|
|
||||||
|
|
||||||
# server build dependencies
|
|
||||||
sudo dnf install java
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### Windows
|
|
||||||
|
|
||||||
#### Cross-compile from Linux
|
|
||||||
|
|
||||||
This is the preferred method (and the way the release is built).
|
|
||||||
|
|
||||||
From _Debian_, install _mingw_:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
sudo apt install mingw-w64 mingw-w64-tools
|
|
||||||
```
|
|
||||||
|
|
||||||
You also need the JDK to build the server:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
sudo apt install openjdk-8-jdk
|
|
||||||
```
|
|
||||||
|
|
||||||
Then generate the releases:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
make -f Makefile.CrossWindows
|
|
||||||
```
|
|
||||||
|
|
||||||
It will generate win32 and win64 releases into `dist/`.
|
|
||||||
|
|
||||||
|
|
||||||
#### In MSYS2
|
|
||||||
|
|
||||||
From Windows, you need [MSYS2] to build the project. From an MSYS2 terminal,
|
|
||||||
install the required packages:
|
|
||||||
|
|
||||||
[MSYS2]: http://www.msys2.org/
|
|
||||||
|
|
||||||
```bash
|
|
||||||
# runtime dependencies
|
|
||||||
pacman -S mingw-w64-x86_64-SDL2 \
|
|
||||||
mingw-w64-x86_64-ffmpeg
|
|
||||||
|
|
||||||
# client build dependencies
|
|
||||||
pacman -S mingw-w64-x86_64-make \
|
|
||||||
mingw-w64-x86_64-gcc \
|
|
||||||
mingw-w64-x86_64-pkg-config \
|
|
||||||
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`:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
export PATH="$JAVA_HOME/bin:$PATH"
|
|
||||||
```
|
|
||||||
|
|
||||||
### Mac OS
|
|
||||||
|
|
||||||
Install the packages with [Homebrew]:
|
|
||||||
|
|
||||||
[Homebrew]: https://brew.sh/
|
|
||||||
|
|
||||||
```bash
|
|
||||||
# runtime dependencies
|
|
||||||
brew install sdl2 ffmpeg
|
|
||||||
|
|
||||||
# client build dependencies
|
|
||||||
brew install pkg-config meson
|
|
||||||
```
|
|
||||||
|
|
||||||
Additionally, if you want to build the server, install Java 8 from Caskroom, and
|
|
||||||
make it avaliable from the `PATH`:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
brew tap caskroom/versions
|
|
||||||
brew cask install java8
|
|
||||||
export JAVA_HOME="$(/usr/libexec/java_home --version 1.8)"
|
|
||||||
export PATH="$JAVA_HOME/bin:$PATH"
|
|
||||||
```
|
|
||||||
|
|
||||||
### Docker
|
|
||||||
|
|
||||||
See [pierlon/scrcpy-docker](https://github.com/pierlon/scrcpy-docker).
|
|
||||||
|
|
||||||
|
|
||||||
## Common steps
|
|
||||||
|
|
||||||
If you want to build the server, install the [Android SDK] (_Android Studio_),
|
|
||||||
and set `ANDROID_HOME` to its directory. For example:
|
|
||||||
|
|
||||||
[Android SDK]: https://developer.android.com/studio/index.html
|
|
||||||
|
|
||||||
```bash
|
|
||||||
export ANDROID_HOME=~/android/sdk
|
|
||||||
```
|
|
||||||
|
|
||||||
If you don't want to build the server, use the [prebuilt server].
|
|
||||||
|
|
||||||
Clone the project:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
git clone https://github.com/Genymobile/scrcpy
|
|
||||||
cd scrcpy
|
|
||||||
```
|
|
||||||
|
|
||||||
Then, build:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
meson x --buildtype release --strip -Db_lto=true
|
|
||||||
cd x
|
|
||||||
ninja
|
|
||||||
```
|
|
||||||
|
|
||||||
### Run
|
|
||||||
|
|
||||||
To run without installing:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
./run x [options]
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
### Install
|
|
||||||
|
|
||||||
After a successful build, you can install _scrcpy_ on the system:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
sudo ninja install # without sudo on Windows
|
|
||||||
```
|
|
||||||
|
|
||||||
This installs two files:
|
|
||||||
|
|
||||||
- `/usr/local/bin/scrcpy`
|
|
||||||
- `/usr/local/share/scrcpy/scrcpy-server.jar`
|
|
||||||
|
|
||||||
Just remove them to "uninstall" the application.
|
|
||||||
|
|
||||||
You can then [run](README.md#run) _scrcpy_.
|
|
||||||
|
|
||||||
|
|
||||||
## Prebuilt server
|
|
||||||
|
|
||||||
- [`scrcpy-server-v1.3.jar`][direct-scrcpy-server].
|
|
||||||
_(SHA-256: 0f9a5a217f33f0ed7a1498ceb3c0cccf31c53533893aa952e674c1571d2740c1)_
|
|
||||||
|
|
||||||
[direct-scrcpy-server]: https://github.com/Genymobile/scrcpy/releases/download/v1.3/scrcpy-server-v1.3.jar
|
|
||||||
|
|
||||||
Download the prebuilt server somewhere, and specify its path during the Meson
|
|
||||||
configuration:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
meson x --buildtype release --strip -Db_lto=true \
|
|
||||||
-Dprebuilt_server=/path/to/scrcpy-server.jar
|
|
||||||
cd x
|
|
||||||
ninja
|
|
||||||
sudo ninja install
|
|
||||||
```
|
|
||||||
3
FAQ.md
3
FAQ.md
@@ -26,11 +26,10 @@ If you still encounter problems, please see [issue 9].
|
|||||||
|
|
||||||
### I get a black screen for some applications like Silence
|
### I get a black screen for some applications like Silence
|
||||||
|
|
||||||
This is expected, they requested to [protect] the screen.
|
This is expected, they requested to protect the screen.
|
||||||
|
|
||||||
In [Silence], you can disable it in settings → Privacy → Screen security.
|
In [Silence], you can disable it in settings → Privacy → Screen security.
|
||||||
|
|
||||||
[protect]: https://developer.android.com/reference/android/view/Display#FLAG_SECURE
|
|
||||||
[silence]: https://f-droid.org/en/packages/org.smssecure.smssecure/
|
[silence]: https://f-droid.org/en/packages/org.smssecure.smssecure/
|
||||||
|
|
||||||
See [issue 36].
|
See [issue 36].
|
||||||
|
|||||||
245
README.md
245
README.md
@@ -11,33 +11,70 @@ It works on _GNU/Linux_, _Windows_ and _MacOS_.
|
|||||||
|
|
||||||
The Android part requires at least API 21 (Android 5.0).
|
The Android part requires at least API 21 (Android 5.0).
|
||||||
|
|
||||||
|
You need [adb]. It is available in the [Android SDK platform
|
||||||
|
tools][platform-tools], or packaged in your distribution (`android-adb-tools`).
|
||||||
|
|
||||||
|
On Windows, just [download scrcpy for Windows](#windows), `adb` is included.
|
||||||
|
|
||||||
Make sure you [enabled adb debugging][enable-adb] on your device(s).
|
Make sure you [enabled adb debugging][enable-adb] on your device(s).
|
||||||
|
|
||||||
|
The client requires [FFmpeg] and [LibSDL2]. On Windows, they are included in the
|
||||||
|
[prebuilt application](#windows).
|
||||||
|
|
||||||
|
[adb]: https://developer.android.com/studio/command-line/adb.html
|
||||||
[enable-adb]: https://developer.android.com/studio/command-line/adb.html#Enabling
|
[enable-adb]: https://developer.android.com/studio/command-line/adb.html#Enabling
|
||||||
|
[platform-tools]: https://developer.android.com/studio/releases/platform-tools.html
|
||||||
|
[platform-tools-windows]: https://dl.google.com/android/repository/platform-tools-latest-windows.zip
|
||||||
|
[ffmpeg]: https://en.wikipedia.org/wiki/FFmpeg
|
||||||
|
[LibSDL2]: https://en.wikipedia.org/wiki/Simple_DirectMedia_Layer
|
||||||
|
|
||||||
|
## Build and install
|
||||||
|
|
||||||
## Get the app
|
### System-specific steps
|
||||||
|
|
||||||
|
#### Linux
|
||||||
|
|
||||||
### Linux
|
Install the required packages from your package manager.
|
||||||
|
|
||||||
On Linux, you typically need to [build the app manually][BUILD]. Don't worry,
|
##### Debian/Ubuntu
|
||||||
it's not that hard.
|
|
||||||
|
|
||||||
For Arch Linux, two [AUR] packages have been created by users:
|
```bash
|
||||||
|
# runtime dependencies
|
||||||
|
sudo apt install ffmpeg libsdl2-2.0.0
|
||||||
|
|
||||||
|
# client build dependencies
|
||||||
|
sudo apt install make gcc pkg-config meson \
|
||||||
|
libavcodec-dev libavformat-dev libavutil-dev \
|
||||||
|
libsdl2-dev
|
||||||
|
|
||||||
|
# server build dependencies
|
||||||
|
sudo apt install openjdk-8-jdk
|
||||||
|
```
|
||||||
|
|
||||||
|
##### Fedora
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# enable RPM fusion free
|
||||||
|
sudo dnf install https://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-$(rpm -E %fedora).noarch.rpm
|
||||||
|
|
||||||
|
# client build dependencies
|
||||||
|
sudo dnf install SDL2-devel ffms2-devel meson gcc make
|
||||||
|
|
||||||
|
# server build dependencies
|
||||||
|
sudo dnf install java
|
||||||
|
```
|
||||||
|
|
||||||
|
##### Arch Linux
|
||||||
|
|
||||||
|
Two [AUR] packages have been created by users:
|
||||||
|
|
||||||
- [`scrcpy`](https://aur.archlinux.org/packages/scrcpy/)
|
- [`scrcpy`](https://aur.archlinux.org/packages/scrcpy/)
|
||||||
- [`scrcpy-prebuiltserver`](https://aur.archlinux.org/packages/scrcpy-prebuiltserver/)
|
- [`scrcpy-prebuiltserver`](https://aur.archlinux.org/packages/scrcpy-prebuiltserver/)
|
||||||
|
|
||||||
[AUR]: https://wiki.archlinux.org/index.php/Arch_User_Repository
|
[AUR]: https://wiki.archlinux.org/index.php/Arch_User_Repository
|
||||||
|
|
||||||
For Gentoo, an [Ebuild] is available: [`scrcpy/`][ebuild-link].
|
|
||||||
|
|
||||||
[Ebuild]: https://wiki.gentoo.org/wiki/Ebuild
|
#### Windows
|
||||||
[ebuild-link]: https://github.com/maggu2810/maggu2810-overlay/tree/master/app-mobilephone/scrcpy
|
|
||||||
|
|
||||||
|
|
||||||
### Windows
|
|
||||||
|
|
||||||
For Windows, for simplicity, prebuilt archives with all the dependencies
|
For Windows, for simplicity, prebuilt archives with all the dependencies
|
||||||
(including `adb`) are available:
|
(including `adb`) are available:
|
||||||
@@ -50,10 +87,80 @@ For Windows, for simplicity, prebuilt archives with all the dependencies
|
|||||||
[direct-win32]: https://github.com/Genymobile/scrcpy/releases/download/v1.3/scrcpy-win32-v1.3.zip
|
[direct-win32]: https://github.com/Genymobile/scrcpy/releases/download/v1.3/scrcpy-win32-v1.3.zip
|
||||||
[direct-win64]: https://github.com/Genymobile/scrcpy/releases/download/v1.3/scrcpy-win64-v1.3.zip
|
[direct-win64]: https://github.com/Genymobile/scrcpy/releases/download/v1.3/scrcpy-win64-v1.3.zip
|
||||||
|
|
||||||
You can also [build the app manually][BUILD].
|
Instead, you may want to build it manually.
|
||||||
|
|
||||||
|
In that case, download the [platform-tools][platform-tools-windows] and extract
|
||||||
|
the following files to a directory accessible from your `PATH`:
|
||||||
|
- `adb.exe`
|
||||||
|
- `AdbWinApi.dll`
|
||||||
|
- `AdbWinUsbApi.dll`
|
||||||
|
|
||||||
|
##### Cross-compile from Linux
|
||||||
|
|
||||||
|
This is the preferred method (and the way the release is built).
|
||||||
|
|
||||||
|
From _Debian_, install _mingw_:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
sudo apt install mingw-w64 mingw-w64-tools
|
||||||
|
```
|
||||||
|
|
||||||
|
You also need the JDK to build the server:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
sudo apt install openjdk-8-jdk
|
||||||
|
```
|
||||||
|
|
||||||
|
Then generate the releases:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
make -f Makefile.CrossWindows
|
||||||
|
```
|
||||||
|
|
||||||
|
It will generate win32 and win64 releases into `dist/`.
|
||||||
|
|
||||||
|
|
||||||
### Mac OS
|
##### In MSYS2
|
||||||
|
|
||||||
|
From Windows, you need [MSYS2] to build the project. From an MSYS2 terminal,
|
||||||
|
install the required packages:
|
||||||
|
|
||||||
|
[MSYS2]: http://www.msys2.org/
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# runtime dependencies
|
||||||
|
pacman -S mingw-w64-x86_64-SDL2 \
|
||||||
|
mingw-w64-x86_64-ffmpeg
|
||||||
|
|
||||||
|
# client build dependencies
|
||||||
|
pacman -S mingw-w64-x86_64-make \
|
||||||
|
mingw-w64-x86_64-gcc \
|
||||||
|
mingw-w64-x86_64-pkg-config \
|
||||||
|
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`:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
export PATH="$JAVA_HOME/bin:$PATH"
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Mac OS
|
||||||
|
|
||||||
The application is available in [Homebrew]. Just install it:
|
The application is available in [Homebrew]. Just install it:
|
||||||
|
|
||||||
@@ -63,18 +170,106 @@ The application is available in [Homebrew]. Just install it:
|
|||||||
brew install scrcpy
|
brew install scrcpy
|
||||||
```
|
```
|
||||||
|
|
||||||
You need `adb`, accessible from your `PATH`. If you don't have it yet:
|
Instead, you may want to build it manually. Install the packages:
|
||||||
|
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
brew cask install android-platform-tools
|
# runtime dependencies
|
||||||
|
brew install sdl2 ffmpeg
|
||||||
|
|
||||||
|
# client build dependencies
|
||||||
|
brew install pkg-config meson
|
||||||
```
|
```
|
||||||
|
|
||||||
You can also [build the app manually][BUILD].
|
Additionally, if you want to build the server, install Java 8 from Caskroom, and
|
||||||
|
make it avaliable from the `PATH`:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
brew tap caskroom/versions
|
||||||
|
brew cask install java8
|
||||||
|
export JAVA_HOME="$(/usr/libexec/java_home --version 1.8)"
|
||||||
|
export PATH="$JAVA_HOME/bin:$PATH"
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Docker
|
||||||
|
|
||||||
|
See [pierlon/scrcpy-docker](https://github.com/pierlon/scrcpy-docker).
|
||||||
|
|
||||||
|
### Common steps
|
||||||
|
|
||||||
|
Install the [Android SDK] (_Android Studio_), and set `ANDROID_HOME` to
|
||||||
|
its directory. For example:
|
||||||
|
|
||||||
|
[Android SDK]: https://developer.android.com/studio/index.html
|
||||||
|
|
||||||
|
```bash
|
||||||
|
export ANDROID_HOME=~/android/sdk
|
||||||
|
```
|
||||||
|
|
||||||
|
Clone the project:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
git clone https://github.com/Genymobile/scrcpy
|
||||||
|
cd scrcpy
|
||||||
|
```
|
||||||
|
|
||||||
|
Then, build:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
meson x --buildtype release --strip -Db_lto=true
|
||||||
|
cd x
|
||||||
|
ninja
|
||||||
|
```
|
||||||
|
|
||||||
|
You can test it from here:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
ninja run
|
||||||
|
```
|
||||||
|
|
||||||
|
Or you can install it on the system:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
sudo ninja install # without sudo on Windows
|
||||||
|
```
|
||||||
|
|
||||||
|
This installs two files:
|
||||||
|
|
||||||
|
- `/usr/local/bin/scrcpy`
|
||||||
|
- `/usr/local/share/scrcpy/scrcpy-server.jar`
|
||||||
|
|
||||||
|
Just remove them to "uninstall" the application.
|
||||||
|
|
||||||
|
|
||||||
|
#### Prebuilt server
|
||||||
|
|
||||||
|
Since the server binary, that will be pushed to the Android device, does not
|
||||||
|
depend on your system and architecture, you may want to use the prebuilt binary
|
||||||
|
instead:
|
||||||
|
|
||||||
|
- [`scrcpy-server-v1.3.jar`][direct-scrcpy-server].
|
||||||
|
_(SHA-256: 0f9a5a217f33f0ed7a1498ceb3c0cccf31c53533893aa952e674c1571d2740c1)_
|
||||||
|
|
||||||
|
[direct-scrcpy-server]: https://github.com/Genymobile/scrcpy/releases/download/v1.3/scrcpy-server-v1.3.jar
|
||||||
|
|
||||||
|
In that case, the build does not require Java or the Android SDK.
|
||||||
|
|
||||||
|
Download the prebuilt server somewhere, and specify its path during the Meson
|
||||||
|
configuration:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
meson x --buildtype release --strip -Db_lto=true \
|
||||||
|
-Dprebuilt_server=/path/to/scrcpy-server.jar
|
||||||
|
cd x
|
||||||
|
ninja
|
||||||
|
sudo ninja install
|
||||||
|
```
|
||||||
|
|
||||||
## Run
|
## Run
|
||||||
|
|
||||||
Plug an Android device, and execute:
|
_At runtime, `adb` must be accessible from your `PATH`._
|
||||||
|
|
||||||
|
If everything is ok, just plug an Android device, and execute:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
scrcpy
|
scrcpy
|
||||||
@@ -123,6 +318,15 @@ The app may be started directly in fullscreen:
|
|||||||
scrcpy -f
|
scrcpy -f
|
||||||
```
|
```
|
||||||
|
|
||||||
|
To run without installing:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
./run x [options]
|
||||||
|
```
|
||||||
|
|
||||||
|
(where `x` is your build directory).
|
||||||
|
|
||||||
|
|
||||||
## Shortcuts
|
## Shortcuts
|
||||||
|
|
||||||
| Action | Shortcut |
|
| Action | Shortcut |
|
||||||
@@ -157,13 +361,6 @@ A colleague challenged me to find a name as unpronounceable as [gnirehtet].
|
|||||||
[`strcpy`]: http://man7.org/linux/man-pages/man3/strcpy.3.html
|
[`strcpy`]: http://man7.org/linux/man-pages/man3/strcpy.3.html
|
||||||
|
|
||||||
|
|
||||||
## How to build?
|
|
||||||
|
|
||||||
See [BUILD].
|
|
||||||
|
|
||||||
[BUILD]: BUILD.md
|
|
||||||
|
|
||||||
|
|
||||||
## Common issues
|
## Common issues
|
||||||
|
|
||||||
See the [FAQ](FAQ.md).
|
See the [FAQ](FAQ.md).
|
||||||
|
|||||||
@@ -85,7 +85,7 @@ conf = configuration_data()
|
|||||||
conf.set('BUILD_DEBUG', get_option('buildtype') == 'debug')
|
conf.set('BUILD_DEBUG', get_option('buildtype') == 'debug')
|
||||||
|
|
||||||
# the version, updated on release
|
# the version, updated on release
|
||||||
conf.set_quoted('SCRCPY_VERSION', '1.4')
|
conf.set_quoted('SCRCPY_VERSION', '1.3')
|
||||||
|
|
||||||
# the prefix used during configuration (meson --prefix=PREFIX)
|
# the prefix used during configuration (meson --prefix=PREFIX)
|
||||||
conf.set_quoted('PREFIX', get_option('prefix'))
|
conf.set_quoted('PREFIX', get_option('prefix'))
|
||||||
|
|||||||
@@ -70,7 +70,7 @@ static enum android_metastate convert_meta_state(SDL_Keymod mod) {
|
|||||||
return autocomplete_metastate(metastate);
|
return autocomplete_metastate(metastate);
|
||||||
}
|
}
|
||||||
|
|
||||||
static SDL_bool convert_keycode(SDL_Keycode from, enum android_keycode *to, Uint16 mod) {
|
static SDL_bool convert_keycode(SDL_Keycode from, enum android_keycode *to) {
|
||||||
switch (from) {
|
switch (from) {
|
||||||
MAP(SDLK_RETURN, AKEYCODE_ENTER);
|
MAP(SDLK_RETURN, AKEYCODE_ENTER);
|
||||||
MAP(SDLK_KP_ENTER, AKEYCODE_NUMPAD_ENTER);
|
MAP(SDLK_KP_ENTER, AKEYCODE_NUMPAD_ENTER);
|
||||||
@@ -86,39 +86,6 @@ static SDL_bool convert_keycode(SDL_Keycode from, enum android_keycode *to, Uint
|
|||||||
MAP(SDLK_LEFT, AKEYCODE_DPAD_LEFT);
|
MAP(SDLK_LEFT, AKEYCODE_DPAD_LEFT);
|
||||||
MAP(SDLK_DOWN, AKEYCODE_DPAD_DOWN);
|
MAP(SDLK_DOWN, AKEYCODE_DPAD_DOWN);
|
||||||
MAP(SDLK_UP, AKEYCODE_DPAD_UP);
|
MAP(SDLK_UP, AKEYCODE_DPAD_UP);
|
||||||
}
|
|
||||||
if (mod & (KMOD_LALT | KMOD_RALT | KMOD_LGUI | KMOD_RGUI)) {
|
|
||||||
return SDL_FALSE;
|
|
||||||
}
|
|
||||||
// if ALT and META are not pressed, also handle letters and space
|
|
||||||
switch (from) {
|
|
||||||
MAP(SDLK_a, AKEYCODE_A);
|
|
||||||
MAP(SDLK_b, AKEYCODE_B);
|
|
||||||
MAP(SDLK_c, AKEYCODE_C);
|
|
||||||
MAP(SDLK_d, AKEYCODE_D);
|
|
||||||
MAP(SDLK_e, AKEYCODE_E);
|
|
||||||
MAP(SDLK_f, AKEYCODE_F);
|
|
||||||
MAP(SDLK_g, AKEYCODE_G);
|
|
||||||
MAP(SDLK_h, AKEYCODE_H);
|
|
||||||
MAP(SDLK_i, AKEYCODE_I);
|
|
||||||
MAP(SDLK_j, AKEYCODE_J);
|
|
||||||
MAP(SDLK_k, AKEYCODE_K);
|
|
||||||
MAP(SDLK_l, AKEYCODE_L);
|
|
||||||
MAP(SDLK_m, AKEYCODE_M);
|
|
||||||
MAP(SDLK_n, AKEYCODE_N);
|
|
||||||
MAP(SDLK_o, AKEYCODE_O);
|
|
||||||
MAP(SDLK_p, AKEYCODE_P);
|
|
||||||
MAP(SDLK_q, AKEYCODE_Q);
|
|
||||||
MAP(SDLK_r, AKEYCODE_R);
|
|
||||||
MAP(SDLK_s, AKEYCODE_S);
|
|
||||||
MAP(SDLK_t, AKEYCODE_T);
|
|
||||||
MAP(SDLK_u, AKEYCODE_U);
|
|
||||||
MAP(SDLK_v, AKEYCODE_V);
|
|
||||||
MAP(SDLK_w, AKEYCODE_W);
|
|
||||||
MAP(SDLK_x, AKEYCODE_X);
|
|
||||||
MAP(SDLK_y, AKEYCODE_Y);
|
|
||||||
MAP(SDLK_z, AKEYCODE_Z);
|
|
||||||
MAP(SDLK_SPACE, AKEYCODE_SPACE);
|
|
||||||
FAIL;
|
FAIL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -159,12 +126,11 @@ SDL_bool input_key_from_sdl_to_android(const SDL_KeyboardEvent *from,
|
|||||||
return SDL_FALSE;
|
return SDL_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
Uint16 mod = from->keysym.mod;
|
if (!convert_keycode(from->keysym.sym, &to->keycode_event.keycode)) {
|
||||||
if (!convert_keycode(from->keysym.sym, &to->keycode_event.keycode, mod)) {
|
|
||||||
return SDL_FALSE;
|
return SDL_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
to->keycode_event.metastate = convert_meta_state(mod);
|
to->keycode_event.metastate = convert_meta_state(from->keysym.mod);
|
||||||
|
|
||||||
return SDL_TRUE;
|
return SDL_TRUE;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
#include "input_manager.h"
|
#include "input_manager.h"
|
||||||
|
|
||||||
#include <SDL2/SDL_assert.h>
|
|
||||||
#include "convert.h"
|
#include "convert.h"
|
||||||
#include "lock_util.h"
|
#include "lock_util.h"
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
@@ -130,12 +129,6 @@ static void clipboard_paste(struct controller *controller) {
|
|||||||
|
|
||||||
void input_manager_process_text_input(struct input_manager *input_manager,
|
void input_manager_process_text_input(struct input_manager *input_manager,
|
||||||
const SDL_TextInputEvent *event) {
|
const SDL_TextInputEvent *event) {
|
||||||
char c = event->text[0];
|
|
||||||
if (isalpha(c) || c == ' ') {
|
|
||||||
SDL_assert(event->text[1] == '\0');
|
|
||||||
// letters and space are handled as raw key event
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
struct control_event control_event;
|
struct control_event control_event;
|
||||||
control_event.type = CONTROL_EVENT_TYPE_TEXT;
|
control_event.type = CONTROL_EVENT_TYPE_TEXT;
|
||||||
control_event.text_event.text = SDL_strdup(event->text);
|
control_event.text_event.text = SDL_strdup(event->text);
|
||||||
|
|||||||
@@ -319,11 +319,5 @@ int main(int argc, char *argv[]) {
|
|||||||
|
|
||||||
avformat_network_deinit(); // ignore failure
|
avformat_network_deinit(); // ignore failure
|
||||||
|
|
||||||
#if defined (__WINDOWS__) && ! defined (WINDOWS_NOCONSOLE)
|
|
||||||
if (res != 0) {
|
|
||||||
fprintf(stderr, "Press any key to continue...\n");
|
|
||||||
getchar();
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -88,6 +88,7 @@ static SDL_bool event_loop(void) {
|
|||||||
switch (event.window.event) {
|
switch (event.window.event) {
|
||||||
case SDL_WINDOWEVENT_EXPOSED:
|
case SDL_WINDOWEVENT_EXPOSED:
|
||||||
case SDL_WINDOWEVENT_SIZE_CHANGED:
|
case SDL_WINDOWEVENT_SIZE_CHANGED:
|
||||||
|
screen_update_scale(&screen);
|
||||||
screen_render(&screen);
|
screen_render(&screen);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -132,6 +132,17 @@ static inline struct size get_initial_optimal_size(struct size frame_size) {
|
|||||||
return get_optimal_size(frame_size, frame_size);
|
return get_optimal_size(frame_size, frame_size);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// apply hidpi scaling and call SDL_RenderSetLogicalSize
|
||||||
|
static inline SDL_bool render_set_scaled_logical_size(struct screen *screen, struct size size) {
|
||||||
|
int w, h, dw, dh;
|
||||||
|
SDL_GL_GetDrawableSize(screen->window, &w, &h);
|
||||||
|
SDL_GetWindowSize(screen->window, &dw, &dh);
|
||||||
|
// use 32 bits unsigned not to lose precision (width and height fit in 16 bits)
|
||||||
|
int scaled_x = (Uint32) size.width * (Uint32) w / (Uint32) dw;
|
||||||
|
int scaled_y = (Uint32) size.height * (Uint32) h / (Uint32) dh;
|
||||||
|
return SDL_RenderSetLogicalSize(screen->renderer, scaled_x, scaled_y);
|
||||||
|
}
|
||||||
|
|
||||||
void screen_init(struct screen *screen) {
|
void screen_init(struct screen *screen) {
|
||||||
*screen = (struct screen) SCREEN_INITIALIZER;
|
*screen = (struct screen) SCREEN_INITIALIZER;
|
||||||
}
|
}
|
||||||
@@ -163,7 +174,7 @@ SDL_bool screen_init_rendering(struct screen *screen, const char *device_name, s
|
|||||||
return SDL_FALSE;
|
return SDL_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (SDL_RenderSetLogicalSize(screen->renderer, frame_size.width, frame_size.height)) {
|
if (render_set_scaled_logical_size(screen, frame_size)) {
|
||||||
LOGE("Could not set renderer logical size: %s", SDL_GetError());
|
LOGE("Could not set renderer logical size: %s", SDL_GetError());
|
||||||
screen_destroy(screen);
|
screen_destroy(screen);
|
||||||
return SDL_FALSE;
|
return SDL_FALSE;
|
||||||
@@ -208,7 +219,7 @@ void screen_destroy(struct screen *screen) {
|
|||||||
// recreate the texture and resize the window if the frame size has changed
|
// recreate the texture and resize the window if the frame size has changed
|
||||||
static SDL_bool prepare_for_frame(struct screen *screen, struct size new_frame_size) {
|
static SDL_bool prepare_for_frame(struct screen *screen, struct size new_frame_size) {
|
||||||
if (screen->frame_size.width != new_frame_size.width || screen->frame_size.height != new_frame_size.height) {
|
if (screen->frame_size.width != new_frame_size.width || screen->frame_size.height != new_frame_size.height) {
|
||||||
if (SDL_RenderSetLogicalSize(screen->renderer, new_frame_size.width, new_frame_size.height)) {
|
if (render_set_scaled_logical_size(screen, new_frame_size)) {
|
||||||
LOGE("Could not set renderer logical size: %s", SDL_GetError());
|
LOGE("Could not set renderer logical size: %s", SDL_GetError());
|
||||||
return SDL_FALSE;
|
return SDL_FALSE;
|
||||||
}
|
}
|
||||||
@@ -302,3 +313,7 @@ void screen_resize_to_pixel_perfect(struct screen *screen) {
|
|||||||
LOGD("Resized to pixel-perfect");
|
LOGD("Resized to pixel-perfect");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void screen_update_scale(struct screen *screen) {
|
||||||
|
render_set_scaled_logical_size(screen, screen->frame_size);
|
||||||
|
}
|
||||||
|
|||||||
@@ -66,4 +66,8 @@ void screen_resize_to_fit(struct screen *screen);
|
|||||||
// resize window to 1:1 (pixel-perfect)
|
// resize window to 1:1 (pixel-perfect)
|
||||||
void screen_resize_to_pixel_perfect(struct screen *screen);
|
void screen_resize_to_pixel_perfect(struct screen *screen);
|
||||||
|
|
||||||
|
// recompute the scale in case the window moved from/to another screen with a
|
||||||
|
// different HiDPI
|
||||||
|
void screen_update_scale(struct screen *screen);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -35,6 +35,6 @@ prepare-sdl2:
|
|||||||
SDL2-2.0.8
|
SDL2-2.0.8
|
||||||
|
|
||||||
prepare-adb:
|
prepare-adb:
|
||||||
@./prepare-dep https://dl.google.com/android/repository/platform-tools_r28.0.1-windows.zip \
|
@./prepare-dep https://dl.google.com/android/repository/platform-tools_r28.0.0-windows.zip \
|
||||||
db78f726d5dc653706dcd15a462ab1b946c643f598df76906c4c1858411c54df \
|
e2c1ec7c8e9b71cf1c8befd3bff91d06b26dd334c3f32b3817e9d46ba260b0e8 \
|
||||||
platform-tools
|
platform-tools
|
||||||
|
|||||||
@@ -6,8 +6,8 @@ android {
|
|||||||
applicationId "com.genymobile.scrcpy"
|
applicationId "com.genymobile.scrcpy"
|
||||||
minSdkVersion 21
|
minSdkVersion 21
|
||||||
targetSdkVersion 27
|
targetSdkVersion 27
|
||||||
versionCode 5
|
versionCode 4
|
||||||
versionName "1.4"
|
versionName "1.3"
|
||||||
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
|
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
|
||||||
}
|
}
|
||||||
buildTypes {
|
buildTypes {
|
||||||
|
|||||||
Reference in New Issue
Block a user