Accept resize shortcuts on maximized window
Allow "resize to fit" and "resize to pixel-perfect" on maximized window: restore the window to normal size then resize.
This commit is contained in:
parent
35c05bb3ce
commit
aa0f77c898
1 changed files with 23 additions and 10 deletions
|
@ -309,22 +309,35 @@ screen_switch_fullscreen(struct screen *screen) {
|
||||||
|
|
||||||
void
|
void
|
||||||
screen_resize_to_fit(struct screen *screen) {
|
screen_resize_to_fit(struct screen *screen) {
|
||||||
if (!screen->fullscreen && !screen->maximized) {
|
if (screen->fullscreen) {
|
||||||
struct size optimal_size = get_optimal_window_size(screen,
|
return;
|
||||||
screen->frame_size);
|
|
||||||
SDL_SetWindowSize(screen->window, optimal_size.width,
|
|
||||||
optimal_size.height);
|
|
||||||
LOGD("Resized to optimal size");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (screen->maximized) {
|
||||||
|
SDL_RestoreWindow(screen->window);
|
||||||
|
screen->maximized = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
struct size optimal_size =
|
||||||
|
get_optimal_window_size(screen, screen->frame_size);
|
||||||
|
SDL_SetWindowSize(screen->window, optimal_size.width, optimal_size.height);
|
||||||
|
LOGD("Resized to optimal size");
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
screen_resize_to_pixel_perfect(struct screen *screen) {
|
screen_resize_to_pixel_perfect(struct screen *screen) {
|
||||||
if (!screen->fullscreen && !screen->maximized) {
|
if (screen->fullscreen) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (screen->maximized) {
|
||||||
|
SDL_RestoreWindow(screen->window);
|
||||||
|
screen->maximized = false;
|
||||||
|
}
|
||||||
|
|
||||||
SDL_SetWindowSize(screen->window, screen->frame_size.width,
|
SDL_SetWindowSize(screen->window, screen->frame_size.width,
|
||||||
screen->frame_size.height);
|
screen->frame_size.height);
|
||||||
LOGD("Resized to pixel-perfect");
|
LOGD("Resized to pixel-perfect");
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
Loading…
Reference in a new issue