Commit graph

1922 commits

Author SHA1 Message Date
Romain Vimont
270d0bf639 Rename max length constant for text injection
To avoid confusion with the max text size for clipboard, rename the
constant limiting the text injection length.
2020-04-13 19:38:43 +02:00
Romain Vimont
95fa1a69e4 Workaround compiler warning
Some compilers warns on uninitialized value in impossible case:

    warning: variable 'result' is used uninitialized whenever switch
    default is taken [-Wsometimes-uninitialized]
2020-04-13 16:33:21 +02:00
Romain Vimont
ea46d3ab68 Add missing include string.h
Include <string.h> for strdup() and strtok_r().
2020-04-13 16:33:21 +02:00
Romain Vimont
7eb16ce364 Fix log format warning
The expression port + 1 is promoted to int, but printed as uint16_t.
2020-04-13 16:33:19 +02:00
Romain Vimont
927d655ff6 Simplify ScreenEncoder
Do not handle iFrameInterval field and parameter, it is never used
dynamically.
2020-04-12 02:09:28 +02:00
Romain Vimont
ee2894779a Remove unused lockedVideoOrientation field
During PR #1151, this field has been moved to ScreenInfo, but has not
been removed from ScreenEncoder.
2020-04-12 02:08:16 +02:00
Romain Vimont
1c6207f8ce Merge branch 'master' into dev 2020-04-12 00:31:57 +02:00
Romain Vimont
ab52b36895 Reorder options in alphabetical order 2020-04-11 14:31:14 +02:00
Romain Vimont
9f4735ede3 Fix double click on rotated display
A double-click outside the device content (in the black borders) resizes
so that black borders are removed. But the display rotation was not
taken into account to detect the content.

Use the content size instead of the frame size to fix the issue.

Ref: <https://github.com/Genymobile/scrcpy/issues/898#issuecomment-610993695>
2020-04-08 16:37:33 +02:00
Romain Vimont
6295c1a110 Remap event positions on rotated display
If the display is rotated, the position of clicks must be adapted.
2020-04-08 14:27:25 +02:00
Romain Vimont
f3fba3c4b9 Store rotated content size
This avoids to compute it every time from the frame size.
2020-04-08 14:12:54 +02:00
Kostiantyn Luzan
c1ebea26e6 Register rotation watcher on selected display
PR #1275 <https://github.com/Genymobile/scrcpy/pull/1275>

Signed-off-by: Kostiantyn Luzan <vblack2006@gmail.com>
Signed-off-by: Romain Vimont <rom@rom1v.com>
2020-04-08 12:09:24 +02:00
Romain Vimont
f07d21f050 Suppress DiscouragedPrivateApi lint warning 2020-04-08 12:09:24 +02:00
Romain Vimont
a8fd4aec9a Remove --fullscreen validation
Many options are meaningless if --no-display is set.

We don't want to validate all possible combinations, so don't make an
exception for --fullscreen.
2020-04-08 12:09:24 +02:00
Romain Vimont
cbde7b964a Improve documentation for consistency
Make --lock-video-orientation documentation consistent with that of
--rotation.
2020-04-08 12:09:24 +02:00
Romain Vimont
28c71c528f Add --rotation command-line option
In addition to Ctrl+Left and Ctrl+Right shortcuts, add a command-line
parameter to set the initial rotation.
2020-04-08 12:09:22 +02:00
Romain Vimont
d48b375a1d Add shortcuts to rotate display
Add Ctrl+Left and Ctrl+Right shortcuts to rotate the display (the
content of the scrcpy window).

Contrary to --lock-video-orientation, the rotation has no impact on
recording, and can be changed dynamically (and immediately).

Fixes #218 <https://github.com/Genymobile/scrcpy/issues/218>
2020-04-08 12:02:26 +02:00
Romain Vimont
fd63e7eb5a Format shortcut documentation
For consistency, start the descriptions with a capital letter.
2020-04-08 12:02:15 +02:00
Romain Vimont
cdd8edbbb6 Add a note about prebuilt server in BUILD.md
Mention that it works with a matching client version.
2020-04-07 23:06:33 +02:00
Romain Vimont
9b9e717c41 Explain master and dev branches in BUILD
People may not guess that `master` is not the development branch.
2020-04-07 10:43:20 +02:00
Romain Vimont
15e4da08a3 Improve "low quality" section in FAQ 2020-04-07 10:37:19 +02:00
Romain Vimont
2afbfc2c75 Add Android device and version in issue template 2020-04-03 21:29:09 +02:00
Romain Vimont
2cf022491f Add issue templates
Closes #1157 <https://github.com/Genymobile/scrcpy/issues/1157>
2020-04-03 18:51:18 +02:00
Harsh Shandilya
d30593e1d5 gitignore: Add x/ directory
People following default build instructions can be caught off guard by
seeing the build artifacts in the git tree.

Signed-off-by: Harsh Shandilya <me@msfjarvis.dev>
Signed-off-by: Romain Vimont <rom@rom1v.com>
2020-04-03 18:20:33 +02:00
Harsh Shandilya
9e78b765da Update to Gradle 6.3
Signed-off-by: Harsh Shandilya <me@msfjarvis.dev>
Signed-off-by: Romain Vimont <rom@rom1v.com>

-- Note from committer:

The binary gradle/wrapper/gradle-wrapper.jar has the expected SHA-256
checksum:

    $ curl -L https://services.gradle.org/distributions/gradle-6.3-wrapper.jar.sha256
    1cef53de8dc192036e7b0cc47584449b0cf570a00d560bfaa6c9eabe06e1fc06

