Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Force fullscreen when using the KMSDRM video driver #4645

Open
wants to merge 2 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion app/src/screen.c
Original file line number Diff line number Diff line change
Expand Up @@ -362,12 +362,14 @@ sc_screen_init(struct sc_screen *screen,
screen->maximized = false;
screen->minimized = false;
screen->mouse_capture_key_pressed = 0;
screen->is_kmsdrm = strcmp(SDL_GetCurrentVideoDriver(), "KMSDRM") == 0;

screen->req.x = params->window_x;
screen->req.y = params->window_y;
screen->req.width = params->window_width;
screen->req.height = params->window_height;
screen->req.fullscreen = params->fullscreen;
// The kmsdrm video driver switches to a low resolution on "windowed" mode
screen->req.fullscreen = screen->is_kmsdrm ? true : params->fullscreen;
screen->req.start_fps_counter = params->start_fps_counter;

bool ok = sc_frame_buffer_init(&screen->fb);
Expand Down Expand Up @@ -657,6 +659,11 @@ sc_screen_update_frame(struct sc_screen *screen) {

void
sc_screen_switch_fullscreen(struct sc_screen *screen) {
if (screen->is_kmsdrm && screen->fullscreen) {
LOGD("Ignored mode switch");
return;
}

uint32_t new_mode = screen->fullscreen ? 0 : SDL_WINDOW_FULLSCREEN_DESKTOP;
if (SDL_SetWindowFullscreen(screen->window, new_mode)) {
LOGW("Could not switch fullscreen mode: %s", SDL_GetError());
Expand Down
1 change: 1 addition & 0 deletions app/src/screen.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ struct sc_screen {
bool fullscreen;
bool maximized;
bool minimized;
bool is_kmsdrm;

// To enable/disable mouse capture, a mouse capture key (LALT, LGUI or
// RGUI) must be pressed. This variable tracks the pressed capture key.
Expand Down