ui: Enable multi viewports on Linux again if you're not on Wayland
This commit is contained in:
parent
26a7b3325d
commit
f7cfee55d5
@ -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() + [&]()
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
}
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user