Add option to disable window decoration
Add --window-borderless parameter. Signed-off-by: Romain Vimont <rom@rom1v.com>
This commit is contained in:
parent
fba89e6f73
commit
ad6b8847d4
@ -36,6 +36,7 @@ struct args {
|
|||||||
bool always_on_top;
|
bool always_on_top;
|
||||||
bool turn_screen_off;
|
bool turn_screen_off;
|
||||||
bool render_expired_frames;
|
bool render_expired_frames;
|
||||||
|
bool window_borderless;
|
||||||
};
|
};
|
||||||
|
|
||||||
static void usage(const char *arg0) {
|
static void usage(const char *arg0) {
|
||||||
@ -119,6 +120,9 @@ static void usage(const char *arg0) {
|
|||||||
" -v, --version\n"
|
" -v, --version\n"
|
||||||
" Print the version of scrcpy.\n"
|
" Print the version of scrcpy.\n"
|
||||||
"\n"
|
"\n"
|
||||||
|
" --window_borderless\n"
|
||||||
|
" Disable window decorations (display borderless window).\n"
|
||||||
|
"\n"
|
||||||
" --window-title text\n"
|
" --window-title text\n"
|
||||||
" Set a custom window title.\n"
|
" Set a custom window title.\n"
|
||||||
"\n"
|
"\n"
|
||||||
@ -378,6 +382,7 @@ guess_record_format(const char *filename) {
|
|||||||
#define OPT_WINDOW_Y 1004
|
#define OPT_WINDOW_Y 1004
|
||||||
#define OPT_WINDOW_WIDTH 1005
|
#define OPT_WINDOW_WIDTH 1005
|
||||||
#define OPT_WINDOW_HEIGHT 1006
|
#define OPT_WINDOW_HEIGHT 1006
|
||||||
|
#define OPT_WINDOW_BORDERLESS 1007
|
||||||
|
|
||||||
static bool
|
static bool
|
||||||
parse_args(struct args *args, int argc, char *argv[]) {
|
parse_args(struct args *args, int argc, char *argv[]) {
|
||||||
@ -390,6 +395,8 @@ parse_args(struct args *args, int argc, char *argv[]) {
|
|||||||
{"max-size", required_argument, NULL, 'm'},
|
{"max-size", required_argument, NULL, 'm'},
|
||||||
{"no-control", no_argument, NULL, 'n'},
|
{"no-control", no_argument, NULL, 'n'},
|
||||||
{"no-display", no_argument, NULL, 'N'},
|
{"no-display", no_argument, NULL, 'N'},
|
||||||
|
{"window-borderless", no_argument, NULL,
|
||||||
|
OPT_WINDOW_BORDERLESS},
|
||||||
{"port", required_argument, NULL, 'p'},
|
{"port", required_argument, NULL, 'p'},
|
||||||
{"push-target", required_argument, NULL,
|
{"push-target", required_argument, NULL,
|
||||||
OPT_PUSH_TARGET},
|
OPT_PUSH_TARGET},
|
||||||
@ -491,6 +498,9 @@ parse_args(struct args *args, int argc, char *argv[]) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case OPT_WINDOW_BORDERLESS:
|
||||||
|
args->window_borderless = true;
|
||||||
|
break;
|
||||||
case OPT_PUSH_TARGET:
|
case OPT_PUSH_TARGET:
|
||||||
args->push_target = optarg;
|
args->push_target = optarg;
|
||||||
break;
|
break;
|
||||||
@ -568,6 +578,7 @@ main(int argc, char *argv[]) {
|
|||||||
.no_display = false,
|
.no_display = false,
|
||||||
.turn_screen_off = false,
|
.turn_screen_off = false,
|
||||||
.render_expired_frames = false,
|
.render_expired_frames = false,
|
||||||
|
.window_borderless = false,
|
||||||
};
|
};
|
||||||
if (!parse_args(&args, argc, argv)) {
|
if (!parse_args(&args, argc, argv)) {
|
||||||
return 1;
|
return 1;
|
||||||
@ -618,6 +629,7 @@ main(int argc, char *argv[]) {
|
|||||||
.display = !args.no_display,
|
.display = !args.no_display,
|
||||||
.turn_screen_off = args.turn_screen_off,
|
.turn_screen_off = args.turn_screen_off,
|
||||||
.render_expired_frames = args.render_expired_frames,
|
.render_expired_frames = args.render_expired_frames,
|
||||||
|
.window_borderless = args.window_borderless,
|
||||||
};
|
};
|
||||||
int res = scrcpy(&options) ? 0 : 1;
|
int res = scrcpy(&options) ? 0 : 1;
|
||||||
|
|
||||||
|
@ -392,7 +392,8 @@ scrcpy(const struct scrcpy_options *options) {
|
|||||||
if (!screen_init_rendering(&screen, window_title, frame_size,
|
if (!screen_init_rendering(&screen, window_title, frame_size,
|
||||||
options->always_on_top, options->window_x,
|
options->always_on_top, options->window_x,
|
||||||
options->window_y, options->window_width,
|
options->window_y, options->window_width,
|
||||||
options->window_height)) {
|
options->window_height,
|
||||||
|
options->window_borderless)) {
|
||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -28,6 +28,7 @@ struct scrcpy_options {
|
|||||||
bool display;
|
bool display;
|
||||||
bool turn_screen_off;
|
bool turn_screen_off;
|
||||||
bool render_expired_frames;
|
bool render_expired_frames;
|
||||||
|
bool window_borderless;
|
||||||
};
|
};
|
||||||
|
|
||||||
bool
|
bool
|
||||||
|
@ -159,7 +159,7 @@ bool
|
|||||||
screen_init_rendering(struct screen *screen, const char *window_title,
|
screen_init_rendering(struct screen *screen, const char *window_title,
|
||||||
struct size frame_size, bool always_on_top,
|
struct size frame_size, bool always_on_top,
|
||||||
int16_t window_x, int16_t window_y, uint16_t window_width,
|
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;
|
screen->frame_size = frame_size;
|
||||||
|
|
||||||
struct size window_size =
|
struct size window_size =
|
||||||
@ -176,6 +176,9 @@ screen_init_rendering(struct screen *screen, const char *window_title,
|
|||||||
"(compile with SDL >= 2.0.5 to enable it)");
|
"(compile with SDL >= 2.0.5 to enable it)");
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
if (window_borderless) {
|
||||||
|
window_flags |= SDL_WINDOW_BORDERLESS;
|
||||||
|
}
|
||||||
|
|
||||||
int x = window_x != -1 ? window_x : SDL_WINDOWPOS_UNDEFINED;
|
int x = window_x != -1 ? window_x : SDL_WINDOWPOS_UNDEFINED;
|
||||||
int y = window_y != -1 ? window_y : SDL_WINDOWPOS_UNDEFINED;
|
int y = window_y != -1 ? window_y : SDL_WINDOWPOS_UNDEFINED;
|
||||||
|
@ -48,7 +48,7 @@ bool
|
|||||||
screen_init_rendering(struct screen *screen, const char *window_title,
|
screen_init_rendering(struct screen *screen, const char *window_title,
|
||||||
struct size frame_size, bool always_on_top,
|
struct size frame_size, bool always_on_top,
|
||||||
int16_t window_x, int16_t window_y, uint16_t window_width,
|
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
|
// show the window
|
||||||
void
|
void
|
||||||
|
Loading…
x
Reference in New Issue
Block a user