From 3179f61bc1aec63561060af2c95a2125649ac70f Mon Sep 17 00:00:00 2001 From: "trop[bot]" <37223003+trop[bot]@users.noreply.github.com> Date: Thu, 25 Sep 2025 15:22:16 -0400 Subject: [PATCH] fix: set ozone platform for wayland (#48309) * 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 3ffb61f202..fe083d5645 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 bb1cc5bd29..2b7b02eade 100644 --- a/shell/browser/electron_browser_main_parts.cc +++ b/shell/browser/electron_browser_main_parts.cc @@ -68,6 +68,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" @@ -209,9 +210,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