Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set the right Ozone platform on Linux #448

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions browser-app.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,9 @@ void BrowserApp::OnBeforeCommandLineProcessing(
"no-user-gesture-required");
#ifdef __APPLE__
command_line->AppendSwitch("use-mock-keychain");
#elif !defined(_WIN32)
command_line->AppendSwitchWithValue("ozone-platform",
wayland ? "wayland" : "x11");
#endif
}

Expand Down
10 changes: 10 additions & 0 deletions browser-app.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,20 @@ class BrowserApp : public CefApp,
bool shared_texture_available;
CallbackMap callbackMap;
int callbackId;
#if !defined(__APPLE__) && !defined(_WIN32)
bool wayland;
#endif

public:
#if defined(__APPLE__) || defined(_WIN32)
inline BrowserApp(bool shared_texture_available_ = false)
: shared_texture_available(shared_texture_available_)
#else
inline BrowserApp(bool shared_texture_available_ = false,
bool wayland_ = false)
: shared_texture_available(shared_texture_available_),
wayland(wayland_)
#endif
{
}

Expand Down
10 changes: 10 additions & 0 deletions obs-browser-plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,10 @@
#include "signal-restore.hpp"
#endif

#ifdef ENABLE_WAYLAND
#include <obs-nix-platform.h>
#endif

#ifdef ENABLE_BROWSER_QT_LOOP
#include <QApplication>
#include <QThread>
Expand Down Expand Up @@ -386,7 +390,13 @@ static void BrowserInit(void)
}
#endif

#if defined(__APPLE__) || defined(_WIN32) || !defined(ENABLE_WAYLAND)
app = new BrowserApp(tex_sharing_avail);
#else
app = new BrowserApp(tex_sharing_avail,
obs_get_nix_platform() ==
OBS_NIX_PLATFORM_WAYLAND);
#endif

#ifdef _WIN32
CefExecuteProcess(args, app, nullptr);
Expand Down