Skip to content

Commit 8e2b31f

Browse files
tytan652WizardCM
authored andcommitted
Set the right Ozone platform on Linux
Forcing CEF to use the right Ozone platform allows to avoid having a dependency on XWayland (a X11 socket) under Wayland.
1 parent 98d94a4 commit 8e2b31f

File tree

3 files changed

+23
-0
lines changed

3 files changed

+23
-0
lines changed

browser-app.cpp

+3
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,9 @@ void BrowserApp::OnBeforeCommandLineProcessing(
9696
"no-user-gesture-required");
9797
#ifdef __APPLE__
9898
command_line->AppendSwitch("use-mock-keychain");
99+
#elif !defined(_WIN32)
100+
command_line->AppendSwitchWithValue("ozone-platform",
101+
wayland ? "wayland" : "x11");
99102
#endif
100103
}
101104

browser-app.hpp

+10
Original file line numberDiff line numberDiff line change
@@ -77,10 +77,20 @@ class BrowserApp : public CefApp,
7777
bool shared_texture_available;
7878
CallbackMap callbackMap;
7979
int callbackId;
80+
#if !defined(__APPLE__) && !defined(_WIN32)
81+
bool wayland;
82+
#endif
8083

8184
public:
85+
#if defined(__APPLE__) || defined(_WIN32)
8286
inline BrowserApp(bool shared_texture_available_ = false)
8387
: shared_texture_available(shared_texture_available_)
88+
#else
89+
inline BrowserApp(bool shared_texture_available_ = false,
90+
bool wayland_ = false)
91+
: shared_texture_available(shared_texture_available_),
92+
wayland(wayland_)
93+
#endif
8494
{
8595
}
8696

obs-browser-plugin.cpp

+10
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,10 @@
4646
#include "signal-restore.hpp"
4747
#endif
4848

49+
#ifdef ENABLE_WAYLAND
50+
#include <obs-nix-platform.h>
51+
#endif
52+
4953
#ifdef ENABLE_BROWSER_QT_LOOP
5054
#include <QApplication>
5155
#include <QThread>
@@ -386,7 +390,13 @@ static void BrowserInit(void)
386390
}
387391
#endif
388392

393+
#if defined(__APPLE__) || defined(_WIN32) || !defined(ENABLE_WAYLAND)
389394
app = new BrowserApp(tex_sharing_avail);
395+
#else
396+
app = new BrowserApp(tex_sharing_avail,
397+
obs_get_nix_platform() ==
398+
OBS_NIX_PLATFORM_WAYLAND);
399+
#endif
390400

391401
#ifdef _WIN32
392402
CefExecuteProcess(args, app, nullptr);

0 commit comments

Comments
 (0)