Apply requested window size in OTG mode
Fixes #3099 <https://github.com/Genymobile/scrcpy/issues/3099> PR #3219 <https://github.com/Genymobile/scrcpy/pull/3219>
This commit is contained in:
parent
c6d9711109
commit
fc8942aa03
3 changed files with 11 additions and 2 deletions
|
@ -162,6 +162,8 @@ scrcpy_otg(struct scrcpy_options *options) {
|
||||||
.always_on_top = options->always_on_top,
|
.always_on_top = options->always_on_top,
|
||||||
.window_x = options->window_x,
|
.window_x = options->window_x,
|
||||||
.window_y = options->window_y,
|
.window_y = options->window_y,
|
||||||
|
.window_width = options->window_width,
|
||||||
|
.window_height = options->window_height,
|
||||||
.window_borderless = options->window_borderless,
|
.window_borderless = options->window_borderless,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -69,8 +69,8 @@ sc_screen_otg_init(struct sc_screen_otg *screen,
|
||||||
? params->window_x : (int) SDL_WINDOWPOS_UNDEFINED;
|
? params->window_x : (int) SDL_WINDOWPOS_UNDEFINED;
|
||||||
int y = params->window_y != SC_WINDOW_POSITION_UNDEFINED
|
int y = params->window_y != SC_WINDOW_POSITION_UNDEFINED
|
||||||
? params->window_y : (int) SDL_WINDOWPOS_UNDEFINED;
|
? params->window_y : (int) SDL_WINDOWPOS_UNDEFINED;
|
||||||
int width = 256;
|
int width = params->window_width ? params->window_width : 256;
|
||||||
int height = 256;
|
int height = params->window_height ? params->window_height : 256;
|
||||||
|
|
||||||
uint32_t window_flags = SDL_WINDOW_ALLOW_HIGHDPI;
|
uint32_t window_flags = SDL_WINDOW_ALLOW_HIGHDPI;
|
||||||
if (params->always_on_top) {
|
if (params->always_on_top) {
|
||||||
|
@ -97,6 +97,11 @@ sc_screen_otg_init(struct sc_screen_otg *screen,
|
||||||
if (icon) {
|
if (icon) {
|
||||||
SDL_SetWindowIcon(screen->window, icon);
|
SDL_SetWindowIcon(screen->window, icon);
|
||||||
|
|
||||||
|
if (!SDL_RenderSetLogicalSize(screen->renderer, icon->w, icon->h)) {
|
||||||
|
LOGW("Could not set renderer logical size: %s", SDL_GetError());
|
||||||
|
// don't fail
|
||||||
|
}
|
||||||
|
|
||||||
screen->texture = SDL_CreateTextureFromSurface(screen->renderer, icon);
|
screen->texture = SDL_CreateTextureFromSurface(screen->renderer, icon);
|
||||||
scrcpy_icon_destroy(icon);
|
scrcpy_icon_destroy(icon);
|
||||||
if (!screen->texture) {
|
if (!screen->texture) {
|
||||||
|
|
|
@ -29,6 +29,8 @@ struct sc_screen_otg_params {
|
||||||
bool always_on_top;
|
bool always_on_top;
|
||||||
int16_t window_x; // accepts SC_WINDOW_POSITION_UNDEFINED
|
int16_t window_x; // accepts SC_WINDOW_POSITION_UNDEFINED
|
||||||
int16_t window_y; // accepts SC_WINDOW_POSITION_UNDEFINED
|
int16_t window_y; // accepts SC_WINDOW_POSITION_UNDEFINED
|
||||||
|
uint16_t window_width;
|
||||||
|
uint16_t window_height;
|
||||||
bool window_borderless;
|
bool window_borderless;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue