Skip to content

Display and control your Android device

Add option to disable window decoration

Diego Fernando Díaz A59bc5bc1f55a
diff --git a/app/src/main.c b/app/src/main.c
index 0046a12d..2e8b7897 100644
--- a/app/src/main.c
+++ b/app/src/main.c
@@ -107,6 +107,9 @@ static void usage(const char *arg0) {
" -v, --version\n"
" Print the version of scrcpy.\n"
"\n"
+ " --window-borderless\n"
+ " Disable window decorations (display borderless window).\n"
+ "\n"
" --window-title text\n"
" Set a custom window title.\n"
"\n"
@@ -370,6 +373,7 @@ guess_record_format(const char *filename) {
#define OPT_WINDOW_Y 1008
#define OPT_WINDOW_WIDTH 1009
#define OPT_WINDOW_HEIGHT 1010
+#define OPT_WINDOW_BORDERLESS 1011
static bool
parse_args(struct args *args, int argc, char *argv[]) {
@@ -398,6 +402,8 @@ parse_args(struct args *args, int argc, char *argv[]) {
{"window-y", required_argument, NULL, OPT_WINDOW_Y},
{"window-width", required_argument, NULL, OPT_WINDOW_WIDTH},
{"window-height", required_argument, NULL, OPT_WINDOW_HEIGHT},
+ {"window-borderless", no_argument, NULL,
+ OPT_WINDOW_BORDERLESS},
{NULL, 0, NULL, 0 },
};
@@ -495,6 +501,9 @@ parse_args(struct args *args, int argc, char *argv[]) {
return false;
}
break;
+ case OPT_WINDOW_BORDERLESS:
+ opts->window_borderless = true;
+ break;
case OPT_PUSH_TARGET:
opts->push_target = optarg;
break;
diff --git a/app/src/scrcpy.c b/app/src/scrcpy.c
index 5213d779..c64acf49 100644
--- a/app/src/scrcpy.c
+++ b/app/src/scrcpy.c
@@ -389,7 +389,8 @@ scrcpy(const struct scrcpy_options *options) {
if (!screen_init_rendering(&screen, window_title, frame_size,
options->always_on_top, options->window_x,
options->window_y, options->window_width,
- options->window_height)) {
+ options->window_height,
+ options->window_borderless)) {
goto end;
}
diff --git a/app/src/scrcpy.h b/app/src/scrcpy.h
index d0612172..f6779080 100644
--- a/app/src/scrcpy.h
+++ b/app/src/scrcpy.h
@@ -30,6 +30,7 @@ struct scrcpy_options {
bool turn_screen_off;
bool render_expired_frames;
bool prefer_text;
+ bool window_borderless;
};
#define SCRCPY_OPTIONS_DEFAULT { \
@@ -54,6 +55,7 @@ struct scrcpy_options {
.turn_screen_off = false, \
.render_expired_frames = false, \
.prefer_text = false, \
+ .window_borderless = false, \
}
bool
diff --git a/app/src/screen.c b/app/src/screen.c
index 3d021e01..ab4d434e 100644
--- a/app/src/screen.c
+++ b/app/src/screen.c
@@ -164,7 +164,7 @@ bool
screen_init_rendering(struct screen *screen, const char *window_title,
struct size frame_size, bool always_on_top,
int16_t window_x, int16_t window_y, uint16_t window_width,
- uint16_t window_height) {
+ uint16_t window_height, bool window_borderless) {
screen->frame_size = frame_size;
struct size window_size =
@@ -181,6 +181,9 @@ screen_init_rendering(struct screen *screen, const char *window_title,
"(compile with SDL >= 2.0.5 to enable it)");
#endif
}
+ if (window_borderless) {
+ window_flags |= SDL_WINDOW_BORDERLESS;
+ }
int x = window_x != -1 ? window_x : SDL_WINDOWPOS_UNDEFINED;
int y = window_y != -1 ? window_y : SDL_WINDOWPOS_UNDEFINED;
diff --git a/app/src/screen.h b/app/src/screen.h
index eaa46850..2346ff15 100644
--- a/app/src/screen.h
+++ b/app/src/screen.h
@@ -57,7 +57,7 @@ bool
screen_init_rendering(struct screen *screen, const char *window_title,
struct size frame_size, bool always_on_top,
int16_t window_x, int16_t window_y, uint16_t window_width,
- uint16_t window_height);
+ uint16_t window_height, bool window_borderless);
// show the window
void