All the changed files match an upgrade executed independently:
<https://docs.gradle.org/current/userguide/gradle_wrapper.html#sec:upgrading_wrapper>
2020-04-03 18:11:35 +02:00
Harsh Shandilya
271de0954a Update to AGP 3.6.2
Signed-off-by: Harsh Shandilya <me@msfjarvis.dev>
2020-04-03 18:10:51 +02:00
Romain Vimont
54ccccd883 Replace SDL_Atomic by stdatomic from C11
There is no reason to use SDL atomics.
2020-04-02 21:05:26 +02:00
Romain Vimont
bea1c11f8e Do not log success on failure
If calling the private API does not work, an exception is printed. In
that case, do not log that the action succeeded.
2020-04-02 21:05:26 +02:00
Romain Vimont
94e1696869 Do not warn on terminating the server
If the server is already dead, terminating it fails. This is expected.
2020-04-02 21:05:26 +02:00
Romain Vimont
a346bb80f4 Do not block on accept() if server died
The server may die before connecting to the client. In that case, the
client was blocked indefinitely (until Ctrl+C) on accept().

To avoid the problem, close the server socket once the server process is
dead.
2020-04-02 21:05:26 +02:00
Romain Vimont
d421741a83 Wait server from a separate thread
Create a thread just to wait for the server process exit.

This paves the way to simply wake up a blocking accept() in a portable
way.
2020-04-02 21:05:26 +02:00
Romain Vimont
64d5edce92 Refactor server_start() error handling
This avoids cleanup duplication.
2020-04-02 21:05:26 +02:00
e_vigurskiy
4150eedcdf Add display id parameter
Add --display command line parameter to specify a display id.

PR #1238 <https://github.com/Genymobile/scrcpy/pull/1238>

Signed-off-by: Romain Vimont <rom@rom1v.com>
2020-04-02 21:02:52 +02:00
Romain Vimont
5031b2c8ff Remove MagicNumber checkstyle
There are a lot of "magic numbers" that we really don't want to extract
as a constant.

Until now, many @SuppressWarnings annotations were added, but it makes
no sense to check for magic number if we silent the warnings everywhere.
2020-03-28 22:08:16 +01:00
Romain Vimont
4adf5fde6d Log device details on server start 2020-03-28 15:52:02 +01:00
Romain Vimont
e050cfdcd6 Fix static_assert() parameters
In C11, static_assert() expects a message.
2020-03-27 14:01:56 +01:00
Romain Vimont
dc7c677728 Accept negative window position
It seems to work on some window managers.

Fixes #1242 <https://github.com/Genymobile/scrcpy/issues/1242>
2020-03-26 22:52:41 +01:00
Romain Vimont
3504c0016b Add tests for control message length
This will avoid regressions for #1245.

<https://github.com/Genymobile/scrcpy/issues/1245>
2020-03-26 22:48:01 +01:00
Romain Vimont
89d1602185 Fix expected message length for touch events
The expected length for a touch event control message was incorrect. As
a consequence, a BufferUnderflowException could occur.

Fixes #1245 <https://github.com/Genymobile/scrcpy/issues/1245>
2020-03-26 22:45:43 +01:00
Romain Vimont
566ba766af Remove unused constant
It has not been removed when mouse and touch events have been merged.
2020-03-26 22:43:53 +01:00
Tzah Mazuz
a0af402d96 Fix the printed versions (were opposite)
PR #1224 <https://github.com/Genymobile/scrcpy/pull/1224>

Signed-off-by: Romain Vimont <rom@rom1v.com>
2020-03-19 19:28:57 +01:00
Romain Vimont
7bb91638ad Improve FAQ 2020-03-19 19:22:58 +01:00
Romain Vimont
600df37753 Mention AutoAdb in README 2020-03-19 19:16:08 +01:00
Romain Vimont
902b99174d Fix server debugger for Android >= 9
Add a compilation flag to select the debugger method to use:
 - old: Android < 9
 - new: Android >= 9

See <https://github.com/Genymobile/scrcpy/issues/1187#issuecomment-599075661>
2020-03-19 19:15:43 +01:00
Jaafar Biyadi
cd69eb4a4f Handle NumPad events when NumLock is disabled
PR #1188 <https://github.com/Genymobile/scrcpy/pull/1188>
Fixes #1048 <https://github.com/Genymobile/scrcpy/issues/1048>

Signed-off-by: Romain Vimont <rom@rom1v.com>
2020-03-14 17:37:14 +01:00
Yogev Boaron Ben-Har
bc7508427b Add scoop instructions for Windows
PR #1202 <https://github.com/Genymobile/scrcpy/pull/1202>

Signed-off-by: Romain Vimont <rom@rom1v.com>
2020-03-14 17:11:49 +01:00
Romain Vimont
24ade6ad77 Simplify Chocolatey documentation 2020-03-14 17:07:20 +01:00
Romain Vimont
ae2d094362 Handle locked video orientation from ScreenInfo
Centralize video size management in ScreenInfo.

This allows to always send the correct initial video size to the client
if the video orientation is locked.
2020-03-08 10:38:31 +01:00
Romain Vimont
c5f5d1e456 Rename "rotation" to "device rotation"
This paves the way to reduce confusion in ScreenInfo when it will handle
locked video orientation.
2020-03-04 22:15:10 +01:00
Romain Vimont
63286424bb Compute all screen info from ScreenInfo
Screen information was partially initialized from Device. Move this
initialization to ScreenInfo.
2020-03-04 22:15:10 +01:00