refactor: remove introduce_ozoneplatform_electron_can_call_x11_property.patch (#47075)

* refactor: use x11_util::IsX11() in BuildSubmenuFromModel()

* refactor: use x11_util::IsX11() in ElectronDesktopWindowTreeHostLinux::OnBoundsChanged()

* refactor: use skia_can_fall_back_to_x11 in x11_util::IsX11()

it is identical in practice to electron_can_call_x11 and does not require a Chromium patch

* chore: remove introduce_ozoneplatform_electron_can_call_x11_property.patch

* refactor: use ui::GetOzonePlatformId() to test for x11
This commit is contained in:
Charles Kerr
2025-05-13 23:38:35 -05:00
committed by GitHub
parent 9aacc473e6
commit 11fa915724
5 changed files with 7 additions and 48 deletions

View File

@@ -74,7 +74,6 @@ fix_aspect_ratio_with_max_size.patch
port_autofill_colors_to_the_color_pipeline.patch
fix_non-client_mouse_tracking_and_message_bubbling_on_windows.patch
build_make_libcxx_abi_unstable_false_for_electron.patch
introduce_ozoneplatform_electron_can_call_x11_property.patch
make_gtk_getlibgtk_public.patch
custom_protocols_plzserviceworker.patch
feat_filter_out_non-shareable_windows_in_the_current_application_in.patch

View File

@@ -1,37 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Marek Rusinowski <marekrusinowski@gmail.com>
Date: Wed, 23 Mar 2022 21:09:37 +0100
Subject: introduce OzonePlatform::electron_can_call_x11 property
We expose this additonal property in the OzonePlatform to be able to easily
determine whatever we can call X11 functions without crashing the application
at rutime. It would be best if eventually all usages of this property were
replaced with clean ozone native implementations.
diff --git a/ui/ozone/platform/x11/ozone_platform_x11.cc b/ui/ozone/platform/x11/ozone_platform_x11.cc
index 4f00f630665a10a0fb85fe7c2ddc0fa67add1603..e9e8da125b518387546275bf84e0b09c3d49e254 100644
--- a/ui/ozone/platform/x11/ozone_platform_x11.cc
+++ b/ui/ozone/platform/x11/ozone_platform_x11.cc
@@ -194,6 +194,7 @@ class OzonePlatformX11 : public OzonePlatform,
base::MessagePumpType::UI;
properties->supports_vulkan_swap_chain = true;
properties->skia_can_fall_back_to_x11 = true;
+ properties->electron_can_call_x11 = true;
properties->platform_shows_drag_image = false;
properties->app_modal_dialogs_use_event_blocker = true;
properties->fetch_buffer_formats_for_gmb_on_gpu = true;
diff --git a/ui/ozone/public/ozone_platform.h b/ui/ozone/public/ozone_platform.h
index 1384e1620dc07874e2103d12cd6f31da5ca7a821..7c8639f6f57fd3b8977bbb3d811edf466b4ccc64 100644
--- a/ui/ozone/public/ozone_platform.h
+++ b/ui/ozone/public/ozone_platform.h
@@ -129,6 +129,10 @@ class COMPONENT_EXPORT(OZONE) OzonePlatform {
// Linux only: determines if Skia can fall back to the X11 output device.
bool skia_can_fall_back_to_x11 = false;
+ // Linux only: determines is Electron can call selected X11 functions while
+ // it migrates to pure ozone abstractions.
+ bool electron_can_call_x11 = false;
+
// Wayland only: determines whether windows which are not top level ones
// should be given parents explicitly.
bool set_parent_for_non_top_level_windows = false;

View File

@@ -4,14 +4,13 @@
#include "shell/browser/linux/x11_util.h"
#include "ui/ozone/public/ozone_platform.h"
#include "ui/ozone/platform_selection.h" // nogncheck
namespace x11_util {
bool IsX11() {
return ui::OzonePlatform::GetInstance()
->GetPlatformProperties()
.electron_can_call_x11;
static const bool is_x11 = ui::GetOzonePlatformId() == ui::kPlatformX11;
return is_x11;
}
} // namespace x11_util

View File

@@ -13,6 +13,7 @@
#include "base/feature_list.h"
#include "base/i18n/rtl.h"
#include "shell/browser/api/electron_api_web_contents.h"
#include "shell/browser/linux/x11_util.h"
#include "shell/browser/native_window_features.h"
#include "shell/browser/native_window_views.h"
#include "shell/browser/ui/views/client_frame_view_linux.h"
@@ -82,9 +83,7 @@ void ElectronDesktopWindowTreeHostLinux::OnBoundsChanged(
views::DesktopWindowTreeHostLinux::OnBoundsChanged(change);
UpdateFrameHints();
if (ui::OzonePlatform::GetInstance()
->GetPlatformProperties()
.electron_can_call_x11) {
if (x11_util::IsX11()) {
// The OnWindowStateChanged should receive all updates but currently under
// X11 it doesn't receive changes to the fullscreen status because chromium
// is handling the fullscreen state changes synchronously, see

View File

@@ -12,6 +12,7 @@
#include "base/containers/flat_map.h"
#include "base/strings/utf_string_conversions.h"
#include "chrome/app/chrome_command_ids.h"
#include "shell/browser/linux/x11_util.h"
#include "shell/browser/ui/gtk_util.h"
#include "third_party/skia/include/core/SkBitmap.h"
#include "ui/base/accelerators/accelerator.h"
@@ -219,9 +220,7 @@ void BuildSubmenuFromModel(ui::MenuModel* model,
connect_to_activate = false;
}
if (ui::OzonePlatform::GetInstance()
->GetPlatformProperties()
.electron_can_call_x11) {
if (x11_util::IsX11()) {
ui::Accelerator accelerator;
if (model->GetAcceleratorAt(i, &accelerator)) {
gtk_widget_add_accelerator(menu_item, "activate", nullptr,