Romain Vimont
a5f4f58295
Remove duplicate include
2020-12-22 01:14:30 +01:00
Romain Vimont
ea12783bbc
Upgrade JUnit to 4.13
2020-12-17 10:53:35 +01:00
Romain Vimont
904d470579
Pause on error from a wrapper script
...
On Windows, scrcpy paused on error before exiting to give the user a
chance to see the user message.
This was a hack and causes issues when using scrcpy from batch scripts.
Disable this pause from the scrcpy binary, and provide a batch wrapper
(scrcpy-console.bat) to pause on error.
Fixes #1875 <https://github.com/Genymobile/scrcpy/issues/1875 >
2020-12-14 09:44:17 +01:00
Romain Vimont
6d151eaef9
Reference encoder section from FAQ
2020-12-14 09:04:14 +01:00
Romain Vimont
5dc3285dbf
Reference FFmpeg Windows builds from GitHub
...
Refs #1753 <https://github.com/Genymobile/scrcpy/issues/1753 >
2020-12-12 16:26:08 +01:00
Romain Vimont
c9a4bdb890
Upgrade platform-tools (30.0.5) for Windows
...
Include the latest version of adb in Windows releases.
2020-12-12 15:56:32 +01:00
Romain Vimont
d60ac65b32
Merge branch 'master' into dev
2020-12-12 15:55:29 +01:00
Romain Vimont
30434afc0a
Upgrade gradle build tools to 4.0.1
2020-11-24 09:45:18 +01:00
Romain Vimont
868e762d71
Fix size_t format specifier for Windows
...
Use "%Iu" on Windows. This fixes the following warning:
../app/src/sys/win/command.c:17:14: warning: unknown conversion type character ‘l’ in format [-Wformat=]
17 | LOGE("Command too long (%" PRIsizet " chars)", len - 1);
2020-11-14 22:10:11 +01:00
Romain Vimont
576814bcec
Document --encoder option
...
Add documentation for the new option --encoder in the manpage and in
README.md.
2020-11-08 21:11:12 +01:00
Romain Vimont
42ab8fd611
List available encoders on invalid name specified
...
If an invalid encoder name is given via the --encoder option, list all
the H.264 encoders available on the device.
2020-11-08 21:07:20 +01:00
Romain Vimont
363eeea19e
Log encoder name
...
When the encoder is selected automatically, log the name of the selected
encoder.
2020-11-08 21:07:20 +01:00
Romain Vimont
d5f059c7cb
Add option to force legacy method for pasting
...
Some devices do not behave as expected when setting the device clipboard
programmatically.
Add an option --legacy-paste to change the behavior of Ctrl+v and MOD+v
so that they inject the computer clipboard text as a sequence of key
events (the same way as MOD+Shift+v).
Fixes #1750 <https://github.com/Genymobile/scrcpy/issues/1750 >
Fixes #1771 <https://github.com/Genymobile/scrcpy/issues/1771 >
2020-11-07 15:16:51 +01:00
Romain Vimont
adc547fa6e
Add an option to forward all clicks
...
Add --forward-all-clicks to disable mouse shortcuts and forward middle
and right clicks to the device instead.
Fixes #1302 <https://github.com/Genymobile/scrcpy/issues/1302 >
Fixes #1613 <https://github.com/Genymobile/scrcpy/issues/1613 >
2020-11-03 17:12:26 +01:00
Romain Vimont
5dcfc0ebab
Add local.properties to gitignore
2020-11-03 17:09:03 +01:00
Romain Vimont
ad5f567f07
Remove spurious space
2020-11-03 17:08:21 +01:00
Romain Vimont
25aff00935
Mention version of Indonesian translation
2020-10-05 21:24:59 +02:00
Romain Vimont
83082406d3
Enable Java deprecation warnings details
...
Without the option, gradle reports a lint issue, but without any
details.
2020-10-05 21:11:50 +02:00
Romain Vimont
2edf192e3a
Remove deprecation warning
...
As a workaround for some devices, we need to prepare the main looper.
The method is now deprecated, but we still want to call it.
2020-10-05 21:09:47 +02:00
Romain Vimont
d50ecf40b6
Fix options order
2020-10-01 15:08:18 +02:00
Romain Vimont
acc65f8c9d
Remove unused field
...
Fixes #1775 <https://github.com/Genymobile/scrcpy/issues/1775 >
Reported-by: lordnn
2020-09-20 01:11:22 +02:00
Romain Vimont
a65ebceac1
Add missing mutex unlock on error
...
Fixes #1770 <https://github.com/Genymobile/scrcpy/issues/1770 >
Reported-by: lordnn
2020-09-20 01:11:13 +02:00
Romain Vimont
52560faa34
Fix README indentation
2020-09-17 13:03:40 +02:00
Romain Vimont
d662f73bdc
Upgrade Android SDK to 30
2020-09-15 14:54:22 +02:00
Romain Vimont
1c44dc2259
Use portable shebang for all bash scripts
...
Refs #426 <https://github.com/Genymobile/scrcpy/pull/426 >
Refs #1716 <https://github.com/Genymobile/scrcpy/pull/1716 >
2020-09-15 13:54:00 +02:00
Romain Vimont
ae758f99d6
Adapt call() on ContentProvider for Android 11
...
This commit in AOSP framework_base added a parameter "attributionTag" to
the call() method:
https://android.googlesource.com/platform/frameworks/base.git/+/12ac3f406fed87cb9cd3a28b9947e7202a2d14bd%5E%21/#F17
As a consequence, the method did not exist, so scrcpy used the legacy
call() method (using the authority "unknown") as a fallback, which fails
for security reasons.
Fixes #1468 <https://github.com/Genymobile/scrcpy/issues/1468 >
2020-09-15 13:31:10 +02:00
Romain Vimont
bd9f656933
Fix feature test macro
...
The expected feature test macro is _POSIX_C_SOURCE having a value
greater or equal to 200809L.
Fixes #1726 <https://github.com/Genymobile/scrcpy/issues/1726 >
2020-08-31 14:02:51 +02:00
Romain Vimont
c243fd4c3f
Fix more log format warning
...
The expression port + 1 is promoted to int, but printed as uint16_t.
This is the same mistake fixed for a different log by
7eb16ce364 .
Refs #1726 <https://github.com/Genymobile/scrcpy/issues/1726 >
2020-08-31 13:40:32 +02:00
Romain Vimont
0c5e0a4f6d
Make Device methods static when possible
...
The behavior of some methods do not depend on the user-provided options.
These methods can be static. This will allow to call them directly from
the cleanup process.
2020-08-21 12:34:50 +02:00
Romain Vimont
0be766e71a
Add undetected device error message in FAQ
2020-08-20 19:14:45 +02:00
Romain Vimont
d02789ce21
List available shortcut keys on error
...
Fixes #1681 <https://github.com/Genymobile/scrcpy/issues/1681 >
Suggested-by: Moritz Schulz <moritzleni@gmail.com >
2020-08-16 13:52:01 +02:00
Romain Vimont
6cc22e1c5b
Reference --shortcut-mod from shortcuts list
...
Fixes #1681 <https://github.com/Genymobile/scrcpy/issues/1681 >
Suggested-by: Moritz Schulz <moritzleni@gmail.com >
2020-08-16 13:44:42 +02:00
Romain Vimont
479d10dc22
Update links to v1.16 in README and BUILD
2020-08-10 20:34:51 +02:00
Romain Vimont
d7779d08e8
Bump version to 1.16
2020-08-10 20:09:28 +02:00
Romain Vimont
df4ba1b8b0
Merge branch 'master' into dev
2020-08-10 20:08:33 +02:00
Romain Vimont
198346d148
Add pinch-to-zoom simulation
...
If Ctrl is hold when the left-click button is pressed, enable
pinch-to-zoom to scale and rotate relative to the center of the screen.
Fixes #24 <https://github.com/Genymobile/scrcpy/issues/24 >
2020-08-10 20:08:24 +02:00
Romain Vimont
95f1ea0d80
Fix clipboard paste condition
...
To avoid possible copy-paste loops between the computer and the device,
the device clipboard is not set if it already contains the expected
content.
But the condition was wrong: it was not set also if it was empty.
Refs 1223a72eb8
Fixes #1658 <https://github.com/Genymobile/scrcpy/issues/1658 >
2020-08-10 14:37:32 +02:00
Romain Vimont
38940ffe89
Revert "Inject WAKEUP instead of POWER"
...
WAKEUP does not work on some devices.
Fixes #1655 <https://github.com/Genymobile/scrcpy/issues/1655 >
This reverts commit 322f1512ea .
2020-08-09 17:10:27 +02:00
Romain Vimont
f03a3edde6
Update links to v1.15.1 in README and BUILD
2020-08-07 12:13:27 +02:00
Romain Vimont
633a51e9c4
Bump version to 1.15.1
2020-08-07 12:01:34 +02:00
Romain Vimont
976761956f
Fix uninitialized repeat count in key events
...
A new "repeat" field has been added by
3c1ed5d86c , but it was not initialized in
every code path.
As a consequence, keycodes generated by shortcuts were sent with an
undetermined value, breaking some shortcuts (especially HOME) randomly.
Fixes #1643 <https://github.com/Genymobile/scrcpy/issues/1643 >
2020-08-07 11:32:11 +02:00
Romain Vimont
521f2fe994
Update links to v1.15 in README and BUILD
2020-08-06 21:56:06 +02:00
Romain Vimont
edc4f7675f
Bump version to 1.15
2020-08-06 21:00:48 +02:00
Romain Vimont
712f1fa6b2
Upgrade FFmpeg (4.3.1) for Windows
...
Include the latest version of FFmpeg in Windows releases.
2020-08-06 21:00:48 +02:00
Romain Vimont
1ba06037f8
Upgrade platform-tools (30.0.4) for Windows
...
Include the latest version of adb in Windows releases.
2020-08-06 21:00:48 +02:00
Romain Vimont
da63e3774b
Merge branch 'master' into dev
2020-08-06 21:00:15 +02:00
Romain Vimont
74079ea5e4
Copy the options used in input manager init
...
This avoids to pass additional options to some input manager functions.
Refs #1623 <https://github.com/Genymobile/scrcpy/pull/1623 >
2020-08-02 18:19:41 +02:00
Romain Vimont
0870d8620f
Mention that MENU unlocks screen
...
Pressing MENU while in lock screen unlocks (it still asks for the schema
or code if enabled).
2020-08-01 17:10:09 +02:00
Romain Vimont
d49cffb938
Use <kbd> HTML tag for keys
...
It's prettyier in a browser.
2020-08-01 17:04:16 +02:00
Romain Vimont
dfb7324d7b
Mention in README that Ctrl is forwarded
2020-08-01 16:51:38 +02:00
Romain Vimont
d8b3ba170c
Update copy-paste section in README
...
Update documentation regarding the recent copy-paste changes.
2020-08-01 16:51:37 +02:00
Romain Vimont
7ad47dfaab
Swap paste shortcuts
...
For consistency with MOD+c and MOD+x, use MOD+v to inject PASTE.
Use Mod+Shift+v to inject clipboard content as a sequence of text
events.
2020-08-01 16:47:44 +02:00
Romain Vimont
56a115b5c5
Add shortcuts for COPY and CUT
...
Send COPY and CUT on MOD+c and MOD+x (only supported for Android >= 7).
The shortcuts Ctrl+c and Ctrl+x should generally also work (even before
Android 7), but the active Android app may use them for other actions
instead.
2020-08-01 16:47:43 +02:00
Romain Vimont
8f64a5984b
Change "resize to fit" shortcut to MOD+w
...
For convenience, MOD+x will be used for injecting the CUT keycode.
2020-08-01 16:31:31 +02:00
Romain Vimont
bccd12bf5c
Remove "get clipboard" call
...
Now that every device clipboard change is automatically synchronized to
the computer, the "get clipboard" request (bound to MOD+c) is useless.
2020-08-01 16:31:31 +02:00
Romain Vimont
20d3925099
Set computer clipboard only if necessary
...
Do not explicitly set the clipboard text if it already contains the
expected content.
Even if copy-paste loops are avoided by the previous commit, this avoids
to trigger a clipboard change on the computer-side.
Refs #1580 <https://github.com/Genymobile/scrcpy/issues/1580 >
2020-08-01 16:31:31 +02:00
Romain Vimont
1223a72eb8
Set device clipboard only if necessary
...
Do not explicitly set the clipboard text if it already contains the
expected content. This avoids possible copy-paste loops between the
computer and the device.
2020-08-01 16:31:31 +02:00
Romain Vimont
7683be8159
Synchronize clipboard on Ctrl+v
...
Pressing Ctrl+v on the device will typically paste the clipboard
content.
Before sending the key event, synchronize the computer clipboard to the
device clipboard to allow seamless copy-paste.
2020-08-01 16:31:31 +02:00
Romain Vimont
d4ca85d6a8
Forward Shift to the device
...
This allows to select text using Shift+(arrow keys).
Fixes #942 <https://github.com/Genymobile/scrcpy/issues/942 >
2020-08-01 16:31:31 +02:00
Romain Vimont
e6e528f228
Forward Ctrl to the device
...
Now that the scrcpy shortcut modifier is Alt by default (and can be
configured), forward Ctrl to the device.
This allows to trigger Android shortcuts.
Fixes #555 <https://github.com/Genymobile/scrcpy/issues/555 >
2020-08-01 16:31:31 +02:00
Romain Vimont
a5f8b577c5
Ignore text events for shortcuts
...
Pressing Alt+c generates a text event containing "c", so "c" was sent to
the device when --prefer-text was enabled.
Ignore text events when the mod state matches a shortcut modifier.
2020-08-01 16:31:31 +02:00
Romain Vimont
e4bb7c1d1f
Accept Super as shortcut modifier
...
In addition to (left) Alt, also accept (left) Super. This is especially
convenient for macOS users (Super is the Cmd key).
2020-08-01 16:31:31 +02:00
Romain Vimont
1b76d9fd78
Customize shortcut modifier
...
Add --shortcut-mod, and use Alt as default modifier.
This paves the way to forward the Ctrl key to the device.
2020-08-01 16:31:27 +02:00
Romain Vimont
63cb93d7d7
Use Ctrl for all shortcuts
...
Remove the Cmd modifier on macOS, which was possible only for some
shortcuts but not all.
This paves the way to make the shortcut modifier customizable.
2020-08-01 16:31:08 +02:00
Romain Vimont
9d9dd1f143
Make expression order consistent
...
The condition "cmd" was always before "shift" in all expressions except
4.
2020-07-17 00:00:42 +02:00
Romain Vimont
eabaf6f7bd
Simplify PASTE option for "set clipboard"
...
When the client requests to set the clipboard, it may request to press
the PASTE key in addition. To be a bit generic, it was stored as a flag
in ControlMessage.java.
But flags suggest that it represents a bitwise union. Use a simple
boolean instead.
2020-07-17 00:00:42 +02:00
Romain Vimont
199c74f62f
Declare main() with argc/argv params in tests
...
Declaring the main method as "int main(void)" causes issues with SDL.
Fixes #1209 <https://github.com/Genymobile/scrcpy/issues/1209 >
2020-07-15 12:17:04 +02:00
Romain Vimont
322f1512ea
Inject WAKEUP instead of POWER
...
To power the device on, inject KEYCODE_WAKEUP to avoid a possible
race condition (the device might become off between the test
isScreenOn() and the POWER keycode injection).
2020-07-15 12:03:44 +02:00
Romain Vimont
a973757fd1
Warn on ignored touch event
...
In theory, this was expected to only happen when a touch event is sent
just before the device is rotated, but some devices do not respect the
encoding size, causing an unexpected mismatch.
Refs #1518 <https://github.com/Genymobile/scrcpy/issues/1518 >
2020-07-09 22:32:14 +02:00
Romain Vimont
deea29f52a
Send touch event without pressure on button up
...
Refs #1518 <https://github.com/Genymobile/scrcpy/issues/1518 >
2020-07-09 22:31:47 +02:00
Romain Vimont
5fa46ad0c7
Fix constants name in comment
2020-07-07 15:47:25 +02:00
Romain Vimont
334964c380
Make setScreenPowerMode() method static
...
Its implementation does not use the instance at all.
2020-07-07 15:34:34 +02:00
Romain Vimont
f7d4b6d0db
Do not crash on missing clipboard manager
...
Some devices have no clipboard manager.
In that case, do not try to enable clipboard synchronization to avoid
a crash.
Fixes #1440 <https://github.com/Genymobile/scrcpy/issues/1440 >
Fixes #1556 <https://github.com/Genymobile/scrcpy/issues/1556 >
2020-07-03 08:53:51 +02:00
Romain Vimont
e8a565f9ea
Fix touch events HiDPI-scaling
...
Touch events were HiDPI-scaled twice:
- once because the position (provided as floats between 0 and 1) were
converted in pixels using the drawable size (not the window size)
- once due to screen_convert_to_frame_coords()
One possible fix could be to compute the position in pixels from the
window size instead, but this would unnecessarily round the event
position to the nearest window coordinates (instead of drawable
coordinates).
Instead, expose two separate functions to convert to frame coordinates
from either window or drawable coordinates.
Fixes #1536 <https://github.com/Genymobile/scrcpy/issues/1536 >
Refs #15 <https://github.com/Genymobile/scrcpy/issues/15 >
Refs e40532a376
2020-06-27 15:45:28 +02:00
Romain Vimont
0ba74fbd9a
Make scrcpy.h independant of other headers
...
The header scrcpy.h is intended to be the "public" API. It should not
depend on other internal headers.
Therefore, declare all required structs in this header and adapt
internal code.
2020-06-19 22:30:02 +02:00
Romain Vimont
29e5af76d4
Remove fprintf() call in tests
...
It should never have been committed.
2020-06-19 21:54:46 +02:00
Romain Vimont
1e4ee547b5
Make message buffer static
...
Now that the message max size is 256k, do not put the buffer on the
stack.
2020-06-11 23:11:20 +02:00
Romain Vimont
488d22d4e2
Increase clipboard size from 4k to 256k
...
Beyond 256k, SDL_GetClipboardText() returns an empty string on my
computer.
Fixes #1117 <https://github.com/Genymobile/scrcpy/issues/1117 >
2020-06-11 23:11:20 +02:00
Romain Vimont
00d292b2f5
Fix receiver on partial device messages
...
If a single device message was read in several chunks from the control
socket, the communication was broken.
2020-06-11 23:11:20 +02:00
Romain Vimont
245999aec4
Serialize text size on 4 bytes
...
This will allow to send text having a size greater than 65535 bytes.
2020-06-11 23:11:17 +02:00
Romain Vimont
d91c5dcfd5
Rename MSG_SERIALIZED_MAX_SIZE to MSG_MAX_SIZE
...
For simplicity and consistency with the server part.
2020-06-11 23:08:04 +02:00
Romain Vimont
d202d7b205
Add unit test for big clipboard device message
...
Test clipboard synchronization from the device to the computer.
2020-06-11 23:06:02 +02:00
Romain Vimont
08c0c64af6
Rename test names from "event" to "msg"
...
The meson test names had not been changed when "event" had been renamed
to "message".
Ref: 28980bbc90
2020-06-11 23:06:02 +02:00
Romain Vimont
a00a8763d6
Avoid additional copy on Java text parsing
...
Directly pass the buffer range to the String constructor.
2020-06-11 23:06:02 +02:00
Romain Vimont
8f314c74b0
Reorganize message size constants
...
Make the max clipboard text length depend on the max message size.
2020-06-11 22:58:54 +02:00
Romain Vimont
3c0fc8f54f
Mention sndcpy
2020-06-09 22:09:23 +02:00
Romain Vimont
6e1069a822
Configure log level for application only
...
Do not expose internal SDL logs to users.
Fixes #1441 <https://github.com/Genymobile/scrcpy/issues/1441 >
2020-06-02 18:27:23 +02:00
Romain Vimont
c4323df976
Fix incorrect log return value
...
The function must return a SDL_LogPriority, but returned an enum
sc_log_level.
(It was harmless because this specific return should never happen, as
asserted.)
2020-06-02 18:27:14 +02:00
Romain Vimont
8ff07e0c88
Git-ignore release directories
2020-06-02 18:25:22 +02:00
Romain Vimont
e4efd75766
Avoid repetition for some shortcuts
...
Keeping the key pressed generate "repeat" events. It does not make sense
to repeat the event for rotation or turn screen off.
2020-05-29 22:02:41 +02:00
Romain Vimont
0e4a6f462b
Mention stay awake limitation
...
The "stay awake" feature only works when the device is plugged in.
Refs #1445 <https://github.com/Genymobile/scrcpy/issues/1445 >
2020-05-28 23:07:28 +02:00
Romain Vimont
8b73c90427
Mention how to turn the screen on in README
...
Now that Ctrl+Shift+o has been reactivated, mention it in the "turn
screen off" section.
2020-05-27 19:32:02 +02:00
Romain Vimont
ef91ab2841
Update links to v1.14 in README and BUILD
2020-05-27 19:31:12 +02:00
Romain Vimont
44fa4a090e
Bump version to 1.14
2020-05-27 18:26:46 +02:00
Romain Vimont
dcde578a50
Reactivate "turn device screen on" feature
...
This reverts commit 8c8649cfcd .
I cannot reproduce the issue with Ctrl+Shift+o on any device, so in
practice it works, it's too bad to remove the feature for a random bug
on some Android versions on some devices.
2020-05-27 18:26:46 +02:00
Romain Vimont
93a5c5149d
Push clipboard text only if not null
...
In practice, it does not change anything (it just avoids a spurious
wake-up), but semantically, it makes no sense to call
pushClipboardText() with a null value.
2020-05-27 18:26:39 +02:00
Romain Vimont
2ca8318b9d
Improve manpage formatting
...
Add a new line to avoid unwanted text justification
2020-05-27 12:39:42 +02:00
Romain Vimont
d499ee53c9
Initialize a default log level
...
Clean up has been broken by 3df63c579d .
The verbosity was correctly initialized for the Server process, but not
for the CleanUp process.
To avoid the problem, initialize a default log level.
2020-05-27 12:05:29 +02:00
Romain Vimont
8f619f337b
Upgrade platform-tools (30.0.0) for Windows
...
Include the latest version of adb in Windows releases.
2020-05-26 19:21:05 +02:00
Romain Vimont
fc1dec0270
Paste on "set clipboard" if possible
...
Ctrl+Shift+v synchronizes the computer clipboard to the Android device
clipboard. This feature had been added to provide a way to copy UTF-8
text from the computer to the device.
To make such a paste more straightforward, if the device runs at least
Android 7, also send a PASTE keycode to paste immediately.
<https://developer.android.com/reference/android/view/KeyEvent.html#KEYCODE_PASTE >
Fixes #786 <https://github.com/Genymobile/scrcpy/issues/786 >
2020-05-25 20:59:21 +02:00