1
0
mirror of synced 2024-11-24 07:40:17 +01:00

ui: Enable multi viewports on Linux again if you're not on Wayland

This commit is contained in:
WerWolv 2022-03-22 08:20:14 +01:00
parent 26a7b3325d
commit f7cfee55d5
3 changed files with 18 additions and 3 deletions

View File

@ -291,6 +291,8 @@ namespace hex {
bool isProcessElevated();
std::optional<std::string> getEnvironmentVariable(const std::string &env);
namespace scope_guard {
#define SCOPE_GUARD ::hex::scope_guard::ScopeGuardOnExit() + [&]()

View File

@ -451,4 +451,13 @@ namespace hex {
#endif
}
std::optional<std::string> getEnvironmentVariable(const std::string &env) {
auto value = std::getenv(env.c_str());
if (value == nullptr)
return std::nullopt;
else
return value;
}
}

View File

@ -41,6 +41,7 @@
#include "init/tasks.hpp"
#include <GLFW/glfw3.h>
#include <GLFW/glfw3native.h>
#include <nlohmann/json.hpp>
@ -650,9 +651,12 @@ namespace hex {
style.WindowRounding = 0.0F;
io.ConfigFlags |= ImGuiConfigFlags_DockingEnable | ImGuiConfigFlags_NavEnableKeyboard;
#if !defined(OS_LINUX)
io.ConfigFlags |= ImGuiConfigFlags_ViewportsEnable;
#endif
{
auto sessionType = hex::getEnvironmentVariable("XDG_SESSION_TYPE");
if (!sessionType || !hex::containsIgnoreCase(*sessionType, "wayland"))
io.ConfigFlags |= ImGuiConfigFlags_ViewportsEnable;
}
for (auto &entry : fonts->ConfigData)
io.Fonts->ConfigData.push_back(entry);