Skip to content

Commit

Permalink
fullscreen override
Browse files Browse the repository at this point in the history
  • Loading branch information
zoltanvb committed Jun 14, 2024
1 parent 561a0ea commit 1bd3b62
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 9 deletions.
21 changes: 13 additions & 8 deletions gfx/drivers/gl2.c
Original file line number Diff line number Diff line change
Expand Up @@ -4258,7 +4258,7 @@ static void *gl2_init(const video_info_t *video,
unsigned temp_width = 0;
unsigned temp_height = 0;
bool force_smooth = false;
bool fullscreen = false;
bool force_fullscreen = false;
const char *vendor = NULL;
const char *renderer = NULL;
const char *version = NULL;
Expand All @@ -4282,12 +4282,11 @@ static void *gl2_init(const video_info_t *video,
gl->ctx_driver->get_video_size(gl->ctx_data,
&mode_width, &mode_height);

fullscreen = video->fullscreen;
if (!fullscreen && !gl->ctx_driver->has_windowed)
if (!video->fullscreen && !gl->ctx_driver->has_windowed)
{
RARCH_DBG("[GL]: Config requires windowed mode, but context driver does not support it. "
"Forcing fullscreen for this session.\n");
fullscreen = true;
force_fullscreen = true;
}

#if defined(DINGUX)
Expand Down Expand Up @@ -4315,22 +4314,28 @@ static void *gl2_init(const video_info_t *video,
win_width = video->width;
win_height = video->height;

if (fullscreen && (win_width == 0) && (win_height == 0))
if (video->fullscreen && (win_width == 0) && (win_height == 0))
{
win_width = full_x;
win_height = full_y;
}
/* If fullscreen had to be forced, video->width/height is incorrect */
else if (force_fullscreen)
{
win_width = settings->uints.video_fullscreen_x;
win_height = settings->uints.video_fullscreen_y;
}

if ( !gl->ctx_driver->set_video_mode
|| !gl->ctx_driver->set_video_mode(gl->ctx_data,
win_width, win_height, fullscreen))
win_width, win_height, (video->fullscreen || force_fullscreen)))
goto error;
#if defined(__APPLE__) && !defined(IOS) && !defined(HAVE_COCOA_METAL)
/* This is a hack for now to work around a very annoying
* issue that currently eludes us. */
if ( !gl->ctx_driver->set_video_mode
|| !gl->ctx_driver->set_video_mode(gl->ctx_data,
win_width, win_height, fullscreen))
win_width, win_height, (video->fullscreen || force_fullscreen)))
goto error;
#endif

Expand Down Expand Up @@ -4455,7 +4460,7 @@ static void *gl2_init(const video_info_t *video,
gl2_begin_debug(gl);
#endif

if (fullscreen)
if (video->fullscreen || force_fullscreen)
gl->flags |= GL2_FLAG_FULLSCREEN;

mode_width = 0;
Expand Down
2 changes: 1 addition & 1 deletion gfx/video_driver.c
Original file line number Diff line number Diff line change
Expand Up @@ -1243,7 +1243,7 @@ void video_switch_refresh_rate_maybe(
unsigned video_bfi = settings->uints.video_black_frame_insertion;
unsigned shader_subframes = settings->uints.video_shader_subframes;
bool vrr_runloop_enable = settings->bools.vrr_runloop_enable;
bool exclusive_fullscreen = !video_driver_has_windowed() || (
bool exclusive_fullscreen = (video_st->flags | VIDEO_FLAG_FORCE_FULLSCREEN) || (
settings->bools.video_fullscreen && !settings->bools.video_windowed_fullscreen);
bool windowed_fullscreen = settings->bools.video_fullscreen && settings->bools.video_windowed_fullscreen;
bool all_fullscreen = settings->bools.video_fullscreen || settings->bools.video_windowed_fullscreen;
Expand Down

0 comments on commit 1bd3b62

Please sign in to comment.