mirror of
https://github.com/Genymobile/scrcpy
synced 2024-12-17 21:04:50 +00:00
Add --no-vd-system-decorations
Add an option to disable the following flag for virtual displays: DisplayManager.VIRTUAL_DISPLAY_FLAG_SHOULD_SHOW_SYSTEM_DECORATIONS Some devices render a broken UI when this flag is enabled.
This commit is contained in:
parent
35050df975
commit
946ecfb582
@ -57,6 +57,7 @@ _scrcpy() {
|
|||||||
--no-mipmaps
|
--no-mipmaps
|
||||||
--no-mouse-hover
|
--no-mouse-hover
|
||||||
--no-power-on
|
--no-power-on
|
||||||
|
--no-vd-system-decorations
|
||||||
--no-video
|
--no-video
|
||||||
--no-video-playback
|
--no-video-playback
|
||||||
--orientation=
|
--orientation=
|
||||||
|
@ -63,6 +63,7 @@ arguments=(
|
|||||||
'--no-mipmaps[Disable the generation of mipmaps]'
|
'--no-mipmaps[Disable the generation of mipmaps]'
|
||||||
'--no-mouse-hover[Do not forward mouse hover events]'
|
'--no-mouse-hover[Do not forward mouse hover events]'
|
||||||
'--no-power-on[Do not power on the device on start]'
|
'--no-power-on[Do not power on the device on start]'
|
||||||
|
'--no-vd-system-decorations[Disable virtual display system decorations flag]'
|
||||||
'--no-video[Disable video forwarding]'
|
'--no-video[Disable video forwarding]'
|
||||||
'--no-video-playback[Disable video playback]'
|
'--no-video-playback[Disable video playback]'
|
||||||
'--orientation=[Set the video orientation]:orientation values:(0 90 180 270 flip0 flip90 flip180 flip270)'
|
'--orientation=[Set the video orientation]:orientation values:(0 90 180 270 flip0 flip90 flip180 flip270)'
|
||||||
|
@ -372,6 +372,10 @@ Do not forward mouse hover (mouse motion without any clicks) events.
|
|||||||
.B \-\-no\-power\-on
|
.B \-\-no\-power\-on
|
||||||
Do not power on the device on start.
|
Do not power on the device on start.
|
||||||
|
|
||||||
|
.TP
|
||||||
|
.B \-\-no\-vd\-system\-decorations
|
||||||
|
Disable virtual display system decorations flag.
|
||||||
|
|
||||||
.TP
|
.TP
|
||||||
.B \-\-no\-video
|
.B \-\-no\-video
|
||||||
Disable video forwarding.
|
Disable video forwarding.
|
||||||
|
@ -109,6 +109,7 @@ enum {
|
|||||||
OPT_SCREEN_OFF_TIMEOUT,
|
OPT_SCREEN_OFF_TIMEOUT,
|
||||||
OPT_CAPTURE_ORIENTATION,
|
OPT_CAPTURE_ORIENTATION,
|
||||||
OPT_ANGLE,
|
OPT_ANGLE,
|
||||||
|
OPT_NO_VD_SYSTEM_DECORATIONS,
|
||||||
};
|
};
|
||||||
|
|
||||||
struct sc_option {
|
struct sc_option {
|
||||||
@ -660,6 +661,11 @@ static const struct sc_option options[] = {
|
|||||||
.longopt = "no-power-on",
|
.longopt = "no-power-on",
|
||||||
.text = "Do not power on the device on start.",
|
.text = "Do not power on the device on start.",
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
.longopt_id = OPT_NO_VD_SYSTEM_DECORATIONS,
|
||||||
|
.longopt = "no-vd-system-decorations",
|
||||||
|
.text = "Disable virtual display system decorations flag.",
|
||||||
|
},
|
||||||
{
|
{
|
||||||
.longopt_id = OPT_NO_VIDEO,
|
.longopt_id = OPT_NO_VIDEO,
|
||||||
.longopt = "no-video",
|
.longopt = "no-video",
|
||||||
@ -2702,6 +2708,9 @@ parse_args_with_getopt(struct scrcpy_cli_args *args, int argc, char *argv[],
|
|||||||
case OPT_ANGLE:
|
case OPT_ANGLE:
|
||||||
opts->angle = optarg;
|
opts->angle = optarg;
|
||||||
break;
|
break;
|
||||||
|
case OPT_NO_VD_SYSTEM_DECORATIONS:
|
||||||
|
opts->vd_system_decorations = optarg;
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
// getopt prints the error message on stderr
|
// getopt prints the error message on stderr
|
||||||
return false;
|
return false;
|
||||||
|
@ -108,6 +108,7 @@ const struct scrcpy_options scrcpy_options_default = {
|
|||||||
.new_display = NULL,
|
.new_display = NULL,
|
||||||
.start_app = NULL,
|
.start_app = NULL,
|
||||||
.angle = NULL,
|
.angle = NULL,
|
||||||
|
.vd_system_decorations = true,
|
||||||
};
|
};
|
||||||
|
|
||||||
enum sc_orientation
|
enum sc_orientation
|
||||||
|
@ -310,6 +310,7 @@ struct scrcpy_options {
|
|||||||
bool audio_dup;
|
bool audio_dup;
|
||||||
const char *new_display; // [<width>x<height>][/<dpi>] parsed by the server
|
const char *new_display; // [<width>x<height>][/<dpi>] parsed by the server
|
||||||
const char *start_app;
|
const char *start_app;
|
||||||
|
bool vd_system_decorations;
|
||||||
};
|
};
|
||||||
|
|
||||||
extern const struct scrcpy_options scrcpy_options_default;
|
extern const struct scrcpy_options scrcpy_options_default;
|
||||||
|
@ -458,6 +458,7 @@ scrcpy(struct scrcpy_options *options) {
|
|||||||
.power_on = options->power_on,
|
.power_on = options->power_on,
|
||||||
.kill_adb_on_close = options->kill_adb_on_close,
|
.kill_adb_on_close = options->kill_adb_on_close,
|
||||||
.camera_high_speed = options->camera_high_speed,
|
.camera_high_speed = options->camera_high_speed,
|
||||||
|
.vd_system_decorations = options->vd_system_decorations,
|
||||||
.list = options->list,
|
.list = options->list,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -376,6 +376,9 @@ execute_server(struct sc_server *server,
|
|||||||
VALIDATE_STRING(params->new_display);
|
VALIDATE_STRING(params->new_display);
|
||||||
ADD_PARAM("new_display=%s", params->new_display);
|
ADD_PARAM("new_display=%s", params->new_display);
|
||||||
}
|
}
|
||||||
|
if (!params->vd_system_decorations) {
|
||||||
|
ADD_PARAM("vd_system_decorations=false");
|
||||||
|
}
|
||||||
if (params->list & SC_OPTION_LIST_ENCODERS) {
|
if (params->list & SC_OPTION_LIST_ENCODERS) {
|
||||||
ADD_PARAM("list_encoders=true");
|
ADD_PARAM("list_encoders=true");
|
||||||
}
|
}
|
||||||
|
@ -69,6 +69,7 @@ struct sc_server_params {
|
|||||||
bool power_on;
|
bool power_on;
|
||||||
bool kill_adb_on_close;
|
bool kill_adb_on_close;
|
||||||
bool camera_high_speed;
|
bool camera_high_speed;
|
||||||
|
bool vd_system_decorations;
|
||||||
uint8_t list;
|
uint8_t list;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -24,3 +24,13 @@ For example:
|
|||||||
```bash
|
```bash
|
||||||
scrcpy --new-display=1920x1080 --start-app=org.videolan.vlc
|
scrcpy --new-display=1920x1080 --start-app=org.videolan.vlc
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## System decorations
|
||||||
|
|
||||||
|
By default, virtual display system decorations are enabled. But some devices
|
||||||
|
might display a broken UI;
|
||||||
|
|
||||||
|
Use `--no-vd-system-decorations` to disable it.
|
||||||
|
|
||||||
|
Note that if no app is started, no content will be rendered, so no video frame
|
||||||
|
will be produced at all.
|
||||||
|
@ -60,6 +60,7 @@ public class Options {
|
|||||||
private boolean powerOn = true;
|
private boolean powerOn = true;
|
||||||
|
|
||||||
private NewDisplay newDisplay;
|
private NewDisplay newDisplay;
|
||||||
|
private boolean vdSystemDecorations = true;
|
||||||
|
|
||||||
private Orientation.Lock captureOrientationLock = Orientation.Lock.Unlocked;
|
private Orientation.Lock captureOrientationLock = Orientation.Lock.Unlocked;
|
||||||
private Orientation captureOrientation = Orientation.Orient0;
|
private Orientation captureOrientation = Orientation.Orient0;
|
||||||
@ -232,6 +233,10 @@ public class Options {
|
|||||||
return captureOrientationLock;
|
return captureOrientationLock;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean getVDSystemDecorations() {
|
||||||
|
return vdSystemDecorations;
|
||||||
|
}
|
||||||
|
|
||||||
public boolean getList() {
|
public boolean getList() {
|
||||||
return listEncoders || listDisplays || listCameras || listCameraSizes || listApps;
|
return listEncoders || listDisplays || listCameras || listCameraSizes || listApps;
|
||||||
}
|
}
|
||||||
@ -461,6 +466,9 @@ public class Options {
|
|||||||
case "new_display":
|
case "new_display":
|
||||||
options.newDisplay = parseNewDisplay(value);
|
options.newDisplay = parseNewDisplay(value);
|
||||||
break;
|
break;
|
||||||
|
case "vd_system_decorations":
|
||||||
|
options.vdSystemDecorations = Boolean.parseBoolean(value);
|
||||||
|
break;
|
||||||
case "capture_orientation":
|
case "capture_orientation":
|
||||||
Pair<Orientation.Lock, Orientation> pair = parseCaptureOrientation(value);
|
Pair<Orientation.Lock, Orientation> pair = parseCaptureOrientation(value);
|
||||||
options.captureOrientationLock = pair.first;
|
options.captureOrientationLock = pair.first;
|
||||||
|
@ -53,6 +53,7 @@ public class NewDisplayCapture extends SurfaceCapture {
|
|||||||
private final boolean captureOrientationLocked;
|
private final boolean captureOrientationLocked;
|
||||||
private final Orientation captureOrientation;
|
private final Orientation captureOrientation;
|
||||||
private final float angle;
|
private final float angle;
|
||||||
|
private final boolean vdSystemDecorations;
|
||||||
|
|
||||||
private VirtualDisplay virtualDisplay;
|
private VirtualDisplay virtualDisplay;
|
||||||
private Size videoSize;
|
private Size videoSize;
|
||||||
@ -72,6 +73,7 @@ public class NewDisplayCapture extends SurfaceCapture {
|
|||||||
this.captureOrientation = options.getCaptureOrientation();
|
this.captureOrientation = options.getCaptureOrientation();
|
||||||
assert captureOrientation != null;
|
assert captureOrientation != null;
|
||||||
this.angle = options.getAngle();
|
this.angle = options.getAngle();
|
||||||
|
this.vdSystemDecorations = options.getVDSystemDecorations();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -158,8 +160,10 @@ public class NewDisplayCapture extends SurfaceCapture {
|
|||||||
| VIRTUAL_DISPLAY_FLAG_OWN_CONTENT_ONLY
|
| VIRTUAL_DISPLAY_FLAG_OWN_CONTENT_ONLY
|
||||||
| VIRTUAL_DISPLAY_FLAG_SUPPORTS_TOUCH
|
| VIRTUAL_DISPLAY_FLAG_SUPPORTS_TOUCH
|
||||||
| VIRTUAL_DISPLAY_FLAG_ROTATES_WITH_CONTENT
|
| VIRTUAL_DISPLAY_FLAG_ROTATES_WITH_CONTENT
|
||||||
| VIRTUAL_DISPLAY_FLAG_DESTROY_CONTENT_ON_REMOVAL
|
| VIRTUAL_DISPLAY_FLAG_DESTROY_CONTENT_ON_REMOVAL;
|
||||||
| VIRTUAL_DISPLAY_FLAG_SHOULD_SHOW_SYSTEM_DECORATIONS;
|
if (vdSystemDecorations) {
|
||||||
|
flags |= VIRTUAL_DISPLAY_FLAG_SHOULD_SHOW_SYSTEM_DECORATIONS;
|
||||||
|
}
|
||||||
if (Build.VERSION.SDK_INT >= AndroidVersions.API_33_ANDROID_13) {
|
if (Build.VERSION.SDK_INT >= AndroidVersions.API_33_ANDROID_13) {
|
||||||
flags |= VIRTUAL_DISPLAY_FLAG_TRUSTED
|
flags |= VIRTUAL_DISPLAY_FLAG_TRUSTED
|
||||||
| VIRTUAL_DISPLAY_FLAG_OWN_DISPLAY_GROUP
|
| VIRTUAL_DISPLAY_FLAG_OWN_DISPLAY_GROUP
|
||||||
|
Loading…
Reference in New Issue
Block a user