Add fullscreen desktop option for non-ge capable device

This commit is contained in:
Benau 2022-11-08 12:08:27 +08:00
parent d9fad6ab55
commit 4c7353a3a4
5 changed files with 24 additions and 13 deletions

View File

@ -24,7 +24,7 @@ struct GEConfig
bool m_disable_npot_texture;
bool m_convert_irrlicht_mesh;
bool m_texture_compression;
bool m_vulkan_fullscreen_desktop;
bool m_fullscreen_desktop;
bool m_enable_draw_call_cache;
std::unordered_set<std::string> m_ondemand_load_texture_paths;
float m_render_scale;

View File

@ -94,9 +94,9 @@ CIrrDeviceSDL::CIrrDeviceSDL(const SIrrlichtCreationParameters& param)
// Prevent fullscreen minimizes when losing focus
if (CreationParams.Fullscreen)
{
if (CreationParams.DriverType != video::EDT_VULKAN)
if (!GE::getGEConfig()->m_fullscreen_desktop)
SDL_SetHint(SDL_HINT_VIDEO_MINIMIZE_ON_FOCUS_LOSS, "0");
else if (!GE::getGEConfig()->m_vulkan_fullscreen_desktop)
else if (CreationParams.DriverType != video::EDT_VULKAN)
SDL_SetHint(SDL_HINT_VIDEO_MINIMIZE_ON_FOCUS_LOSS, "0");
}
#endif
@ -356,7 +356,7 @@ bool versionCorrect(int major, int minor)
extern "C" void update_fullscreen_desktop(int val)
{
GE::GEVulkanDriver* gevk = GE::getVKDriver();
if (!gevk || !GE::getGEConfig()->m_vulkan_fullscreen_desktop)
if (!gevk || !GE::getGEConfig()->m_fullscreen_desktop)
return;
SDL_Window* window = gevk->getSDLWindow();
@ -442,8 +442,7 @@ bool CIrrDeviceSDL::createWindow()
if (CreationParams.Fullscreen)
{
if (CreationParams.DriverType == video::EDT_VULKAN &&
GE::getGEConfig()->m_vulkan_fullscreen_desktop)
if (GE::getGEConfig()->m_fullscreen_desktop)
{
flags |= SDL_WINDOW_FULLSCREEN_DESKTOP;
CreationParams.Fullscreen = false;

View File

@ -732,6 +732,10 @@ namespace UserConfigParams
&m_video_group, "Use SDL_WINDOW_FULLSCREEN_DESKTOP for vulkan device"));
#endif
PARAM_PREFIX BoolUserConfigParam m_non_ge_fullscreen_desktop
PARAM_DEFAULT(BoolUserConfigParam(false, "non_ge_fullscreen_desktop",
&m_video_group, "Use SDL_WINDOW_FULLSCREEN_DESKTOP for non-ge device"));
// ---- Recording
PARAM_PREFIX GroupUserConfigParam m_recording_group
PARAM_DEFAULT(GroupUserConfigParam("Recording",

View File

@ -510,8 +510,6 @@ begin:
UserConfigParams::m_texture_compression;
GE::getGEConfig()->m_render_scale =
UserConfigParams::m_scale_rtts_factor;
GE::getGEConfig()->m_vulkan_fullscreen_desktop =
UserConfigParams::m_vulkan_fullscreen_desktop;
#endif
}
else
@ -526,6 +524,13 @@ begin:
#endif
}
#ifndef SERVER_ONLY
GE::getGEConfig()->m_fullscreen_desktop =
(driver_created == video::EDT_VULKAN &&
UserConfigParams::m_vulkan_fullscreen_desktop) ||
UserConfigParams::m_non_ge_fullscreen_desktop;
#endif
// Try 32 and, upon failure, 24 then 16 bit per pixels
for (int bits=32; bits>15; bits -=8)
{

View File

@ -321,11 +321,14 @@ void OptionsScreenVideo::init()
assert( rememberWinposText != NULL );
#endif
bool is_fullscreen_desktop = false;
bool is_vulkan_fullscreen_desktop = false;
#ifndef SERVER_ONLY
is_fullscreen_desktop =
GE::getGEConfig()->m_fullscreen_desktop;
is_vulkan_fullscreen_desktop =
GE::getDriver()->getDriverType() == video::EDT_VULKAN &&
GE::getGEConfig()->m_vulkan_fullscreen_desktop;
is_fullscreen_desktop;
#endif
// --- get resolution list from irrlicht the first time
@ -371,8 +374,8 @@ void OptionsScreenVideo::init()
}
}
// Vulkan use fullscreen desktop so only show current screen size
if (is_vulkan_fullscreen_desktop)
// Use fullscreen desktop so only show current screen size
if (is_fullscreen_desktop)
{
found_config_res = false;
m_resolutions.clear();
@ -384,7 +387,7 @@ void OptionsScreenVideo::init()
{
r.width = UserConfigParams::m_real_width;
r.height = UserConfigParams::m_real_height;
r.fullscreen = is_vulkan_fullscreen_desktop;
r.fullscreen = is_fullscreen_desktop;
m_resolutions.push_back(r);
if (r.width == 1024 && r.height == 768)
@ -896,7 +899,7 @@ void OptionsScreenVideo::eventCallback(Widget* widget, const std::string& name,
rememberWinpos->setActive(!fullscreen->getState());
#ifndef SERVER_ONLY
GE::GEVulkanDriver* gevk = GE::getVKDriver();
if (gevk && GE::getGEConfig()->m_vulkan_fullscreen_desktop)
if (gevk && GE::getGEConfig()->m_fullscreen_desktop)
{
UserConfigParams::m_fullscreen = fullscreen->getState();
update_fullscreen_desktop(UserConfigParams::m_fullscreen);