From ec92fbcd678dc0b450319e809e2f90ddb0c25375 Mon Sep 17 00:00:00 2001 From: "trop[bot]" <37223003+trop[bot]@users.noreply.github.com> Date: Tue, 7 Oct 2025 11:27:45 +0200 Subject: [PATCH] fix: set ozone platform for wayland (#48310) * fix: set ozone platform for wayland Co-authored-by: clavin * whoops, includes. thx charles Co-authored-by: clavin --------- Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com> Co-authored-by: clavin --- BUILD.gn | 1 + shell/browser/electron_browser_main_parts.cc | 8 +++++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/BUILD.gn b/BUILD.gn index 5344d87749a..2a6ee90e5fa 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -655,6 +655,7 @@ source_set("electron_lib") { "//ui/events/devices/x11", "//ui/events/platform/x11", "//ui/gtk:gtk_config", + "//ui/linux:display_server_utils", "//ui/linux:linux_ui", "//ui/linux:linux_ui_factory", "//ui/wm", diff --git a/shell/browser/electron_browser_main_parts.cc b/shell/browser/electron_browser_main_parts.cc index 88fe2ef6787..e6b732c67e5 100644 --- a/shell/browser/electron_browser_main_parts.cc +++ b/shell/browser/electron_browser_main_parts.cc @@ -67,6 +67,7 @@ #include "ui/base/ui_base_switches.h" #include "ui/color/color_provider_manager.h" #include "ui/display/screen.h" +#include "ui/linux/display_server_utils.h" #include "ui/views/layout/layout_provider.h" #include "url/url_util.h" @@ -207,9 +208,14 @@ int ElectronBrowserMainParts::PreEarlyInitialization() { #if BUILDFLAG(IS_POSIX) HandleSIGCHLD(); #endif +#if BUILDFLAG(IS_OZONE) + // Initialize Ozone platform and add required feature flags as per platform's + // properties. #if BUILDFLAG(IS_LINUX) - ui::OzonePlatform::PreEarlyInitialization(); + ui::SetOzonePlatformForLinuxIfNeeded(*base::CommandLine::ForCurrentProcess()); #endif + ui::OzonePlatform::PreEarlyInitialization(); +#endif // BUILDFLAG(IS_OZONE) #if BUILDFLAG(IS_MAC) screen_ = std::make_unique(); #endif