A device disconnection (when the adb connection is closed) makes the
read() on the "receiver" socket fail.
Since commit 063a8339ed, this is reported
as an error. As a consequence, scrcpy fails with:
ERROR: Controller error
instead of:
WARN: Device disconnected
To fix the issue, report a device disconnection in that case.
PR #5044 <https://github.com/Genymobile/scrcpy/pull/5044>
This also avoids a warning with some compilers which do not understand
that the condition to initialize the variable is the same as the
condition to use it:
../app/src/scrcpy.c: In function ‘scrcpy’:
../app/src/scrcpy.c:750:13: warning: ‘src’ may be used uninitialized in this function [-Wmaybe-uninitialized]
750 | sc_frame_source_add_sink(src, &s->screen.frame_sink);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Refs 45fe6b602b
Refs <https://github.com/Genymobile/scrcpy/issues/5045#issuecomment-2201589757>
The documentation of avcodec_close() says:
> Do not use this function. Use avcodec_free_context() to destroy a
> codec context (either open or closed).
It was deprecated in FFmpeg 7 by commit
1cc24d749569a42510399a29b034f7a77bdec34e:
<1cc24d7495>
> Its use has been discouraged since 2016, but now is no longer used in
> avformat, so there is no reason to keep it public.
By default, only the left click is forwarded to the device, and
secondary clicks trigger shortcuts (the behavior can be configured by
--mouse-bind=xxxx).
But when the mouse mode is relative (AOA and UHID modes), forward all
clicks by default. This makes more sense since the cursor is handled on
the device side, the user expects all mouse buttons to be forwarded.
Refs <https://github.com/Genymobile/scrcpy/issues/4727#issuecomment-2069869750>
PR #5022 <https://github.com/Genymobile/scrcpy/pull/5022>
Add a new option --mouse-bind=xxxx.
The argument must be exactly 4 characters, one for each secondary click:
--mouse-bind=xxxx
^^^^
||||
||| `- 5th click
|| `-- 4th click
| `--- middle click
`---- right click
Each character must be one of the following:
- `+`: forward the click to the device
- `-`: ignore the click
- `b`: trigger shortcut BACK (or turn screen on if off)
- `h`: trigger shortcut HOME
- `s`: trigger shortcut APP_SWITCH
- `n`: trigger shortcut "expand notification panel"
This deprecates --forward-all-clicks (use --mouse-bind=++++ instead).
Refs <https://github.com/Genymobile/scrcpy/pull/2258#issuecomment-2182394460>
PR #5022 <https://github.com/Genymobile/scrcpy/pull/5022>
To resize the window to fit the device screen, it is possible to
double-click in the "black bars".
This feature was mistakenly disabled when --forward-all-clicks was set.
Instead, disable it only if mouse relative mode is enabled (AOA or
UHID), because in that case the mouse cursor is on the device.
Restrict shortcut modifiers to be composed of only one item each.
Before, it was possible to select a list of multiple combinations of
modifier keys, like --shortcut-mod='lctrl+lalt,rctrl+rsuper', meaning
that shortcuts would be triggered either by LCtrl+LAlt+key or
RCtrl+RSuper+key.
This was overly generic, probably not used very much, and it prevents to
solve inconsistencies between UP and DOWN events of modifier keys sent
to the device.
Refs #4732 <https://github.com/Genymobile/scrcpy/issues/4732>
PR #4741 <https://github.com/Genymobile/scrcpy/pull/4741>
Old Android versions may not be able to register a rotation watcher for
a secondary display. In that case, report the error instead of
registering a rotation watcher for the default display.
Refs <https://github.com/Genymobile/scrcpy/pull/4740#issuecomment-2051245633>
Suggested by: Kaiming Hu <huxxx1234@gmail.com>
Changed since AOSP/framework_base commit
670fb7f5c0d23cf51ead25538bcb017e03ed73ac, included in tag
android-14.0.0_r29.
Refs <670fb7f5c0%5E%21/>
PR #4740 <https://github.com/Genymobile/scrcpy/pull/4740>
Signed-off-by: Romain Vimont <rom@rom1v.com>
Do not call sc_screen_hide_window() if screen is not initialized.
To reproduce:
scrcpy --no-video --record=file.mp4
This only segfaults in debug mode since commit
fd0f432e87.