Disable X11 on Wayland unless explicitly activated.
This commit is contained in:
parent
917309e99c
commit
180f2b70fa
@ -426,9 +426,9 @@ void Application::cleanup()
|
||||
bool Application::initSDL()
|
||||
{
|
||||
#if MIJIN_TARGET_OS == MIJIN_OS_LINUX
|
||||
// prefer x11 over wayland, as ImGui viewports don't work with wayland
|
||||
// TODO: this still doesn't work all the time, maybe there will be an update to ImGui in the future?
|
||||
if (mConfig.flags.x11OnWayland) {
|
||||
SDL_SetHint(SDL_HINT_VIDEO_DRIVER, "x11,wayland");
|
||||
}
|
||||
#endif
|
||||
if (!SDL_Init(SDL_INIT_VIDEO))
|
||||
{
|
||||
|
@ -51,6 +51,21 @@ struct FontConfig
|
||||
FontFlags flags;
|
||||
};
|
||||
|
||||
struct ApplicationFlags : mijin::BitFlags<ApplicationFlags>
|
||||
{
|
||||
/**
|
||||
* (Linux only) prefer X11 even when on Wayland. Required for multi-viewport support, but currently really buggy.
|
||||
* \see https://github.com/ocornut/imgui/issues/8609
|
||||
* \see https://github.com/ocornut/imgui/issues/8587
|
||||
*/
|
||||
bool x11OnWayland : 1 = false;
|
||||
};
|
||||
|
||||
struct ApplicationConfig
|
||||
{
|
||||
ApplicationFlags flags = {};
|
||||
};
|
||||
|
||||
class Application
|
||||
{
|
||||
private:
|
||||
@ -65,6 +80,7 @@ private:
|
||||
bool mRunning = true;
|
||||
ImGuiWindowFlags mMainWindowFlags = DEFAULT_MAIN_WINDOW_FLAGS;
|
||||
std::unordered_map<ImGuiStyleVar, std::variant<float, ImVec2>> mMainWindowStyles;
|
||||
const ApplicationConfig mConfig;
|
||||
|
||||
using GLbitfield = std::uint32_t;
|
||||
using GLint = std::int32_t;
|
||||
@ -91,8 +107,12 @@ private:
|
||||
glTexImage2D_fn_t glTexImage2D;
|
||||
glDeleteTextures_fn_t glDeleteTextures;
|
||||
public:
|
||||
explicit Application(ApplicationConfig config = {}) noexcept : mConfig(config) {}
|
||||
virtual ~Application() = default;
|
||||
|
||||
[[nodiscard]]
|
||||
const ApplicationConfig& getConfig() const noexcept { return mConfig; }
|
||||
|
||||
[[nodiscard]]
|
||||
mijin::StackedFileSystemAdapter& getFS() { return mFS; }
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user